PDF tools
Jetveo offers a built-in tool for manipulating PDF documents. Accessible at App.Tools.Pdf.
Generating PDF documents
The primary purpose of this tool is generating a pdf document from an html string. The html string is typically generated from a template. The tool provides a method App.Tools.Pdf.GenerateFromHtml() That takes in 8 arguments:
string documentHtmlThe html string, the pdf document is generated from.
Optional Arguments
headerHtmlAn html string, that will define the header.footerHtmlAn html string, that will define the footer.paperSizeAn enum, that contains a few known paper sizes. (Default A4)scaleA floating-point number, that sets the scaling (Default 1.0)marginsAn enum, which lets you choose margins fromLarge,Normal,None.headerExtraMarginA floating-point margin size (Note: The value is in inches)footerExtraMargin...
The method returns a byte array, containing the pdf file content. To add the generated document as a revision,
use x.AddRevision(fileName, generatedPdfContent), where
xis the desired document to update.fileNameis a string, with the desired file name.generatedPdfContentis the byte array returned fromGenerateFromHtml()
Here is a simple usage example
public void GenerateAgreementPdf(Customer customer)
{
var html_string = App.Templates.AgreementTemplate.Render(customer);
var pdf_content = App.Tools.Pdf.GenerateFromHtml(html_string);
string file_name = $"agreement_{customer.Name}.pdf";
customer.Agreement.AddRevision(file_name, pdf_content);
}