NewPage(Single,Single) Method
In This Topic
Adds a new page according to the specified page size, expressed in the current units, 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
- PageWidth
- The page width, expressed in the current units specified by the SetMeasurementUnit method.
You can simply use the GdPicturePDF.GetMeasurementUnit method to determine the currently defined units and you can easily use the GdPicturePDF.SetMeasurementUnit method to reset the units according to your preference.
- PageHeight
- The page height, expressed in the current units specified by the SetMeasurementUnit method.
You can simply use the GdPicturePDF.GetMeasurementUnit method to determine the currently defined units and you can easily use the GdPicturePDF.SetMeasurementUnit method to reset the units according to your preference.
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 (standard size of A4) specified in millimeters to the newly created document.
Dim caption As String = "Example: NewPage"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.NewPDF() = GdPictureStatus.OK Then
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
Dim status As GdPictureStatus = gdpicturePDF.NewPage(210, 297) 'A4 page size in millimeters
If status = GdPictureStatus.OK Then
If gdpicturePDF.SaveToFile("test_NewPage.pdf") = GdPictureStatus.OK Then
MessageBox.Show("The file has been saved successfully.", caption)
Else
MessageBox.Show("The file can't be saved.", caption)
End If
Else
MessageBox.Show("The NewPage() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The file can't be created.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: NewPage";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.NewPDF() == GdPictureStatus.OK)
{
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter);
GdPictureStatus status = gdpicturePDF.NewPage(210, 297); //A4 page size in millimeters
if (status == GdPictureStatus.OK)
{
if (gdpicturePDF.SaveToFile("test_NewPage.pdf") == GdPictureStatus.OK)
MessageBox.Show("The file has been saved successfully.", caption);
else
MessageBox.Show("The file can't be saved.", caption);
}
else
MessageBox.Show("The NewPage() method has failed with the status: " + status.ToString(), caption);
}
else
MessageBox.Show("The file can't be created.", caption);
gdpicturePDF.Dispose();
Example
How to add a new page (standard size of A4) specified in millimeters to the newly created document.
Dim caption As String = "Example: NewPage"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.NewPDF() = GdPictureStatus.OK Then
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
Dim status As GdPictureStatus = gdpicturePDF.NewPage(210, 297) 'A4 page size in millimeters
If status = GdPictureStatus.OK Then
If gdpicturePDF.SaveToFile("test_NewPage.pdf") = GdPictureStatus.OK Then
MessageBox.Show("The file has been saved successfully.", caption)
Else
MessageBox.Show("The file can't be saved.", caption)
End If
Else
MessageBox.Show("The NewPage() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The file can't be created.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: NewPage";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.NewPDF() == GdPictureStatus.OK)
{
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter);
GdPictureStatus status = gdpicturePDF.NewPage(210, 297); //A4 page size in millimeters
if (status == GdPictureStatus.OK)
{
if (gdpicturePDF.SaveToFile("test_NewPage.pdf") == GdPictureStatus.OK)
MessageBox.Show("The file has been saved successfully.", caption);
else
MessageBox.Show("The file can't be saved.", caption);
}
else
MessageBox.Show("The NewPage() method has failed with the status: " + status.ToString(), caption);
}
else
MessageBox.Show("The file can't be created.", caption);
gdpicturePDF.Dispose();
See Also