Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Ask Reuben 55 - Viewing PDF  (Read 6524 times)
Reuben B.
Four Js
Posts: 1116


« 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.

Code
  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.

Code
  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 https://4js.com/ask-reuben/ig-55/

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Leo S.
Four Js
Posts: 129


« Reply #1 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:
See https://forum.4js.com/fjs_forum/index.php?topic=1004.0
The most recent sample for that can be found at

https://github.com/leopatras/pdfjs_urlbased

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
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines