Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

Overview

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

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

Arguments

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.

Example

Sample header html

<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>

Example

Usage

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

Types

PDFOptions

Options for pdf generating.

{ // Gets or sets the footer html content to place in all pages in document. FooterHtml : string // Gets or sets space between footer and page content. Default is 0. FooterSpacing : number // Gets or sets the header html content to place in all pages in document. HeaderHtml : string // Gets or sets space between header and page content. Default is 0. HeaderSpacing : number // Gets or sets the bottom margin of page. MarginBottom : number // Gets or sets the left margin of page. Default is '10mm' MarginLeft : number // Gets or sets the right margin of page. Default is '10mm' MarginRight : number // Gets or sets the top margin of page. MarginTop : number // Gets or sets the page orientation. Orientation : ( "Landscape" | "Portrait" ) // Gets or sets the page height. PageHeight : number // Gets or sets the predefined page size. Default is 'A4'. 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 page width. PageWidth : number // Gets or sets the CSS style to include in page. Style : string }

  • No labels