PDF Converter Logging

You can enable logging to help you debug the PDF Converter. Error logging is enabled by default. Use the settings in the tables below to help you identify the issue. See Debugging the PDF Converter for an example of debugging an issue.

When debugging a PDF conversion, you can find the log files in the [Program Files]\K2\K2 PDF Converter Service\Logs folder. Start by using the log files in this folder to see if you can identify the issue. You can also use the settings in the .json file as described below if you need further assistance debugging the issue. Use the Serilog setting to see more detail, and if you still can't identify the issue, you can enable the CefLogFile setting.

App settings .json file

Location: [Program Files]\K2\K2 PDF Converter Service\appsettings.json

  • If you want to add debugging settings for the period of testing, we suggest you add the changes to the appsettings.json file because the.json is file overwritten with new releases of the PDF Converter
  • If you want your changes to persist, you must add or change the settings in the appsettings.xml file
Node Description Default Value
BrowserInitilizationTimeout Timeout for the internal browser to open 60000 (milliseconds)
BrowserLoadTimeout Timeout for the site URL to load 60000 (milliseconds)
BrowserPrintPdfTimeout Timeout for the conversion from the rendered model to a PDF 60000 (milliseconds)
SmartFormsReadyCheck *
Delay The polling interval 100 (milliseconds)
Timeout The timeout for the check 60000 (milliseconds)
ErrorOnTimeout Causes the PDF conversion to fail if the timeout is exceeded False
Serilog
MinimumLevel>Default You can adjust this to a higher level for debugging purposes (Default,Verbose,Info,Warning) Error
CefLogFile
Enabled Enables internal logging for the browser. You can use this if you can't resolve the issue using the Serilog logs False

*Check for SmartForms pages to see if all synchronous actions of the initializing event are complete. This check is applied after waiting for the conversion delay and is enabled by default.

  • The BrowserInitilizationTimeout + BrowserLoadTimeout + BrowserPrintPdfTimeout should be less than or equal to the HttpClientTimeout (found in the K2 Host Server config file). Keeping in mind that the PDF conversion will cancel as soon as one of these values are exceeded.
  • The PDF Conversion will fail if the ConversionDelay (property in URL method) is not less than the HttpClientTimeout. Ensure the ConversionDelay is less than the HttpClientTimeout (K2 Host Server config file).
  • The ConversionDelay waits after the BrowserLoadTimeout, and is applied before the SmartFormsReadyCheck and BrowserPrintPdfTimeout.

The diagram below illustrates the different stages of the PDF conversion. You can think of this process in a similar way as opening a Google Chrome web browser, typing a URL, waiting for the site to load, and then use the built-in print to PDF functionality.

K2 Host Server config file

Location: [Program Files]\K2\Host Server\Bin\K2HostServer.exe.config

Add the nodes below to the appsettings section of the config file. Do an IISRESET after you make changes to this file
Node Description Default Value
<add key="SourceCode.SmartObjects.Services.PdfConverter.HttpClientTimeout" value="180000"/> Timeout for the entire PDF conversion process 180000
<add key="SourceCode.SmartObjects.Services.PdfConverter.ErrorLoggingEnabled" value="true"/> Logs errors that occur between the SmartObject service layer and the PDFConverter service, for example HttpClientTimeout exceeded or input validation failed on the SmartObject properties False

Legacy settings

K2 Host Server config file

Node Description
SourceCode.SmartObjects.Services.PdfConverter.WarmupConversionDelay No longer functions
Sourcecode.SmartObjects.Services.PDFConverter.NavigationTimeout No longer functions

SmartObject service

Node Description
warmUpPDFCall Not recommended for use with the new PDF Converter engine
SerializeResources No longer applicable with the new PDF Converter engine
useWebkit No longer applicable with the new PDF Converter engine
removeMobileStyling Setting is removed, this is applied by default