Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Adrian L. on August 14, 2017, 07:54:55 am



Title: GDC preview PDF file
Post by: Adrian L. on August 14, 2017, 07:54:55 am
Dear All,

   I know it is possible to call a client function to display a PDF file from the server to the client in Acrobat reader or in chrome.


   Is it possible to display a PDF file within a Genero form? (just for display only)

   The client is GDC.



Cheers,
Adrian


Title: Re: GDC preview PDF file
Post by: Stefan S. on August 15, 2017, 10:36:39 am
Good Morning Adrian,

have a look at "Display PDF-Files in GDC" in the Forum.
I asked the same a year ago.

You can use pdf.js to display a pdf file in GDC.
But you have to use GDC 3.0 and you must have running Webserver like apache.
You can zoom or rotate the PDF in GDC, but you cannot print or download it.
For this you have to write own functions.

We uses pdf.js in several new project and it is working fine for our needs.

Kind regard

Stefan S.


Title: Re: GDC preview PDF file
Post by: Leo S. on August 15, 2017, 11:48:33 pm
Hi Adrian, the sample at
https://www.generomobile.de/gmi/pdfviewX.zip
shows how you can use
1. fgl_putfile to transfer the pdf to the GDC and launch it client side
The default PDF viewer on your system should popup (Acrobat if installed)

2. how you can display it inside a webview if you run via GAS (GDC>=3.00)


Title: Re: GDC preview PDF file
Post by: Leo S. on August 15, 2017, 11:51:41 pm
Oops my Greetings were eaten...
Best regards, Leo


Title: Re: GDC preview PDF file
Post by: Reuben B. on August 16, 2017, 04:06:49 am
Leo,

The keys part of the request are using GDC and to display PDF inside a GDC Window. 

As I understand it the rendering engine of the WebComponent does not have the appropriate plugins to render a PDF document inside a WebComponent.  The acid test I use with each GDC version is to try something like ...

Code
  1. DISPLAY "http://4js.com/mirror/documentation.php?s=genero&f=fjs-genero-3.00.XX-PlatformsDb.pdf" TO browser

... hence the use of solutions involving pdf.js

At the moment, my suggestion would be to use a 3rd party tool such as imageMagick to convert a pdf to an image file for each page and display the image file.  In Genero 3.10, instead of imageMagick you can use Genero Report Writer to create an image for each page of the PDF.  I have put my sample that does this up here https://github.com/FourjsGenero/ex_embeddedpdfviewer, unfortunately there is an issue where I get black background instead of white in most circumstances https://github.com/FourjsGenero/ex_embeddedpdfviewer/issues/2 which I have reported internally and will hopefully be resolved before 3.10 is released next month.

Ideally though the WebComponent engine would have a PDF Viewer plug in built in so that PDF Documents could be rendered inside a Genero form rather than outside in Adobe.

Reuben




Title: Re: GDC preview PDF file
Post by: Leo S. on August 26, 2017, 12:49:40 am
My bad, I didn't carefully read Adrians request that he wanted the pdf viewer embedded.
There was the thread " Display PDF-Files in GDC  "
http://4js.com/support/forum/?topic=1139.new&key=d202b1bf2912?topic=1139.new&key=d202b1bf2912
were I was discussing with Snorri and others about the possible use of pdf.js.

Good news for GDC3.10: the discussed file transferring is no more needed in direct mode,
so since 3.10 I can recommend pdf.js !
See attached zip.

For the 'native' display of a pdf in the Chromium based Webcomponent made with QtWebengine there is https://bugreports.qt.io/browse/QTBUG-57982,
you see, its unfortunately not fixed yet...

Regards, Leo


Title: Re: GDC preview PDF file
Post by: Leo S. on August 26, 2017, 12:59:47 am
sorry the "Display PDF-Files in GDC"  link is http://4js.com/fjs_forum/index.php?topic=1004.0