SystemLink Analysis Automation Procedure Scales PDF Report Incorrectly

Updated May 7, 2024

Reported In

Software

  • SystemLink Server
  • SystemLink TDM Analysis Add-On

Issue Details

  • I am using an Analysis Automation Procedure (.ANP file) to generate PDF reports. However, the PDF report is scaled differently from what the report looks like in DIAdem.
  • In DIAdem, my ANP exports a report in PDF format and looks correct. When I run the same ANP from SystemLink, the report is zoomed, scaled, or cut off in ways that don't match the DIAdem PDF.
  • My ANP is generating PDF reports that look different depending on if it's executed from DIAdem or the SystemLink Analysis Server. In DIAdem, the report looks like image 1 below. In SystemLink, the report looks like image 2 below.

Image 1: PDF Exported Directly in DIAdem
image (1).png

Image 2: PDF Exported From ANP in SystemLink
image (2).png

Solution

The SystemLink Analysis Server uses a different PDF driver than DIAdem. Therefore, the PDF report may appear differently after executing the Analysis Automation Procedure (.ANP file) in SystemLink.

This issue can be resolved in two ways:
  • Modify the ANP to use a report template, and alter the report template to use a manual border (instead of an automatic border).
  • Modify the ANP to export the report sheets as an image, and use an external Python library to convert the images to a PDF.
Refer to the relevant sections below for details.
 

Using a Report Template with Manual Border

  1. Inside the ANP, modify the Python script to load a template report.
    • In the code snippet below, the LoadLayout function is called, where TemplatePath is a variable that stores the path of the .TDR file.
TemplatePath = "C:\\Users\\PVE\\Desktop\\example_template.TDR"
dd.Report.LoadLayout(TemplatePath)
  1. Modify the report template (.TDR file) to include a manual border.
    1. In DIAdem, select the REPORT panel.
    2. Open the TDR file that is being loaded within the ANP.
    3. From the top menu bar, select Settings >> Layout Setup >> Layout Parameters...
    4. In the Worksheet tab, uncheck the Display Frame option.
    5. On the report, manually delete the border that appears around the sheet.
    6. Add a rectangle object to the report sheet. Resize it so that it emulates a border.
    7. Move any other objects on the sheet to fit within the "manual" border.
    8. Save the TDR file.
 

Exporting to Images and Converting to a PDF

  1. Use a Python script inside the ANP so that an external Python module can be imported to fix the scaling issues.
  2. Inside the Python script, export each DIAdem report sheet as an image.
  3. Using the [External] fpdf module, create a PDF document that places each exported image on its own page (ensuring that the image is the full width and height of the page).

Full instructions for implementing these steps can be found in Create PDF Report From Images in DIAdem Python Script.

Additional Information

DIAdem contains global variables that allow you to configure the scaling of the exported PDF (such as the PrintName, PrintLeftMarg, PrintTopMarg and PrintWidth variables). However, these variables are intended for real printing rather than creating PDFs.

If these variables are set in the ANP and tested directly in DIAdem, the PDF report will be scaled accordingly. However, these variables do not work with the SystemLink Analysis Server, so the configuration will not persist.