Styling

<< Click to Display Table of Contents >>

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

Styling

Previous pageReturn to chapter overviewNext page

EasyPDFMaker (like pdfmake) makes it possible to style any paragraph or its part:

 

dd TDocDefinition

 

 dd.BeginContent()

 

  ! if you don't need styles, you can use a simple string to define a paragraph

  dd.AddText('This is a standard paragraph, using default style')

 

  ! using second parameter of .AddText method lets you set styling properties

   ! note: property names ('fontSize' in this case) always must be enclosed in double quotes: "fontSize"

  dd.AddText('This paragraph will have a bigger font', '"fontSize": 15')

 

  ! inside a paragraph, you'll be able to style any part individually

  dd.BeginParagraph()

    dd.AddText('This paragraph is defined as an array of elements to make it possible to ')

    dd.AddText('restyle part of it and make it bigger ', '"fontSize": 15')

    dd.AddText('than the rest.')

  dd.EndParagraph()

 

dd.EndContent()

 

[=== compare with pdfmake:

var docDefinition = {

content: [

   // if you don't need styles, you can use a simple string to define a paragraph

   'This is a standard paragraph, using default style',

 

   // using a { text: '...' } object lets you set styling properties

  { text: 'This paragraph will have a bigger font', fontSize: 15 },

 

   // if you set the value of text to an array instead of a string, you'll be able

  // to style any part individually

  {

    text: [

      'This paragraph is defined as an array of elements to make it possible to ',

       { text: 'restyle part of it and make it bigger ', fontSize: 15 },

      'than the rest.'

    ]

   }

 ]

};

===]