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
>
Custom method to generate PDF file name
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
>
Custom method to prepare PDF page footer HTML
Returns
Promisable
<string
>
String containing HTML and css for PDF footer
getHeader()?
optional
getHeader: (tabData
,index
,pageSettings
) =>string
Custom method to prepare PDF page header html
Parameters
tabData
index
number
pageSettings
Returns
string
String containing HTML and css for PDF header
getPdfContent()?
optional
getPdfContent: (tabs
,pageSettings
) =>Promisable
<string
>
Custom method to generate PDF content for all pages
Parameters
tabs
List of tabs to generate pages for with required data fetched
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
logo?
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
<{[key: string]
:PdfPageRenderer
;configuration
:PdfPageRenderer
;finishes
:PdfPageRenderer
;gallery
:PdfPageRenderer
;popular_static
:PdfPageRenderer
;text
:PdfPageRenderer
; }>
Custom methods to generate content of specific tab. Key is lowercased tab type value. It's possible to define custom page types
pageSettings?
optional
pageSettings:PageSettings
Settings for the PDF page, including dimensions, format, margins, etc.
prepareTabData()?
optional
prepareTabData: (tab
) =>PdfDocumentTab
Method to prepare tab data