It is currently 17 January 2025, 21:10 Advanced search

Embed PDF to a form

Questions and answers on how to best use Instant Developer

Embed PDF to a form

Postby john w » 13 November 2023, 15:57

I have a form with what is a effectively in the form of a calculator. Part of the process is for the user to know the value of particular components. To help with that I created a lookup process. However, the customer does not want that. They want the values shown as a .pdf to the right of the calculator. So this effectively means I need to embed the .pdf (from a 3rd party) to a part of the form. I can split the form, add a panel, etc.

Is there a 'best' way to embed the pdf file? I want it to reliably show when the form loads.

Any suggestions are appreciated.
Regards

John W
User avatar
john w
 
Posts: 823
Joined: 24 October 2012, 16:29
Location: Apple Valley, Minnesota USA

Re: Embed PDF to a form

Postby ljwilson » 14 November 2023, 2:14

How big is the embedded pdf? Is it the same one or different each time? Is it on the same server as your application, or is it coming from another site?

One thought would be to have a JavaScript PDF viewer that shows it on a panel. This one looks promising:
PDF.js
https://mozilla.github.io/pdf.js/

...jack
ljwilson
 
Posts: 779
Joined: 26 November 2013, 14:15

Re: Embed PDF to a form

Postby john w » 14 November 2023, 15:23

Jack - its a single page, and is only changes annually. It needs to be a part of the form. I suppose I convert it to an image and embed it in the form, kind of like a logo only larger. I am poor with javascript. I am was thinking I could perhaps use an html field and load it into an iframe when the form loads.
Regards

John W
User avatar
john w
 
Posts: 823
Joined: 24 October 2012, 16:29
Location: Apple Valley, Minnesota USA

Re: Embed PDF to a form - Updated

Postby john w » 14 November 2023, 16:25

I added a html field and set it to run an iframe. It loads the document like I want. However, there must be a better option. The iframe has a toolbar I would like to get rid and sizing is not 100% perfect. I may need to do some more research.

*****Update****
Html allows for an 'embed' tag or the 'iframe' tage. In more expermentation. I believe I am getting good results with the iframe. I switched sizing from px to % and it solved the sizing problem.
Regards

John W
User avatar
john w
 
Posts: 823
Joined: 24 October 2012, 16:29
Location: Apple Valley, Minnesota USA

Re: Embed PDF to a form

Postby mcdok » 16 November 2023, 8:44

Hi, you could try with this parameters:

page=pagenum – Specifies a number (integer) of the page in the document. The document’s first page has a pagenum value of 1.
zoom=scale – Sets the zoom and scroll factors, using float or integer values. For example, a scale value of 100 indicates a zoom value of 100%.
view=Fit – Set the view of the displayed page.
scrollbar=1|0 – Turns scrollbars on or off.
toolbar=1|0 – Turns the toolbar on or off.
statusbar=1|0 – Turns the status bar on or off.
navpanes=1|0 – Turns the navigation panes and tabs on or off.

http://example.com/doc.pdf#Chapter5
http://example.com/doc.pdf#page=5
http://example.com/doc.pdf#page=3&zoom=200,250,100
http://example.com/doc.pdf#zoom=100
http://example.com/doc.pdf#page=72&view=fitH,100
mcdok
 
Posts: 855
Joined: 19 July 2011, 16:18

Re: Embed PDF to a form

Postby john w » 16 November 2023, 15:43

mcdok - Thanks! for the settings list, I will try them to see if I can get rid of the pdf toolbar that annoys me.
Regards

John W
User avatar
john w
 
Posts: 823
Joined: 24 October 2012, 16:29
Location: Apple Valley, Minnesota USA


Return to Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests

cron