0

I need to generate a document that will be printed in several platforms - iOS (Airprint), Android, and through a web browser. All of these platforms will be calling an API written in VB.NET which sends data back in an XML format. I would like to centralize the logic for generating the document to be printed so that it is done by the API for all platforms.

How would you recommend sending a document to be printed to these platforms? I was considering generating a PDF file on the .NET side and base64 encoding it. Then iOS/Android/Web would render the PDF and print it. Would you instead recommend generating an HTML file instead of a PDF? I'm mostly concerned with iOS and Android being able to render the document and print it.

user1333935
  • 61
  • 1
  • 6

1 Answers1

0

You can create a html template on your .net side. Use the template, by passing appropriate data and get required html. You can return this html link from api. benefit of using html is that it can be loaded directly in ios as well as Android using native webviews in both cases.

In case of pdf file, if you would like to generate pdf file , rather than encoding i would suggest save it in your database base and return the path of the file.

UIDocumentInteractionController will help u to render pdf file from url in ios. Then you can AirPrint the required document. From Android 4.4+,you can use printing API. You can take help from this ans.

On older devices, you would need to ask the printer manufacturer if they have any means of supporting printing from Android, or use something like Google Cloud Print.

In case of any specific Printers, they must have come with the SDK to support Android as well as iOS.

I hope it helps. Happy Coding!!

luckyShubhra
  • 2,731
  • 1
  • 12
  • 19