Search results

PdfPage

Provides methods and properties to create pages and its elements. PdfPage class inherited from the PdfPageBase class.

// create a new PDF document
let document : PdfDocument = new PdfDocument();
//
// add a new page to the document
let page1 : PdfPage = document.pages.add();
//
// set the font
let font : PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
// create black brush
let blackBrush : PdfSolidBrush = new PdfSolidBrush(new PdfColor(0, 0, 0));
// draw the text
page1.graphics.drawString('Hello World', font, blackBrush, new PointF(0, 0));
// save the document
document.save('output.pdf');
// destroy the document
document.destroy();

Properties

graphics PdfGraphics

Get the current graphics.

// create a new PDF document
let document : PdfDocument = new PdfDocument();
// add a new page to the document
let page1 : PdfPage = document.pages.add();
//
// get graphics
let graphics : PdfGraphics = page1.graphics;
//
// set the font
let font : PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
// create black brush
let blackBrush : PdfSolidBrush = new PdfSolidBrush(new PdfColor(0, 0, 0));
// draw the text
graphics.drawString('Hello World', font, blackBrush, new PointF(0, 0));
// save the document
document.save('output.pdf');
// destroy the document
document.destroy();

size SizeF

Gets the size of the PDF page- Read only.

Methods

getClientSize

Get the page size reduced by page margins and page template dimensions.

// create a new PDF document
let document : PdfDocument = new PdfDocument();
// add a pages to the document
let page1 : PdfPage = document.pages.add();
// create new standard font
let font : PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
// set brush
let blackBrush : PdfSolidBrush = new PdfSolidBrush(new PdfColor(0, 0, 0));
//
// set the specified point using `getClientSize` method
let point : PointF = new PointF(page1.getClientSize().width - 200, page1.getClientSize().height - 200);
// draw the text
page1.graphics.drawString('Hello World', font, blackBrush, point);
//
// save the document
document.save('output.pdf');
// destroy the document
document.destroy();

Returns SizeF