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:
- In Management site, expand the Category node and locate the PDF Converter. Click Security and then click Inherit Permissions to allow the edit rights.
- In K2 Designer, click All in the filter of the category tree and then select System Objects.
- Expand the System folder and go to the PDF Converter SmartObject. Right click the SmartObject and select Generate Views.
- Select to generate an Item view and a form as shown below.
- 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.
- Copy the URL in your web browser as shown below.
- 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.
- Populate the following fields using the values below and then click Finish to save the view.
Field Value Description Smart Object Name PDFFile The 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 Method Create The method to execute that saves the PDF output in the storage SmartObject Smart Object File Property Name PDF The property in the storage SmartObject where the PDF is stored. The property must be of type File ID Property Name ID The 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 Name MyPDFFile This 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 Size A4 The size of the page to create. See Save as PDF control topic for Page sizes. Page Orientation Portrait The orientation of the page. See Save as PDF control topic for Page Orientation options. - Now generate a view for the output. Right click the PDFFile SmartObject and select Generate Views.
- Select to create an Item view and click OK.
- 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.
- 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.
- 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.
- 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.
- Click OK to save the rule and Finish to save the form.
- Click the Testing URL link to open the URL for testing purposes.
- The form opens in your browser. You can now use this form to debug any PDF creation.
- 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.
- 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.
- 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.
- 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.
- Search for the CorrelationId to view the error in the log file as shown below.
- 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.
- 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.