GdPicture.NET.14.API
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 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.

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 gdpicturePDF As New GdPicturePDF()
Dim message As String = "NO document IS loaded." + vbCrLf + vbCrLf
            
'The values obtained here are undefined.
Dim origin As PdfOrigin = gdpicturePDF.GetOrigin()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
message = message + "Origin: " + origin.ToString() + "    status: " + status.ToString()
Dim units As PdfMeasurementUnit = gdpicturePDF.GetMeasurementUnit()
status = gdpicturePDF.GetStat()
message = message + vbCrLf + "Units: " + units.ToString() + "    status: " + status.ToString()
MessageBox.Show(message, "Example: GetOrigin")
            
'You need to load the file here.
status = gdpicturePDF.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 = gdpicturePDF.GetOrigin()
    status = gdpicturePDF.GetStat()
    message = message + "Origin: " + origin.ToString() + "    status: " + status.ToString()
    units = gdpicturePDF.GetMeasurementUnit()
    status = gdpicturePDF.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
            
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
string message = "NO document IS loaded.\n\n";
            
//The values obtained here are undefined.
PdfOrigin origin = gdpicturePDF.GetOrigin();
GdPictureStatus status = gdpicturePDF.GetStat();
message = message + "Origin: " + origin.ToString() + "    status: " + status.ToString();
PdfMeasurementUnit units = gdpicturePDF.GetMeasurementUnit();
status = gdpicturePDF.GetStat();
message = message + "\nUnits: " + units.ToString() + "    status: " + status.ToString();
MessageBox.Show(message, "Example: GetOrigin");
            
//You need to load the file here.
status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
    message = "Your pdf document IS loaded.\n\n";
    //The values obtained here are correctly defined.
    origin = gdpicturePDF.GetOrigin();
    status = gdpicturePDF.GetStat();
    message = message + "Origin: " + origin.ToString() + "    status: " + status.ToString();
    units = gdpicturePDF.GetMeasurementUnit();
    status = gdpicturePDF.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");
}
            
gdpicturePDF.Dispose();
See Also