You are viewing limited content. For full access, please sign in.

Question

Question

How to include pdf into form

asked on June 11, 2018

Hi all,

 

I just want to know if we can include a PDF from Laserfiche into the form and if yes, how?

 

Example :

My actually Form

 

My PDF from Laserfiche

 

What I want

 

 

 

Thanks in advance.

Regards

0 0

Answer

SELECTED ANSWER
replied on June 12, 2018 Show version history

Hi Olivier, yes, this is more advanced as you need the Custom HTML field to be dynamic requiring Javascript to change the document displayed based on a field selection. Typically an iframe will just load once on form opening, which is why we need Javascript to trigger the field changes based on the User selection and to generate the appropriate path to the correct file.

An example of this would look like this (came from John Shupe at LF)

This updates an HTML field to display a document where the URL is available in a field in the form. Using the EntryID concatenated to a WEB Access URL to display the document. q2 would contain a calculation field that concatenates the URL together with the selection from the user selectable field, q3 is the Custom HTML field, 

$(document).ready(function() {

$("#q2").change(function(){

   $('.frame1').remove();

   var test = $("#q2 input").val();

              $('#q3').append("<iframe src='"+test+"' width=100% height=400px name='frame1' id='frame1'class='frame1'></iframe>");

});

});

 

I have this running in demo's and am very happy with the way it works. Please note that image based files (PDF, Tif, jpeg) use the same document viewer to display. If you want to have the ability to display Office files as well, you have to manipulate the URL for Electronic Files and have Office Online configured.

0 0

Replies

replied on June 11, 2018

Hi Olivier, is the PDF a static document to be part of the form or is it to a document from the lf repository. It is possible to display documents from the repository in a form but that logged in user would need to have rights to be able to see those documents in the repository either as a full or read only user as well as a forms particpant.

please reply and I'll follow up with you.

Steve

0 0
replied on June 12, 2018

Hi Steve,

Thanks for your return.

The PDF is a document from the lf repository and the user have the rights.

I just don't know how to add the PDF into the form.

Could you help me plz?

0 0
replied on June 12, 2018

Hi Olivier

There are a couple different ways to do this.

The Basic way is you need to pass the PDF files URL using Workflow to a field in the form, and then use that URL information to display the document in an iframe. You could also just pass the EntryID and create your own URL as well.

Below are a couple post from Answers that will start to lay this out for you.

Start with these

https://answers.laserfiche.com/questions/113245/How-to-add-a-web-access-URL-in-iFrame-to-a-Form#113256

https://answers.laserfiche.com/questions/111154/Web-Access-iframe-in-Forms

When you get stuck, let me know.

1 0
replied on June 12, 2018

Steve,

This is what I did with a static document PDF on Windows and this is working.

I didn't think to use Web Client to get the PDF's URL. This is a great idea!

 

<iframe src="http://localhost/laserfiche/Viewer/Pdf/PdfViewer.aspx?file=StreamingHandler.ashx%3Fr%3DVARKIT%26id%3D10459&amp;cssClass=docViewPdfViewer&amp;entryid=10459&amp;r=VARKIT" width="100%" height="420px">
This browser does not support PDFs. Please contact your Administrator.
</iframe>

 

Thank you so much!

 

Just a last question.

Actually I'm using a static ID to get my PDF ; in your help, you said to use Workflow to get the good PDF. I don't really understand how to do this with the first form.

 

0 0
replied on June 12, 2018

Olivier, if you open a document in WebAccess and copy the URL in the Google Address Bar, then you can use that URL in the iframe to display the document. If you add &view=fullscreen to the end of the URL it will open fullscreen and not have the Webaccess detail panes showing. 

In workflow if you target a file with Find Entry or Search, you can use the GenerateWebURL to create a variable that contains the webaccess path to the document. You would then pass that to a field in your form (Set Business Process Variables) to use as the src path in the custom HTML field. 

As your Form requires a static PDF in the starting form you have options to have it point back to the server as you had done, or into the repository via the iframe. The way you did it doesn't require the Forms user to have LF licensing to access the document in the Repository

0 0
replied on June 12, 2018

Steve, would you mind explaining what you meant about the static PDF 'not requiring the Forms user to have LF licensing to access the document in the Repository'?

0 0
replied on June 12, 2018

Hum... Steve,

I made a mistake ; this is not about a Static PDF but a dynamic PDF.

What I means :

If User A log-in, the form must to add PDF-A

if User B log-in, the form must to add PDF-B

This is more difficult because in the form, I have a list and if user A choose option 1 then I need to add PDF-A1 ; if user choose option 2, then I need PDF-A2

0 0
replied on June 12, 2018

Hi Michelle, what I was referring to was that the static PDF would be on the Forms Servers Hard Drive and not in the Repository. The Path that Olivier was referring to would be to the file on the local driver which would be similar to adding a logo to the form page as opposed to accessing a document in the repository. 

1 0
SELECTED ANSWER
replied on June 12, 2018 Show version history

Hi Olivier, yes, this is more advanced as you need the Custom HTML field to be dynamic requiring Javascript to change the document displayed based on a field selection. Typically an iframe will just load once on form opening, which is why we need Javascript to trigger the field changes based on the User selection and to generate the appropriate path to the correct file.

An example of this would look like this (came from John Shupe at LF)

This updates an HTML field to display a document where the URL is available in a field in the form. Using the EntryID concatenated to a WEB Access URL to display the document. q2 would contain a calculation field that concatenates the URL together with the selection from the user selectable field, q3 is the Custom HTML field, 

$(document).ready(function() {

$("#q2").change(function(){

   $('.frame1').remove();

   var test = $("#q2 input").val();

              $('#q3').append("<iframe src='"+test+"' width=100% height=400px name='frame1' id='frame1'class='frame1'></iframe>");

});

});

 

I have this running in demo's and am very happy with the way it works. Please note that image based files (PDF, Tif, jpeg) use the same document viewer to display. If you want to have the ability to display Office files as well, you have to manipulate the URL for Electronic Files and have Office Online configured.

0 0
replied on June 12, 2018

Thanks Steve,

I'm going to try and back to you asap.

Regards

0 0
replied on June 13, 2018

Totally understand that now, thanks for the explanation Steve!

0 0
replied on June 13, 2018

Steve,

 

I tried your solution and it's working but I have a slight problem.

I logged to my form, but I need to login to web client too to get my preview.

Is it possible to ignore the login and get directly the preview?

 

0 0
replied on June 13, 2018

Hi Olivier, you would have to have SSO (Single sign on) configured to avoid this. Although it's in an iframe, it follows the same rules as WebAccess.

0 0
replied on June 13, 2018

Steve, it looks like I don't have SSO.

Where can I check it?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.