PdfGetPageWidth Method (GdViewer)
In This Topic
Returns the page width in PDF point units of the currently selected page in the displayed PDF document.
If the document currently displayed in the GdViewer control is not the PDF file, the method will fail.
Syntax
'Declaration
Public Function PdfGetPageWidth() As Double
public double PdfGetPageWidth()
public function PdfGetPageWidth(): Double;
public function PdfGetPageWidth() : double;
public: double PdfGetPageWidth();
public:
double PdfGetPageWidth();
Return Value
The page height in points. The
GetStat method can be subsequently used to determine if this method has been successful.
Example
How to retrieve the page height of the currently displayed page of the loaded PDF document.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
Dim message As String = "The current file is: " + GdViewer1.GetLastPath()
If GdViewer1.GetDocumentType() = DocumentType.DocumentTypePDF Then
message += vbCrLf + "Number of pages: " + GdViewer1.PageCount.ToString() +
vbCrLf + "Page height: " + (GdViewer1.PdfGetPageHeight()) / 72 * 2.54 + " cm" +
vbCrLf + "Page width: " + (GdViewer1.PdfGetPageWidth()) / 72 * 2.54 + " cm"
Else
message += vbCrLf + "This file is not a PDF document, its format is: " + GdViewer1.GetDocumentType().ToString()
End If
MessageBox.Show(message, "GdViewer.PdfGetPageHeight")
Else
MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetPageWidth")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
string message = "The current file is: " + GdViewer1.GetLastPath();
if (GdViewer1.GetDocumentType() == DocumentType.DocumentTypePDF)
{
message += "\nNumber of pages: " + GdViewer1.PageCount.ToString() +
"\nPage height: " + (GdViewer1.PdfGetPageHeight())/72*2.54 +
" cm\nPage width: " + (GdViewer1.PdfGetPageWidth())/72*2.54 + " cm";
}
else
{
message += "\nThis file is not a PDF document, its format is: " + GdViewer1.GetDocumentType().ToString();
}
MessageBox.Show(message, "GdViewer.PdfGetPageWidth");
}
else
MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetPageWidth");
Example
How to retrieve the page height of the currently displayed page of the loaded PDF document.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
Dim message As String = "The current file is: " + GdViewer1.GetLastPath()
If GdViewer1.GetDocumentType() = DocumentType.DocumentTypePDF Then
message += vbCrLf + "Number of pages: " + GdViewer1.PageCount.ToString() +
vbCrLf + "Page height: " + (GdViewer1.PdfGetPageHeight()) / 72 * 2.54 + " cm" +
vbCrLf + "Page width: " + (GdViewer1.PdfGetPageWidth()) / 72 * 2.54 + " cm"
Else
message += vbCrLf + "This file is not a PDF document, its format is: " + GdViewer1.GetDocumentType().ToString()
End If
MessageBox.Show(message, "GdViewer.PdfGetPageHeight")
Else
MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetPageWidth")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
string message = "The current file is: " + GdViewer1.GetLastPath();
if (GdViewer1.GetDocumentType() == DocumentType.DocumentTypePDF)
{
message += "\nNumber of pages: " + GdViewer1.PageCount.ToString() +
"\nPage height: " + (GdViewer1.PdfGetPageHeight())/72*2.54 +
" cm\nPage width: " + (GdViewer1.PdfGetPageWidth())/72*2.54 + " cm";
}
else
{
message += "\nThis file is not a PDF document, its format is: " + GdViewer1.GetDocumentType().ToString();
}
MessageBox.Show(message, "GdViewer.PdfGetPageWidth");
}
else
MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PdfGetPageWidth");
See Also