The PDF Converter SmartObject Service may not render styles and images correctly. These issues are generally caused by:

  • Incorrect configuration of Internet Explorer on the K2 server (manual or group policy)
  • Incorrect SSL setup

K2 smartforms 1.0.7 introduced the serializeResources and useWebkit service instance settings to resolve rendering issues. Note that these settings are turned off by default for backwards compatibility. The service was also updated with improved error handling and logging.

SmartObject Service Instance Configuration Settings

When using the Save as PDF control with SmartForms, you may need to set one of the following service instance settings to true on the Converter SmartObject Service to address rendering issues:

useWebkit

A rendering mode that uses WebKit to render the web page that is then converted to PDF. This setting is on (set to true) by default and allows you to search contents of the PDF file, which is sometimes necessary when the PDF document is to be signed.

Image

Image

serializeResources

Off by default, when you set this to true, the CSS and images necessary to render the PDF are retrieved and cached to disk. The HTML CSS and image references are adjusted to reference the cached files on the local server. The new HTML is then passed to the PDF Converter Service which generates a PDF from the HTML. Any issues encountered are logged and you can use this log to determine if any actionable issues occured. The log file is located on the K2 server at:

[ProgramData]\K2\SourceCode.SmartObjects.Services.PdfConverter\Logs

Note that this setting has no effect on the URL-based SmartObject service methods (e.g. Create PDF from URL).

warmUpPDFCall

Off by default, when you set this to true, the URL is called before conversion is attempted, which can correct some rendering issues. This setting does not apply to the Save as PDF control or when calling HTML methods directly.

By default, serializeResources and warmUpPDFCall are turned off. Change the settings to true to enable different rendering. See KB001633 K2 smartforms 1.0.7 Known Issues List for known issues when using these settings.

For K2 Five and K2 blackpearl customers, if you are unable to edit the out-of-the-box service instance using K2 Workspace (Legacy) or K2 Management, use the SmartObject Service Tester tool. Or you can create a new instance of the PDF Converter service and use that for your PDF generation.

Error Logging

Error logging can be enabled in the [Program Files]\K2 blackpearl\Host Server\Bin\K2HostServer.exe.Config file on the K2 application server:

Ensure you make a backup of the K2HostServer.exe.Config file before making the change.

<add key="Sourcecode.SmartObjects.Services.PDFConverter.ErrorLoggingEnabled" value="true" />

The error log file is written to the following location:
[Program Files]\K2\ServiceBroker\SourceCode.SmartObjects.Services.PdfConverter.error