Reference Guide
GdPicture14 Namespace / GdPicturePDF Class / GetOrigin Method
Example





In This Topic
    GetOrigin Method (GdPicturePDF)
    In This Topic
    Returns the origin's location of the currently used coordinate system defined in the loaded PDF document. Please note that you need to create or load the PDF document properly to get the valid value, otherwise the value is undefined.
    Syntax
    'Declaration
     
    
    Public Function GetOrigin() As PdfOrigin
    public PdfOrigin GetOrigin()
    public function GetOrigin(): PdfOrigin; 
    public function GetOrigin() : PdfOrigin;
    public: PdfOrigin GetOrigin(); 
    public:
    PdfOrigin GetOrigin(); 

    Return Value

    A member of the PdfOrigin enumeration. The default value is PdfOrigin.PdfOriginBottomLeft.

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

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

    The location of the origin of a PDF document is defined by default to be at the lower left corner.

    The standard location of the origin are: bottom left, top left, bottom right, top right.

    Example
    How to find out the currently set location of the origin of the used coordinate system.
    Dim oGdPicturePDF As New GdPicturePDF()
    Dim message As String = "NO document IS loaded." + vbCrLf + vbCrLf
                
    'The values obtained here are undefined.
    Dim origin As PdfOrigin = oGdPicturePDF.GetOrigin()
    Dim status As GdPictureStatus = oGdPicturePDF.GetStat()
    message = message + "Origin: " + origin.ToString() + "    status: " + status.ToString()
    Dim units As PdfMeasurementUnit = oGdPicturePDF.GetMeasurementUnit()
    status = oGdPicturePDF.GetStat()
    message = message + vbCrLf + "Units: " + units.ToString() + "    status: " + status.ToString()
    MessageBox.Show(message, "Example: GetOrigin")
                
    'You need to load the file here.
    status = oGdPicturePDF.LoadFromFile("testPDF.pdf", False)
    If status = GdPictureStatus.OK Then
        message = "Your pdf document IS loaded." + vbCrLf + vbCrLf
        'The values obtained here are correctly defined.
        origin = oGdPicturePDF.GetOrigin()
        status = oGdPicturePDF.GetStat()
        message = message + "Origin: " + origin.ToString() + "    status: " + status.ToString()
        units = oGdPicturePDF.GetMeasurementUnit()
        status = oGdPicturePDF.GetStat()
        message = message + vbCrLf + "Units: " + units.ToString() + "    status: " + status.ToString()
        MessageBox.Show(message, "Example: GetOrigin")
    Else
        MessageBox.Show("The file can't be loaded.", "Example: GetOrigin")
    End If
                
    oGdPicturePDF.Dispose()
    GdPicturePDF oGdPicturePDF = new GdPicturePDF();
    string message = "NO document IS loaded.\n\n";
                
    //The values obtained here are undefined.
    PdfOrigin origin = oGdPicturePDF.GetOrigin();
    GdPictureStatus status = oGdPicturePDF.GetStat();
    message = message + "Origin: " + origin.ToString() + "    status: " + status.ToString();
    PdfMeasurementUnit units = oGdPicturePDF.GetMeasurementUnit();
    status = oGdPicturePDF.GetStat();
    message = message + "\nUnits: " + units.ToString() + "    status: " + status.ToString();
    MessageBox.Show(message, "Example: GetOrigin");
                
    //You need to load the file here.
    status = oGdPicturePDF.LoadFromFile("test.pdf", false);
    if (status == GdPictureStatus.OK)
    {
        message = "Your pdf document IS loaded.\n\n";
        //The values obtained here are correctly defined.
        origin = oGdPicturePDF.GetOrigin();
        status = oGdPicturePDF.GetStat();
        message = message + "Origin: " + origin.ToString() + "    status: " + status.ToString();
        units = oGdPicturePDF.GetMeasurementUnit();
        status = oGdPicturePDF.GetStat();
        message = message + "\nUnits: " + units.ToString() + "    status: " + status.ToString();
        MessageBox.Show(message, "Example: GetOrigin");
    }
    else
    {
        MessageBox.Show("The file can't be loaded.", "Example: GetOrigin");
    }
                
    oGdPicturePDF.Dispose();
    See Also