Skip to main content

Interface: ApiPdfConfig

The ApiPdfConfig interface provides configuration options for PDF generation in your service. These options allow you to customize various aspects of the PDF generation process. Here's a breakdown of its properties:

Properties

afterOptionsContent?

optional afterOptionsContent: string

Content to be placed after options in PDF


beforeImageContent?

optional beforeImageContent: string

Content to be placed before image in PDF


displayLogoAt?

optional displayLogoAt: "FIRST_PAGE" | "ALL_PAGES"

Display logo on first page or all pages


getFileName()?

optional getFileName: (productName, sku) => Promisable<string>

Parameters

productName: string

Name of current product in current language

sku: string

SKU of current product. Empty for modular products

Returns

Promisable<string>

String with name of PDF file


getFooter()?

optional getFooter: () => Promisable<string>

Returns

Promisable<string>

String containing HTML and css for PDF footer


getHeader()?

optional getHeader: (tabData, index, pageSettings) => string

Parameters

tabData: PdfDocumentTab

index: number

pageSettings: PageSettings

Returns

string

String containing HTML and css for PDF header


getPdfContent()?

optional getPdfContent: (tabs, pageSettings) => Promisable<string>

Parameters

tabs: PdfDocumentTab[]

List of tabs to generate pages for with required data fetched

pageSettings: PageSettings

Page settings to generate page with

Returns

Promisable<string>

String with HTML and CSS for PDF content


headElements?

optional headElements: PDFHeadElement[]

Custom header elements definition


optional logo: string

Custom URL to the logo for the PDF


logoPosition?

optional logoPosition: "LEFT" | "RIGHT" | "MIDDLE"

Logo position in PDF header LEFT - Logo at left side and text at right side MIDDLE - Logo in the middle and text at left side Right - logo at right side at text at left side


pageRenderers?

optional pageRenderers: Partial<object>

Custom methods to generate content of specific tab. Key is lowercased tab type value. It's possible to define custom page types

Type declaration

configuration

configuration: PdfPageRenderer

finishes

finishes: PdfPageRenderer

gallery: PdfPageRenderer

popular_static: PdfPageRenderer

text

text: PdfPageRenderer


pageSettings?

optional pageSettings: PageSettings

Settings for the PDF page, including dimensions, format, margins, etc.


prepareTabData()?

optional prepareTabData: (tab) => PdfDocumentTab

Method to prepare tab data

Parameters

tab: PdfDocumentTab

Returns

PdfDocumentTab