How Do I View a PDF in My Mobile Application? (Magic xpa 3.x)
You can view a PDF using Magic xpa's internal Browser control.
Note that the PDF should be located on the server and not locally on the device.
Most of the Android browsers do not display PDFs. Therefore, you cannot use Magic xpa's internal Browser control to view a PDF.
However, you can view a PDF using a third-party PDF viewer application. You do this as follows:
-
Create an Invoke OS Cmd operation.
-
Make sure that the Execute On property is set to Client.
-
Set the command with a syntax of pdf:filename where filename is a path to a local file that is stored on a public folder on the device, such as the /SDCARD folder.
For example, the following commands will copy the ReleaseNotes.pdf file from the C:\Magic\ folder on the server to the /SDCAD folder on the client and will open a PDF viewer to show this file:
-
Evaluate ClientFileCopy(ServerFileToClient('C:\Magic\ReleaseNotes.pdf'),'/sdcard/tmpfile.pdf')
-
Invoke OS 'pdf:/sdcard/tmpfile.pdf'