Using the SharinPix to PDF Visualforce Component (Developer-Oriented)

The SharinPix to PDF Visualforce Component is used to generate a PDF rendering all images uploaded to a SharinPix album or pre-selected images from the album.

In this article, you will learn how to make use of the SharinPix to PDF Visualforce Component in your implementation.

circle-exclamation

Getting Started

To use the SharinPix to PDF Visualforce Component, you will first need to implement a Visualforce page embedding the SharinPix to PDF Visualforce Component as well as the SharinPix Visualforce Component. The SharinPix Visualforce Component is used to display a SharinPix album.

Visualforce Page Implementation

The following code snippet demonstrates the Visualforce page:

Component's Parameters

The SharinPix to PDF Visualforce Component's parameters are as follows:

  • recordId: Used to specify the record ID.

  • generatePdfLabelInput: Used to set the button's label.

  • imageUrlFieldApiName: To specify the image URL field to be used to set the image size in the generated PDF. This parameter takes as value an image URL field API name available on corresponding SharinPix Image records. Some pre-defined SharinPix Image's Image URLs available in the package are:

    • sharinpix__ImageURLOriginal__c

    • sharinpix__ImageURLFull__c

    • sharinpix__ImageURLThumbnail__c

    • sharinpix__ImageURLMini__c

circle-check

Below are some references for optimal image transformations for you to have a visually appealing PDF:

Layout

Columns

Transformation type

Value

Portrait 4 images per page

2

Pad to size

1000x1500

Portrait 6 images per page

2

Pad to size

1000x1000

Portrait 8 images per page

2

Pad to size

1000x650

Portrait 10 images per page

2

Pad to size

1000x580

Landscape 3 images per page

1

Pad to size

1000x1500

  • imageCaptionText: To specify the PDF image's caption. This parameter takes as value a corresponding field API name from the corresponding SharinPix Image records. Some pre-defined values available from the SharinPix package are:

    • Name

    • sharinpix__ImageID__c

    • sharinpix__AlbumID__c

    • sharinpix__FileName__c

    • sharinpix__Tags__c

  • columns: To specify the number of image columns in the PDF generated. This parameter only takes values ranging from 1 to 10.

  • firstPageFieldApiName: To specify the field API name to be used as first page content. This parameter only accepts Rich Text fields.

  • lastPageFieldApiName: To specify the field API name to be used as last page content. This parameter only accepts Rich Text fields.

  • preDescriptionFieldApiName: To specify the Rich Text field API name to be used as the images' pre-description.

  • postDescriptionFieldApiName: To specify the Rich Text field API name to be used as the images' post-description.

  • orientation: To specify the image orientation in the PDF. This parameter only takes two values, portrait or landscape.

  • singleImagePerPage: To enable/disable option to display only one image per page in the PDF. This parameter is of Boolean type and therefore accepts only true or false as value.

  • captionTextBelowImage: To enable/disable the option to display one or more images in a single column with a caption text to be placed below each image, instead of to the right. Note: The captionTextBelowImage only works when:

    • The number of columns is set to 1

    • The option singleImagePerPage is unchecked

    • The orientation is set to portrait

    Here's an example of the PDF generated when the option captionTextBelowImage is set to true:

  • footer: To specify the PDF's page numbering. This parameter accepts the following format:

Page {pagenumber} of {pagecount} where {pagenumber} refers to the current page number and {pagecount} refers to the total number of pages.

Parameters' Data Type

Parameter Name
Data Type

recordId

Id

generatePdfLabelInput

String

imageUrlFieldApiName

String

imageCaptionText

String

columns

String

firstPageFieldApiName

String

lastPageFieldApiName

String

preDescriptionFieldApiName

String

postDescriptionFieldApiName

String

orientation

String

singleImagePerPage

Boolean

captionTextBelowImage

Boolean

footer

String

Demo

Once your Visualforce page is ready, go ahead and add the same on your page layout.

To generate a PDF, select some images from the SharinPix album and click on the button Generate PDF as shown below:

circle-check

Below is an instance of the PDF generated:

triangle-exclamation

Last updated

Was this helpful?