Issue Description

In a K2 environment configured with multi authentication and a secondary runtime site, that is set to anonymous authentication, when a form with a view that calls images from a SmartObject in an attachment control is saved to PDF using the PDF control, the images are not rendered in the PDF.

Cause

This is caused when the SmartObject call is made to render the images from the secondary runtime site, and the user cannot be authenticated. The multi-authentication setup is unable to use the anonymous user and the call cannot be completed and images are not rendered when the PDF is generated.

Resolution

  1. Ensure you have K2 4.7 installed.
  2. Install the K2 4.7 February 2017 Cumulative Update.
  3. Get the K2 4.7 February 2017 Cumulative Update FP7 from Regional Support.
  4. Install the K2 4.7 February 2017 Cumulative Update FP7 to apply the fix.
  5. Create a Secondary Runtime site with anonymous authentication.
  6. Test to see if the site can be accessed.
    For security reasons it is recommended that you block access to this site for all users in the IIS, except for the Application Pool user.
  7. Navigate to the main Runtime Site’s web.config file located in [INSTALLDIRECTORY]\k2 smartforms runtime.
  8. Under the heading <!-- Runtime Links --> add the following entry:
    <add key="Forms.Controls.SaveAsPDF.BaseURL" value="https://k2.denallix.com/RuntimeB/"/>

    The URL needs to be the URL of the secondary runtime site.

Considerations

You can use the steps below as an alternative to creating a secondary runtime site:

      1. Find the Web.config file in [INSTALLDIR]\K2 smartforms Runtime.
      2. Edit the Web.config file.
      3. Find the "Forms.Controls.SaveAsPDF.BaseURL" key. If it does not exist, add it under <appSettings> as per step 5 below.
      4. Uncomment the key entry by removing "<!--" and "-->" from the beginning and end of that line.
      5. Update the value to "https://[YourWebSite]/Runtime/".  The key entry will then be:
        <add key="Forms.Controls.SaveAsPDF.BaseURL" value="https://[YourWebSite]/Runtime/"/>

        The [YourWebSite] value will be the name of your actual runtime site.


      6. Find the last </location> and add the following underneath:
        <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>
        K2Service should be the K2 Service user. For example: Domain\K2ServiceUser
      7. Save the changes and restart IIS.