Four Js Development Tools Forum

General => Ask Reuben => Topic started by: Reuben B. on November 11, 2020, 11:26:53 pm

Title: Ask Reuben 55 - Viewing PDF
Post by: Reuben B. on November 11, 2020, 11:26:53 pm
The immediate answer to how to view a PDF document from a Genero application is to put the PDF document on a Web Server somewhere and view it using the launchURL front-call.

  1. CALL ui.Interface.frontCall("standard","launchURL",url,[])

As per the tip in the documentation this maybe simplified with use  of the ui.Interface.filenameToUri() method to generate a url for a PDF on your application server.

A method that also works on the GDC is to use FGL_PUTFILE to put the PDF where the GDC can reference it, and then use the shellExec front-call to view the PDF document.

  1. CALL ui.Interface.frontCall("standard","shellExec", filename,result)

The characteristic of both techniques is that they are using the default viewer to view the PDF document.   So in the browser it will view the PDF the same as any other web page shows a PDF, and in the GDC case it is the equivalent of double-clicking on a PDF file in Windows Explorer to view the PDF, normally Adobe Reader.  You get the functionality of that default viewer.

The question of how to view a PDF is normally asked by those who are looking to view the PDF document inside a GDC window.  That is not in a browser window or not in an Adobe window, but in a window of the Genero application.  There are some techniques you can use to achieve this should you wish to go down this path...

To read more click on

Title: Re: Ask Reuben 55 - Viewing PDF
Post by: Leo S. on November 11, 2020, 11:49:05 pm
I'd like to add that there was also a discussion in this forum using PDFJS in a webcomponent quite a while ago:
The most recent sample for that can be found at

and works for both the recent GDC and GBC in direct/SSH and GAS mode.
If I get enough positive feedback I will move it to our official fourjs GitHub repo as a ex_pdfjs_urlbased sample.

Regards , Leo