I have a webform (using 3.x) that has a couple of file fields used to upload pdf files. The client wants to be able to display the entire contents of the pdf when viewing the submission. I've tried using webform_submission_render_alter() to display the field in an iframe, but can only set the iframe to a fixed height. I'd like to be able to load the iframe, get the rendered height of the pdf, and adjust the iframe height to fit. The problem is that even though the pdf is in the same domain as the rest of the page, I'm getting a cross-domain error when trying to access the contents of the pdf.

$("#my-iframe").height($(this).contents().find('body').height())

I'm doing this after waiting for the iframe to be loaded.

As an alternative, I was thinking of using the PDF to ImageField module to render the field as an image, but I don't think it is possible to override the display formatter for webform file fields to use it.

Any suggestions?

Comments

pglatz’s picture

Issue summary: View changes
DanChadwick’s picture

Status: Active » Fixed

As it says in the webform issue add form, we don't supply custom programming support in the issue queue. Also, webform 7.x-3.x is receiving only critical fixes at this point. I suggest you upgrade to 7.x-4.x if possible (backup and check other modules first). Good luck.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.