iPhone:
Download an app like iMazing, PhoneView, or TouchCopy.
Connect your iPhone to your computer.
Use the app to access and export text messages as PDF.
Download an app like SMS Backup+, SMS Backup & Restore, or Droid Transfer.
Use the app to back up and export text messages to PDF.