Dim caption As String = "Example: GetPageUserUnit"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
Dim message As String = ""
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitPoint)
'Be sure you have selected the proper page.
gdpicturePDF.SelectPage(1)
Dim userUnits As Single = gdpicturePDF.GetPageUserUnit()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
message += "Page User Units: " + userUnits.ToString()
Dim pageHeight As Single = gdpicturePDF.GetPageHeight()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
Dim pageWidth As Single = gdpicturePDF.GetPageWidth()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
Dim currentPageHeight As Single = pageHeight * userUnits * 1 / 72
Dim currentPageWidth As Single = pageWidth * userUnits * 1 / 72
message += vbCrLf + "Current page dimensions in inches:"
message += vbCrLf + "page height = " + currentPageHeight + vbCrLf + "page width = " + currentPageWidth
Else
message += vbCrLf + "The GetPageWidth() method has failed with the status: " + gdpicturePDF.GetStat().ToString()
End If
Else
message += vbCrLf + "The GetPageHeight() method has failed with the status: " + gdpicturePDF.GetStat().ToString()
End If
Else
message += "The GetPageUserUnit() method has failed with the status: " + gdpicturePDF.GetStat().ToString()
End If
MessageBox.Show(message, caption)
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetPageUserUnit";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
string message = "";
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitPoint);
//Be sure you have selected the proper page.
gdpicturePDF.SelectPage(1);
float userUnits = gdpicturePDF.GetPageUserUnit();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
message += "Page User Units: " + userUnits.ToString();
float pageHeight = gdpicturePDF.GetPageHeight();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
float pageWidth = gdpicturePDF.GetPageWidth();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
float currentPageHeight = pageHeight * userUnits * 1 / 72;
float currentPageWidth = pageWidth * userUnits * 1 / 72;
message += "\nCurrent page dimensions in inches:\npage height = " + currentPageHeight + "\npage width = " + currentPageWidth;
}
else
message += "\nThe GetPageWidth() method has failed with the status: " + gdpicturePDF.GetStat().ToString();
}
else
message += "\nThe GetPageHeight() method has failed with the status: " + gdpicturePDF.GetStat().ToString();
}
else
message += "The GetPageUserUnit() method has failed with the status: " + gdpicturePDF.GetStat().ToString();
MessageBox.Show(message, caption);
}
else
MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();