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

Question

Question

Framing a PDF inside a Form

asked on December 21, 2016

Greetings.

I am being required to instert a PDF document preview window for attatched PDFs into a Form, meaning that in a previous step of the BP a user attatched a PDF and now a person reviewing the data has to be able to see it inside the form without downloading it.

Is there any way to achieve this? There are several PDFs per form that need to be shown as well.

Thank you!

0 0

Replies

replied on April 6, 2017

the code is not that complicated once you figure out What forms is doing. I have modified code previously provided by other users to actually display the form. I have created a Preview button that will display the attached documents but you can have it automatically load those. I would not have been able to do this without the prior individuals that added the ability to display pictures in a form.

$("#q11").click(function () {
    var imlp = ['pdf','PDF']
    $('.files tbody tr').each(function() {
      if ($(this).find('a').length && $.inArray($(this).find('a').attr('title').match(/\.(\w{3,4})$/)[1],imlp)>-1) {

        var ims = $(this).find('a').attr('href'),
            imrp = $('<object id="pdf" type="application/pdf" style="height: 600px;width: 600px;" />');
        imrp.attr('data',ims);
        
        $('<tr><td colspan=3>'+imrp.prop('outerHTML')+'</td></tr>').insertAfter($(this).find('a').closest('tr'));

      }
      

    });
  $("#q11").addClass('hidden');

});

Q11 is just a preview button but you can change the event to $(document).ready(function () { and the PDFs will display for every user after initial submission.

1 0
replied on October 30, 2017

I couldn't get this to work. The <object> element gets added but the PDF is not displayed in it.

Tried in Chrome 62 and Edge.

0 0
replied on December 21, 2016

This isn't possible without some rather significant customization. You can look at PDF.js if you're interested in going that route.

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

Sign in to reply to this post.