GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / NewPage Method / NewPage(Single,Single) Method
The page width, expressed in the current units specified by the SetMeasurementUnit method.

You can simply use the GetMeasurementUnit method to determine the currently defined units and you can easily use the SetMeasurementUnit method to reset the units according to your preference.

The page height, expressed in the current units specified by the SetMeasurementUnit method.

You can simply use the GetMeasurementUnit method to determine the currently defined units and you can easily use the SetMeasurementUnit method to reset the units according to your preference.

Example





In This Topic
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
'Declaration
 
Public Overloads Function NewPage( _
   ByVal PageWidth As Single, _
   ByVal PageHeight As Single _
) As GdPictureStatus
public GdPictureStatus NewPage( 
   float PageWidth,
   float PageHeight
)
public function NewPage( 
    PageWidth: Single;
    PageHeight: Single
): GdPictureStatus; 
public function NewPage( 
   PageWidth : float,
   PageHeight : float
) : GdPictureStatus;
public: GdPictureStatus NewPage( 
   float PageWidth,
   float PageHeight
) 
public:
GdPictureStatus NewPage( 
   float PageWidth,
   float PageHeight
) 

Parameters

PageWidth
The page width, expressed in the current units specified by the SetMeasurementUnit method.

You can simply use the GetMeasurementUnit method to determine the currently defined units and you can easily use the 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 GetMeasurementUnit method to determine the currently defined units and you can easily use the 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.

Remarks
This method is only allowed for use with non-encrypted documents.

The newly created page is automatically set as the current page after successful adding.

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