2
In my application made in Totalcross, I make a call REST and the same returns a byte[]
where I convert it to a PDF and save it to a specific directory within the device.
In this flow, everything is ok.
My need is to. within the application, I need to open the PDF or suggest for the user to open with some specific application as is done for example on Android, using Intent: https://stackoverflow.com/a/17453242/1132083
Is there any way to suggest to the user or open the PDF through my application?
Which platform target? I remember having available for Android something in this sense, I do not remember the others...
– Jefferson Quesado
See if this link helps: https://gitlab.com/totalcross/TotalCross/wikis/Features/open%20known%20files%20in%20Android; if it helps, I turn it into a complete answer here
– Jefferson Quesado
Need for Android, iOS and Simulator.
– Gustavo Bitencourt
I tried to use: 'Vm.exec("url", pdf, 0, true);' where pdf is the path to the pdf file.. tried in "Simulator" and did not succeed.. had no action..
– Gustavo Bitencourt
@Jeffersonquesado have any suggestions to get around this? Otherwise.. I will have to develop this functionality in another way..
– Gustavo Bitencourt
I believe that this question can be closed because it has no such solution with Totalcross.
– Gustavo Bitencourt
The fact that it doesn’t work in the simulator doesn’t mean it doesn’t work on platforms. Totalcrossapi has examples of how to open a PDF. Search for sys / Xternal viewers
– Guilherme Campos Hazan
Thank you Guilherme. I had already done it with the Sys viewers, and actually opened the PDF on both platforms.. However, I had another problem.. On Android, I believe it calls an Intent requesting an APP to open the PDF.. However, on iOS, it opens in a Uiwebview component... and in this case, it is impossible to 'share' the PDF.. Because such functionality that I need to implement requires that in addition to opening, you can share the PDF via Whatsapp, for example. Anyway, thank you for your reply.
– Gustavo Bitencourt