Skip to content

AddPDF

Adds a new PDF file to repository with html content and returns created file info

1
myFiles.AddPDF(html: string, name: string, options: PDFOptions):FileInfo

Parameters

string html
    Content of file in HTML format.

string name
    Name of file.

PDFOptions options
    of pdf conversion

Remarks

Header and footer html parameters specifies the single page and may contain following parameters:
Html parameter may contain following template parameters: [page] Current page number [frompage] First page number [topage] Total number of pages [customField] Other custom property specified in options.

Sample header html

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<table style="border-bottom: 1px solid black; width: 100%;">
  <tr>
    <td style="width:20%;text-align:center;">[logo]</td>
    <td style="width:50%;text-align:center;font-size:1.3em;">[documentTitle]</td>
    <td style="width:30%">
      Document Number : [documentNumber]<br />
      Page : [page]/[topage]
    </td>
  </tr>
</table>

Usage

ts` var html = '<html><body>Hello!</body></html>'; var pdfFile = $Files.AddPDF(html, 'sample.pdf'); return pdfFile.Id;

Types

PDFOptions

Options for pdf generating.

FooterHtml : string
Gets or sets the footer html content to place in all pages in document.

FooterSpacing : number
Gets or sets space between footer and page content. Default is 0.

HeaderHtml : string
Gets or sets the header html content to place in all pages in document.

HeaderSpacing : number
Gets or sets space between header and page content. Default is 0.

MarginBottom : number
Gets or sets the bottom margin of page.

MarginLeft : number
Gets or sets the left margin of page. Default is '10mm'

MarginRight : number
Gets or sets the right margin of page. Default is '10mm'

MarginTop : number
Gets or sets the top margin of page.

Orientation : ( "Landscape" | "Portrait" )
Gets or sets the page orientation.

PageHeight : number
Gets or sets the page height.

PageSize : ( "A1" | "A2" | "A3" | "A4" | "A5" | "A6" | "A7" | "A8" | "A9" | "B0" | "B1" | "B2" | "B3" | "B4" | "B5" | "B6" | "B7" | "B8" | "B9" | "B10" | "C5E" | "Comm10E" | "DLE" | "Executive" | "Folio" | "Ledger" | "Legal" | "Letter" | "Tabloid" )
Gets or sets the predefined page size. Default is 'A4'.

PageWidth : number
Gets or sets the page width.

Style : string
Gets or sets the CSS style to include in page.

See Also