The positive number defining the size of default user space units. The minimum allowed value is 1, the maximum allowed value is not restricted by the toolkit.

The GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.

Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / SetPageUserUnit Method

SetPageUserUnit Method (GdPicturePDF)

In This Topic
Sets the user space unit value defined for the currently selected page in the loaded PDF document. It is the positive number specifying the size of default user space units, in multiples of 1/72 inch. The default value is 1.

Please note that you need to create or load the PDF document properly to set the valid value, otherwise the method does nothing. At the same, the specified value only relates to the currently selected page.

Syntax
'Declaration

 

Public Sub SetPageUserUnit( _

   ByVal UserUnit As Single _

) 
public void SetPageUserUnit( 

   float UserUnit

)
public procedure SetPageUserUnit( 

    UserUnit: Single

); 
public function SetPageUserUnit( 

   UserUnit : float

);
public: void SetPageUserUnit( 

   float UserUnit

) 
public:

void SetPageUserUnit( 

   float UserUnit

) 

Parameters

UserUnit
The positive number defining the size of default user space units. The minimum allowed value is 1, the maximum allowed value is not restricted by the toolkit.

The GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.

Remarks
It is recommend to use the GdPicturePDF.GetStat method to identify the specific reason for the method's failure, if any.

Just to inform you, that the default value is 1, which means the user unit is 1/72 inch. Be aware, that the minimum allowed value is 1, the maximum allowed value is not restricted by the toolkit. For further assistance, please refer to the PDF Reference, Section "Page Objects".

Example
How to specify the user space unit value for the current page to define required page dimensions.
Dim caption As String = "Example: SetPageUserUnit"

Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()

If gdpicturePDF.NewPDF() = GdPictureStatus.OK Then

    gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitPoint)

    'The height and the width for the new page in PDF points.

    Dim pageDim As Single = 14400

    'Be sure you have selected the proper page.

    If (gdpicturePDF.NewPage(pageDim, pageDim) = GdPictureStatus.OK) AndAlso

       (gdpicturePDF.SelectPage(1) = GdPictureStatus.OK) Then

        'To create a page of size 200 * 200 inches.

        Dim userUnit As Single = 75000

        gdpicturePDF.SetPageUserUnit(userUnit)

        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then

            gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitInch)

            pageDim = gdpicturePDF.GetPageHeight()

            If gdpicturePDF.GetStat() = GdPictureStatus.OK Then

                MessageBox.Show("The current page height and width is " + pageDim + " inches.", caption)

            Else

                MessageBox.Show("The GetPageHeight() failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)

            End If

        Else

            MessageBox.Show("The SetPageUserUnit() failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)

        End If

    Else

        MessageBox.Show("The new page can't be created. Status: " + gdpicturePDF.GetStat().ToString(), caption)

    End If

Else

    MessageBox.Show("The new file can't be created. Status: " + gdpicturePDF.GetStat().ToString(), caption)

End If

gdpicturePDF.Dispose()
string caption = "Example: SetPageUserUnit";

GdPicturePDF gdpicturePDF = new GdPicturePDF();

if (gdpicturePDF.NewPDF() == GdPictureStatus.OK)

{

    gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitPoint);

    float pageDim = 14400; //The height and the width for the new page in PDF points.

    //Be sure you have selected the proper page.

    if ((gdpicturePDF.NewPage(pageDim, pageDim) == GdPictureStatus.OK) &&

        (gdpicturePDF.SelectPage(1) == GdPictureStatus.OK))

    {

        float userUnit = 75000; //To create a page of size 200 * 200 inches.

        gdpicturePDF.SetPageUserUnit(userUnit);

        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)

        {

            gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitInch);

            pageDim = gdpicturePDF.GetPageHeight();

            if (gdpicturePDF.GetStat() == GdPictureStatus.OK)

                MessageBox.Show("The current page height and width is " + pageDim + " inches.", caption);

            else

                MessageBox.Show("The GetPageHeight() failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);

        }

        else

            MessageBox.Show("The SetPageUserUnit() failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);

    }

    else

        MessageBox.Show("The new page can't be created. Status: " + gdpicturePDF.GetStat().ToString(), caption);

}

else

    MessageBox.Show("The new file can't be created. Status: " + gdpicturePDF.GetStat().ToString(), caption);

gdpicturePDF.Dispose();
See Also