'We assume that the GdViewer1 control has been properly integrated.
'At the same let's assume that you have properly displayed a PDF document as well.
If GdViewer1.IsRect() Then
Dim filename As String = GdViewer1.GetLastPath()
Dim left As Single = 0, top As Single = 0, width As Single = 0, height As Single = 0
GdViewer1.GetRectCoordinatesOnDocumentInches(left, top, width, height)
Using oPDF As GdPicturePDF = New GdPicturePDF()
If oPDF.LoadFromFile(filename, True) = GdPictureStatus.OK Then
oPDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitInch)
oPDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
oPDF.SetLineColor(255, 69, 0)
If oPDF.DrawRectangle(left, top, width, height, False, True) = GdPictureStatus.OK Then
If oPDF.SaveToFile(filename) = GdPictureStatus.OK Then
MessageBox.Show("Done!", "GdViewer.GetRectCoordinatesOnDocumentInches")
End If
End If
End If
oPDF.CloseDocument()
End Using
End If
//We assume that the GdViewer1 control has been properly integrated.
//At the same let's assume that you have properly displayed a PDF document as well.
if (GdViewer1.IsRect())
{
string filename = GdViewer1.GetLastPath();
float left = 0, top = 0, width = 0, height = 0;
GdViewer1.GetRectCoordinatesOnDocumentInches(ref left, ref top, ref width, ref height);
using (GdPicturePDF oPDF = new GdPicturePDF())
{
if (oPDF.LoadFromFile(filename, true) == GdPictureStatus.OK)
{
oPDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitInch);
oPDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
oPDF.SetLineColor(255, 69, 0);
if (oPDF.DrawRectangle(left, top, width, height, false, true) == GdPictureStatus.OK)
{
if (oPDF.SaveToFile(filename) == GdPictureStatus.OK)
{
MessageBox.Show("Done!", "GdViewer.GetRectCoordinatesOnDocumentInches");
}
}
}
oPDF.CloseDocument();
}
}