Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Method_name
ReturnsFileInfo
ArgumentshtmlContent, name, [ options ]

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

Arguments

Method_argument
TypeString
NamehtmlContent

 Content of file in HTML format.

Method_argument
TypeString
Namename

Name of file.

Method_argument
TypeObject
Nameoptions

PDF generating options. See remarks.

Option may contain one or more following properties:

Method_argument
TypeNumber
NameMarginLeft

Specifies the page margin in millimeters. (Default 20mm)

Method_argument
TypeNumber
NameMarginRight

Specifies the page margin in millimeters. (Default 20mm)

Method_argument
TypeNumber
NameMarginTop

Specifies the page margin in millimeters. (Default 20mm)

Method_argument
TypeNumber
NameMarginBottom

Specifies the page margin in millimeters. (Default 20mm)

Method_argument
TypeNumber
NamePageWidth

Specifies the page width in millimeters.

Method_argument
TypeNumber
NamePageHeight

Specifies the page height in millimeters.

Method_argument
TypeString
NameHeaderHtml

Specifies html content to be inserted top of every page.

Method_argument
TypeNumber
NameHeaderSpacing

Spacing between header and content in millimeters.

Method_argument
TypeString
NameFooterHtml

Specifies html content to be inserted bottom of every page.

Method_argument
TypeNumber
NameFooterSpacing

Spacing between footer and content in millimeters.

Method_argument
TypeString
NameStyle

CSS style to apply on content and header and footer html.

Method_argument
TypeString
NameOrientation

Orientation of page. Can set to one of "Portrait" or "Landscape" value. Default value is "Portrait"


Remarks

Header and footer html parameters specifies the single page and may contain following parameters:

ParameterDescription
[page]Current page number
[frompage]First page number
[topage]Total number of pages
[customField]Other custom property specified in options.
Code Block
languagexml
titleSample 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>

Examples

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


See Also