Debugging the PDF Converter

You can debug a PDF conversion to see the severity of the issue and use the logs to create a support ticket if required. See also PDF Converter Logging for information about logging options. Below shows an example of how to debug a conversion issue.

In this scenario, we create a form that you can use to test various PDF conversion scenarios. Follow the steps below to create the form and debug a PDF conversion issue:

  1. In Management site, expand the Category node and locate the PDF Converter. Click Security and then click Inherit Permissions to allow the edit rights.
  2. In K2 Designer, click All in the filter of the category tree and then select System Objects.
  3. Expand the System folder and go to the PDF Converter SmartObject. Right click the SmartObject and select Generate Views.
  4. Select to generate an Item view and a form as shown below.
  5. Next, we want to get the base URL of the form we want to create a PDF for. We are using the Leave Request Form. Click the form in the category tree and then click the Runtime URL link to open the form at runtime.
  6. Copy the URL in your web browser as shown below.
  7. Edit the Item view. Go to the Layout page, select the URL Base field, then paste the URL as shown below into the Text property. This is the base URL of the form. If this is different in your environment, make sure to use the correct base URL for the form.
  8. Populate the following fields using the values below and then click Finish to save the view.
    FieldValueDescription
    Smart Object NamePDFFileThe name of the storage SmartObject. This SmartObject is used to store the PDF that is created. We use the out of the box PDF SmartObject, called PDFFile. You can create your own SmartObject and save it in a separate folder in the category tree
    Smart Object MethodCreateThe method to execute that saves the PDF output in the storage SmartObject
    Smart Object File Property NamePDF The property in the storage SmartObject where the PDF is stored. The property must be of type File
    ID Property NameIDThe property name that is queried to populate ID Property Value once a PDF is saved to the storage SmartObject. You can use this property to lookup the PDF that is saved in the storage SmartObject.
    File NameMyPDFFileThis is the name that is used for the file saved in the storage SmartObject. This name shows when you try to reload or download the PDF.
    Page SizeA4The size of the page to create. See Save as PDF control topic for Page sizes.
    Page OrientationPortraitThe orientation of the page. See Save as PDF control topic for Page Orientation options.
  9. Now generate a view for the output. Right click the PDFFile SmartObject and select Generate Views.
  10. Select to create an Item view and click OK.
  11. Edit the PDF Converter form and go to the Layout page. Click the Views tab at the top and then drag the PDF File Item view onto the canvas as shown below.
  12. Go to the Rules page, select the On PDF Converter Item, when Create PDF From URL Button is Clicked rule and then click Edit Rule.
  13. Type execute in the search dialog, click the Execute a View method action and then select PDF File Item, Load, and click configure as shown below. This loads the PDFs created when the Create PDF From URL button is clicked.
  14. Expand the Context Browser and drag the ID Property Value of the PDF Converter Item view into the ID input property as shown below. This is the mapping for the result of the PDF created. Click Finish to save the configuration.
  15. Click OK to save the rule and Finish to save the form.
  16. Click the Testing URL link to open the URL for testing purposes.
  17. The form opens in your browser. You can now use this form to debug any PDF creation.
  18. To test a form, click the Runtime URL link of the form as described earlier to open the URL in a web browser. We are using the Leave Request Form. Copy the URL of your form as shown below.
  19. Go to the form you created for testing and paste the URL in the URL String field. Click the Create PDF From URL button. A PDF is created of the form found in the URL string and populated in the view at the bottom of your form using the file name provided earlier. You can also use the HTML String and HTML or URL String fields with the Create PDF From Html or URL and Create PDF From Html buttons to test other scenarios.
  20. If you receive an error while creating the PDF, you can use the CorrelationId in the error message to search the log files for more information about the error.
  21. Log files can be found in the following location: [Program Files]\K2\K2 PDF Converter Service\Logs. Look for the most recent log file. Note that the Logs folder is only created once an error occurs.
  22. Search for the CorrelationId to view the error in the log file as shown below.
  23. If it is a SmartObject error, you can also use the CorrelationId to search for the error in the following location: [Program Files]\K2\Service Broker\ for an error file as shown below.
  24. If you still can't resolve the issue with the information from the log files, create a support ticket and attach the log files to the ticket.