AddPage
IPDFDocument4 :: General document management :: Common

See Also Example
Collapse All

This method creates a new PDF page, appending it to the end of the PDF document. It does not set the new page as current.

Syntax

HRESULT AddPage ()
Return value
If successful, this method returns S_OK. If it fails, this method should return one of the error values.

Remarks

To add a new page and make it current, use the NewPage method.

Example

Adding a Page

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
font := PDF.AddFont('Arial', false, false, false, false, fcDefault);
PDF.UseFont(font, 10);
PDF.ShowTextAt(10, 10, 'This is the 1st page.');
PDF.AddPage;
PDF.ShowTextAt(10, 20, 'This is still the 1st page.');
PDF.CurrentPage := 1;
PDF.UseFont(font, 10);
PDF.ShowTextAt(10, 10, 'This is the 2nd page.');
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
long font = PDF->AddFont("Arial", false, false, false, false, fcDefault);
PDF->UseFont(font, 10);
PDF->ShowTextAt(10, 10, "This is the 1st page.");
PDF->AddPage();
PDF->ShowTextAt(10, 20, "This is still the 1st page.");
PDF->CurrentPage = 1;
PDF->UseFont(font, 10);
PDF->ShowTextAt(10, 10, "This is the 2nd page.");
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
long font = PDF.AddFont("Arial", false, false, false, false, FontCharset.fcDefault);
PDF.UseFont(font, 10);
PDF.ShowTextAt(10, 10, "This is the 1st page.");
PDF.AddPage();
PDF.ShowTextAt(10, 20, "This is still the 1st page.");
PDF.CurrentPage = 1;
PDF.UseFont(font, 10);
PDF.ShowTextAt(10, 10, "This is the 2nd page.");
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
font = PDF.AddFont("Arial", False, False, False, False, 1) 'fcDefault
PDF.UseFont font, 10
PDF.ShowTextAt 10, 10, "This is the 1st page."
PDF.AddPage
PDF.ShowTextAt 10, 20, "This is still the 1st page."
PDF.CurrentPage = 1
PDF.UseFont font, 10
PDF.ShowTextAt 10, 10, "This is the 2nd page."
PDF.SaveToFile "test.pdf", true
Set PDF = nothing

See Also

Reference