Skip to content
This repository was archived by the owner on May 30, 2022. It is now read-only.

PDF Generation

David San Filippo edited this page Sep 11, 2017 · 1 revision
Category Notes
Module Location Feature.PDF
Recommended If Needed
Default Off
Dependencies None
Pipelines Targeted initialize
Events Targeted None
Site Settings None
Page Settings None
Patch Config Feature.PDF\PDF.config

This is a useful generic pdf generation tool that is implemented as an ASP.Net Controller. It is bound to "/pdf/{ID} where ID is the GUID of the item you wish to render into PDF. The controller will make a webrequest to the web url of the page associated with the guid.

This supports a number of useful optional parameters including:

  • name - file name of the PDF to serve.
  • landscape - presence of this parameter indicates the pdf should be rendered as landscape
  • Size - Rotiva Enum value for page Size. A0 - A9, B0 - B10, Letter, Legal, Tabloid, Ledger, Folio, Executive, C5E, Com10E, Dle
  • width - width of the page
  • height - height of the page
  • nomargin - presence of this sets the margins to 0
  • passauth - ensures the webrequest passes the cookies from the requestor to make the request as the user
  • dss - presence of this sets the wkhtmltopdf options to disable smart shrinking
  • sl - presence of this sets the option to save the pdf locally. Currently this path is fixed to : C:\inetpub\wwwroot\rms\Website\App_Data\tempPDFs and should only be used for troubleshooting

This leverages the open source library Rotativa which uses wkhtmltopdf tool. PDF generation can be fairly resource intensive, so ensure you have enough capacity to support this on your server if you expect a heavy load of pdf requests. You may need to consider to offloading PDF generation to another farm or leveraging a cloud based tool like DocRaptor instead.

Clone this wiki locally