1. Home
  2. General
  3. Improved PDF Render

Improved PDF Render

While m-Power has always supported PDF as an output choice, we are excited to support a secondary PDF render. A few highlights of the new PDF render include:

  • -JavaScript support
  • -Forgiving to HTML errors
  • -Wide support for a variety of output page sizes

Installation Instructions for Windows

  1. Ensure you are running the August 2015 release of m-Power (or later).
  2. Visit this resource to download 3rd party binaries. Please choose the download that suits the server that is running m-Power. Ex: For users running on a Windows 64 bit server, please select the 64-bit installer option.
  3. Extract the contents into your /m-power folder within a folder titled “wkhtmltopdf”.
    For most m-Power Windows installations, the installation path would look like this:
    Please be sure to install these files within the QA and Production folders as well.
    Editors Note: Please verify that post installation that a folder title wkhtmltopdf now exists within the /m-power folder.
  4. Within the m-Power interface, navigate to Admin -> Dictionary Configuration ->Interface and Build Settings. In the proceeding pop-up dialog that appears, click the “Application Options” tab. For the PDF Renderer Version property, select the “Javascript Enabled” option from the dropdown, as shown in the following image.

Congratulations — all future reports will support using the improved PDF Render.

If this property in the previous step was not available, please click the “Text” button and look for the following code:

</Application_Options>

Directly before this, please add the following code:

<pdf_renderer_version pdesc="PDF renderer version" value="2">
   <option value="1">Legacy</option>
   <option value="2">Javascript Enabled</option>
   <comment>Please see documentation for additional information. https://m-power.us/pdf-size</comment>
 </pdf_renderer_version>

Press Save. Close the text editor.

Customizing and Building PDFs

All newly built reports will now support the JavaScript Enabled render.

Since this PDF render supports JavaScript, a delay is automatically built in to your PDF creation. This allows the application proper time to execute the necessary script before generating the page. If your JavaScript needs additional time to generate, please modify the “javascript_delay” value found in “Edit Properties” -> “Print Optimized”.

To customize page size, please visit your report’s Application Properties file and navigate to the “Print Optimized” tab. In the event you wish to revert your PDF to the Legacy PDF render, please blank out the value in the pdf_page_size.
Please see the below table to learn more about available PDF page sizes supported by the render:

PDF PAGE SIZE Description
A0 841 x 1189 mm
A1 594 x 841 mm
A2 420 x 594 mm
A3 297 x 420 mm
A4 210 x 297 mm, 8.26 x 11.69 inches
A5 148 x 210 mm
A6 105 x 148 mm
A7 74 x 105 mm
A8 52 x 74 mm
A9 37 x 52 mm
B0 1000 x 1414 mm
B1 707 x 1000 mm
B2 500 x 707 mm
B3 353 x 500 mm
B4 250 x 353 mm
B5 176 x 250 mm, 6.93 x 9.84 inches
B6 125 x 176 mm
B7 88 x 125 mm
B8 62 x 88 mm
B9 33 x 62 mm
B10 31 x 44 mm
C5E 163 x 229 mm
Comm10E 105 x 241 mm, U.S. Common 10 Envelope
DLE 110 x 220 mm
Executive

7.5 x 10 inches, 190.5 x 254 mm
Folio 210 x 330 mm
Ledger 431.8 x 279.4 mm
Legal 8.5 x 14 inches, 215.9 x 355.6 mm
Letter 8.5 x 11 inches, 215.9 x 279.4 mm
Tabloid 279.4 x 431.8 mm
Custom Unknown, or a user defined size.

Installation Instructions for Linux (Fedora)

  1. Please download the correct binary from this page.
  2. Transfer the file to your Fedora based system.
  3. Install the file via rpm -i filename.rpm
  4. Create a directory within m-power named “wkhtmltopdf”. Within this new folder, create a folder named “bin”.
  5. Go to /usr/local/bin. Run the following command: cp wkhtmltopdf /mrc/development/m-power/wkhtmltopdf/bin/wkhtmltopdf.exe
  6. Continue on with Step 4 from the “Installation Instructions for Windows” section above.”

Troubleshooting

  • If your application continues to use the legacy PDF renderer, verify that your application has the “pdf_page_size” property within the “Print Optimized” tab within Application Properties.
  • Ensure that the value listed within “pdf_page_size” is a valid value (Please see the above table for valid options).
  • If your PDF downloads as zero bytes, ensure you have installed the proper version of the wkhtmltopdf and that it is installed in the correct location.
  • Due to encoding issues with the pdf engine, users who wish to print a comma within the footer should escape the value with a backslash. So, for instance, if I wanted my footer to read: michaels, ross, and cole. I would edit my Report’s application properties value of “PDF Footer” as such: michaels\, ross\, and cole
Updated on May 19, 2023

Was this article helpful?

Related Articles