Image is not visible in the PDF generated using the (Save as PDF) control

  • 4 January 2019
  • 4 replies
  • 42 views

Image embedded into the form not being shown in the PDF files produced by "Save As PDF" control. An empty box is being shown in place of the image in resulting PDF file.

 11126i7E3D2946A80EEF0A.gif

 

 


16822i6367CF6BBCD99E94.gif


4 replies

Badge +15

Hi,


 


From what I can tell, this is either not supported, or this is a bug.  You can try playing around with the settings in the PDF Converter service instance and see if it helps. Aside from that, there isn't any other settings that can fix this. I will recommend you log a support ticket with K2 Support to investigate this.


 

Userlevel 6
Badge +16

Hi,


 


It appears a secondary runtime site might need it for it to work correctly. Perhaps, the following steps might help.


---------------------


K2 Five (5.1) with November 2018 CU FixPack 05.


Video link: https://www.screencast.com/t/QN6bnQjPwt9


1.  Setup a secondary Smartforms runtime site with anonymous authentication (RuntimeInternetUsers), see the following KB: https://help.k2.com/kb001861.


2.  Give the SmartForms App pool full control to the secondary runtime site.


 

After having read the replies given on your problem, it seemed to me that the cause of this is because the image in the image control is linked and then renders at runtime. So when the print to PDF happens, it can't fetch the same picture from the library (due to insufficient permissions most likely)

 

In my case, I fixed this by ensuring that I have the image within the DOM before attempting to generate the PDF (On an item view with the intention of being exported to PDF as a Report). This is how I achieved this:

 

1. Convert your image to Base64 (for example I used https://www.base64-image.de/)

2. Add a datalabel to the view instead of using a picture control

3. Set the datalabel as a literal datalabel, untick 'Prevent XSS'

4. Give the datalabel an expression of: <img src="data&colon;image/png;base64,[Base64 Representation of picture goes here, no braces]" height="120" alt="" border="0">

5. Now when you export the page to PDF, the image is included on the PDF (I assume it is because the image is actually now a part of the page DOM instead of being linked and fetched)

 

Hope this helps!

Userlevel 3
Badge +16

i'd had similar rendering issues in the past.

 

Will have a dig around and post any info i have when i get a chance

Reply