NewPage(PdfPageSizes) Method
In This Topic
Adds a new page according to the required predefined page size into the currently loaded PDF document. The new empty page is added at the end of the document
as the last page and it is automatically selected as the current page.
Syntax
Parameters
- PageSize
- A member of the PdfPageSizes enumeration. The predefined page size.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
Example
How to add a new page with the standard size of A4 to the newly created document.
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.NewPDF() = GdPictureStatus.OK Then
Dim status As GdPictureStatus = gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4)
If status = GdPictureStatus.OK Then
status = gdpicturePDF.SaveToFile("test_NewPage.pdf")
If status = GdPictureStatus.OK Then
MessageBox.Show("The file has been saved successfully.", "Example: NewPage")
Else
MessageBox.Show("The file can't be saved.", "Example: NewPage")
End If
Else
MessageBox.Show("The NewPage() method has failed with the status: " + status.ToString(), "Example: NewPage")
End If
Else
MessageBox.Show("The file can't be created.", "Example: NewPage")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.NewPDF() == GdPictureStatus.OK)
{
GdPictureStatus status = gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4);
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.SaveToFile("test_NewPage.pdf");
if (status == GdPictureStatus.OK)
MessageBox.Show("The file has been saved successfully.", "Example: NewPage");
else
MessageBox.Show("The file can't be saved.", "Example: NewPage");
}
else
MessageBox.Show("The NewPage() method has failed with the status: " + status.ToString(), "Example: NewPage");
}
else
MessageBox.Show("The file can't be created.", "Example: NewPage");
gdpicturePDF.Dispose();
Example
How to add a new page with the standard size of A4 to the newly created document.
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.NewPDF() = GdPictureStatus.OK Then
Dim status As GdPictureStatus = gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4)
If status = GdPictureStatus.OK Then
status = gdpicturePDF.SaveToFile("test_NewPage.pdf")
If status = GdPictureStatus.OK Then
MessageBox.Show("The file has been saved successfully.", "Example: NewPage")
Else
MessageBox.Show("The file can't be saved.", "Example: NewPage")
End If
Else
MessageBox.Show("The NewPage() method has failed with the status: " + status.ToString(), "Example: NewPage")
End If
Else
MessageBox.Show("The file can't be created.", "Example: NewPage")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.NewPDF() == GdPictureStatus.OK)
{
GdPictureStatus status = gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4);
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.SaveToFile("test_NewPage.pdf");
if (status == GdPictureStatus.OK)
MessageBox.Show("The file has been saved successfully.", "Example: NewPage");
else
MessageBox.Show("The file can't be saved.", "Example: NewPage");
}
else
MessageBox.Show("The NewPage() method has failed with the status: " + status.ToString(), "Example: NewPage");
}
else
MessageBox.Show("The file can't be created.", "Example: NewPage");
gdpicturePDF.Dispose();
See Also