3B PDF Merge

From 3B Knowledge
Jump to navigation Jump to search

Introduced in version 4.3 of 3B Docs, 3B PDF Merge is our native solution to automatically merge PDFs with data from Salesforce.

Configuration Instructions

After installing version 4.3+ of 3B Docs, you will need to grant access to the page "b3d.Generate.page" to a public site pre-set up in Salesforce. This will ensure that the PDFs will generate correctly through the 3B HTML-to-PDF API.

After granting access to the b3d.Generate.page visualforce page, please navigate to Setup -> Custom Settings -> General Settings (3B Docs) and click on "Manage". Make sure that you have populated the details for an API user under API Username, API Password and API Token as well as set the URL to the configured public site in the field "PDF Gen Base URL". This URL should look something like this "https://yourcompany.my.salesforce-sites.com/PublicSite"

Usage

PDF Builder Interface

Navigate to a Template record in 3B Docs and you should be able to see the new tab "PDF Builder". If you cannot see the tab, edit the page for the Template object and add a new tab and add the Visualforce component and search for the page "b3d.Builder.page". After you have confirmed that you can access the PDF Builder, you will see the interface, which should be similar to the one in this article.

To start, upload a valid PDF and select the core object for merging from the right-hand side search component. There can only be one core object assigned to a document.

After the upload has completed, you can drag and drop a text field or a checkbox from the right-hand side directly onto the document. This will create an area which will be merged with data from Salesforce once the document is generated. Save your changes.

Preview Page

Finally, in order to provide an administrator with access to dynamically merge the document, please navigate to the page /apex/b3d__Preview?templateId={templateId}&recordId={recordId}, where templateId is the Id of the b3d__Template__c record and recordId is the Id of the record that matches the context object selected on the template.

The preview page will allow the admin/user to "Download" the PDF to their local device or to "Save" it against the context record. The new file that will be created/updated against the respective context record will be named after the name of the Template record.

Use Cases

PDF Merge is extremely useful for generating documents and getting them merged with salesforce data. These could be client forms, government/legal forms and documents and other documents that do not require a signature or interaction.

Tips

Here are some useful tips for using 3B PDF Merge

Using Value Formatters

Value formatters from 3B Docs freeform builder are available for use within PDF Merge. This means that you can add value changing code functions that will return a value to be placed in the area box created on the PDF. This is useful for date formatting (EU/US/AUS format) and text formatting (lower/upper case etc)

Using Function Expressions

Just like 3B Docs, PDF Merge supports function expressions. These are executable scripts of code that return some value. 3B PDF Merge currently only supports synchronous functions (so, trips to the server are not allowed). Functions are used to return the current date, return a file or image from Salesforce and other repeatable blocks.