Rendering images in PDFs without a secondary runtime site

  • 15 February 2022
  • 0 replies
  • 113 views

Userlevel 5
Badge +20
 

Rendering images in PDFs without a secondary runtime site

KB003233

PRODUCT
K2 Five
BASED ON
K2 Five (all)

 

Introduction

 

When developing K2 forms, there may be a requirement to save the form as a PDF with images in its attachment controls. The images stored in the attachment controls should render in the PDF that is generated from the Save as PDF control. One solution to this problem is to create a secondary runtime site as outlined here: https://help.k2.com/kb001861.

However, this approach may not be approved by your organization. This article describes the changes that need to be made so that images will render in the saved PDF without creating a secondary runtime site that has been configured with anonymous authentication. 

 

 

Steps

1. Locate and edit the web.config file from the Smartforms Runtime folder:

e.g. [Install Drive]:%Program Files%K2K2 Smartforms RuntimeWeb.config 

2. Search the file for the following text:

Forms.Controls.SaveAsPDF.BaseURL

Image

3. a) If it exists, uncomment the line by removing '<!--' and '-->' 

3. b) If it does not exist, add the following line to the <appSettings> section:

<add key="Forms.Controls.SaveAsPDF.BaseURL" value=""/>

Image

4. Edit the value for this key and change it to your runtime site URL:
 

<add key="Forms.Controls.SaveAsPDF.BaseURL" value="https://k2.denallix.com/Runtime"/>

5. Find the final </location> tag in the config file

6. Under this location tag, insert the following XML into the file:
 

<location path="Runtime/File.ashx">
    <system.web>
        <authorization>
            <allow users="*" />
        </authorization>
    </system.web>
    <system.webServer>
        <security>
            <authorization>
                <add accessType="Allow" users="K2Service" />
            </authorization>
        </security>
    </system.webServer>
</location>
7. Save the Web.config file and perform an IIS reset.

 


0 replies

Be the first to reply!

Reply