PDF Generation: Difference between revisions

From 3B Knowledge
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 12: Line 12:


== Usage ==
== Usage ==
PDF Generation happens only after a successful e-signature/document generation. This is an action that happens [[Asynchronous Operations|a-synchronously]] and as such, it may take a few seconds for the file to be generated.  
PDF Generation happens only after a successful e-signature/document generation. This is an action that happens a-synchronously and as such, it may take a few seconds for the file to be generated.  


If an error occurs during PDF generation, system administrator can usually [[Debug Logs|access a developer log]] for debugging.
If an error occurs during PDF generation, system administrator can usually access a developer log for debugging.


== Considerations ==
== Considerations ==
Line 25: Line 25:
* Missing Images - sometimes, images may not be added to the generated PDF, this is usually an issue with [https://owasp.org/www-community/attacks/csrf CSRF] issues where the embedded image is hosted outside of Salesforce
* Missing Images - sometimes, images may not be added to the generated PDF, this is usually an issue with [https://owasp.org/www-community/attacks/csrf CSRF] issues where the embedded image is hosted outside of Salesforce
* Missing External Content - if you add Charts, Datatables, Calendar or other UI elements using [[Custom Embedded JavaScript Functions|embedded javascript functions]], they may not render well due to limited CSS2 and HTML5 support
* Missing External Content - if you add Charts, Datatables, Calendar or other UI elements using [[Custom Embedded JavaScript Functions|embedded javascript functions]], they may not render well due to limited CSS2 and HTML5 support
* Pagination Issues - adding pages to a template usually works well unless you have also added a [[Child Repeatable Records|repeatable child container]] to the template which pulls too many records. In such scenarios, the default paging mechanism will override any custom added pages to a template
* Pagination Issues - adding pages to a template usually works well unless you have also added a [[Document Contexts|repeatable child container]] to the template which pulls too many records. In such scenarios, the default paging mechanism will override any custom added pages to a template


[[File:Generated PDF.png|thumb|A document trace record with generated Document.pdf file]]
[[File:Generated PDF.png|thumb|A document trace record with generated Document.pdf file]]


== Extending to Functionality ==
== Extending to Functionality ==
Generating PDFs depends on the Flow "3B Docs - Generate PDFs for Document Traces" which runs [[Asynchronous Operations|a-synchronously]] and calls the Apex Method "Generate PDFs for Traces" which accepts a list of [[Document Traces|Document Trace]] ids.  
Generating PDFs depends on the Flow "3B Docs - Generate PDFs for Document Traces" which runs a-synchronously and calls the Apex Method "Generate PDFs for Traces" which accepts a list of [[Document Traces|Document Trace]] ids.  


The APEX Method will then get the contents of the VFP "b3d__GeneratedDocument" which is responsible for the rendering of a generated/e-signed document.
The APEX Method will then get the contents of the VFP "b3d__GeneratedDocument" which is responsible for the rendering of a generated/e-signed document.
[[Category:3B Docs Features]]
[[Category:3B Docs Features]]
[[Category:3B Docs]]

Latest revision as of 03:04, 24 October 2022

Generating PDFs for submissions is an option available in most orgs and instances. Contact our support team if the option is not available in your installation.

Intro

Generating PDFs from document downloads/electronically signed documents is very useful, especially when we want to send out an email confirming the successful signing of a document, or simply keep a record for the audit trail.

When the option is turned on, we will create a PDF of the generated template document and save it against the Document Trace record that is created when a document is e-signed or downloaded.

How To

Traces Generate PDF option on a Template record

You can enable the option for PDFs to be generated either at the time of creating a new template by selecting the option "Traces Generate PDF", or through the template settings.

Editing the option from the template settings pop-up

Usage

PDF Generation happens only after a successful e-signature/document generation. This is an action that happens a-synchronously and as such, it may take a few seconds for the file to be generated.

If an error occurs during PDF generation, system administrator can usually access a developer log for debugging.

Considerations

Generating PDFs is notoriously difficult on the Salesforce Platform due to the constraints associated with the multi-tenant platform.


Please review the following list with considerations:

  • Styling Issues - PDFs may not always look exactly like a generated document, this is due to the way Salesforce creates PDF files using Flying Saucer java app which does not support CSS2 stylesheets and other HTML5 elements.
  • Missing Images - sometimes, images may not be added to the generated PDF, this is usually an issue with CSRF issues where the embedded image is hosted outside of Salesforce
  • Missing External Content - if you add Charts, Datatables, Calendar or other UI elements using embedded javascript functions, they may not render well due to limited CSS2 and HTML5 support
  • Pagination Issues - adding pages to a template usually works well unless you have also added a repeatable child container to the template which pulls too many records. In such scenarios, the default paging mechanism will override any custom added pages to a template
A document trace record with generated Document.pdf file

Extending to Functionality

Generating PDFs depends on the Flow "3B Docs - Generate PDFs for Document Traces" which runs a-synchronously and calls the Apex Method "Generate PDFs for Traces" which accepts a list of Document Trace ids.

The APEX Method will then get the contents of the VFP "b3d__GeneratedDocument" which is responsible for the rendering of a generated/e-signed document.