Document-definition-object

<< Click to Display Table of Contents >>

Navigation:  EasyPDFMaker documentation > Getting started > Step by Step > Working with PDF file >

Document-definition-object

Previous pageReturn to chapter overviewNext page

EasyPDFMaker (like pdfmake) follows a declarative approach. It basically means, you'll never have to calculate positions manually or use commands like:

writeText(text, x, y), moveDown etc..., as you would with a lot of other libraries.

 

The most fundamental concept to be mastered is the document-definition-object which can be as simple as:

 

dd TDocDefinition

 dd.BeginContent()

         dd.AddText('This is an sample PDF printed with pdfMake')

 dd.EndContent()

 

[=== compare with pdfMake:

var docDefinition = { content: 'This is an sample PDF printed with pdfMake' };

===]

 

or become pretty complex (having multi-level tables, images, lists, paragraphs, margins, styles etc...).

 

As soon as you have the document-definition-object, you're ready to create the PDF:

 

pdfMaker.InvokeScript('fnGetPDF', dd.ToJSON())