GetDocumentPreview(String,DocumentFormat,Int32) Method
In This Topic
Retrieves the format of a required document specified by its file path and the total number of pages of that document.
Syntax
'Declaration
Public Overloads Shared Function GetDocumentPreview( _
ByVal As String, _
ByRef As DocumentFormat, _
ByRef As Integer _
) As GdPictureStatus
public static GdPictureStatus GetDocumentPreview(
string ,
ref DocumentFormat ,
ref int
)
public function GetDocumentPreview(
: String;
var : DocumentFormat;
var : Integer
): GdPictureStatus; static;
public static function GetDocumentPreview(
: String,
: DocumentFormat,
: int
) : GdPictureStatus;
public: static GdPictureStatus GetDocumentPreview(
string* ,
ref DocumentFormat ,
ref int
)
public:
static GdPictureStatus GetDocumentPreview(
String^ ,
DocumentFormat% ,
int%
)
Parameters
- FilePath
- The full file path of the specified document.
- DocumentFormat
- Output parameter. A member of the DocumentFormat enumeration. The format of the specified document.
- PageCount
- Output parameter. The total number of pages of the specified document.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
Example
How to retrieve basic information about the specified file.
Dim documentFormat As GdPicture14.DocumentFormat = GdPicture14.DocumentFormat.DocumentFormatUNKNOWN
Dim pagesCount As Integer = 0
Dim status As GdPictureStatus = GdPictureDocumentUtilities.GetDocumentPreview("D:\\documents\\document.docx", documentFormat, pagesCount)
If status = GdPictureStatus.OK Then
MessageBox.Show("Document Preview: " + vbCrLf + " format: " + GdPicture14.DocumentFormat.ToString() + vbCrLf + " number of pages: " + pagesCount.ToString(), "GdPicture")
Else
MessageBox.Show("Error: " + status.ToString(), "GdPicture")
End If
GdPicture14.DocumentFormat documentFormat = GdPicture14.DocumentFormat.DocumentFormatUNKNOWN;
int pagesCount = 0;
GdPictureStatus status = GdPictureDocumentUtilities.GetDocumentPreview("D:\\documents\\document.docx", ref documentFormat, ref pagesCount);
if (status == GdPictureStatus.OK)
MessageBox.Show("Document Preview: \n format: " + GdPicture14.DocumentFormat.ToString() + "\n number of pages: " + pagesCount.ToString(), "GdPicture");
else
MessageBox.Show("Error: " + status.ToString(), "GdPicture");
Example
How to retrieve basic information about the specified file.
Dim documentFormat As GdPicture14.DocumentFormat = GdPicture14.DocumentFormat.DocumentFormatUNKNOWN
Dim pagesCount As Integer = 0
Dim status As GdPictureStatus = GdPictureDocumentUtilities.GetDocumentPreview("D:\\documents\\document.docx", documentFormat, pagesCount)
If status = GdPictureStatus.OK Then
MessageBox.Show("Document Preview: " + vbCrLf + " format: " + GdPicture14.DocumentFormat.ToString() + vbCrLf + " number of pages: " + pagesCount.ToString(), "GdPicture")
Else
MessageBox.Show("Error: " + status.ToString(), "GdPicture")
End If
GdPicture14.DocumentFormat documentFormat = GdPicture14.DocumentFormat.DocumentFormatUNKNOWN;
int pagesCount = 0;
GdPictureStatus status = GdPictureDocumentUtilities.GetDocumentPreview("D:\\documents\\document.docx", ref documentFormat, ref pagesCount);
if (status == GdPictureStatus.OK)
MessageBox.Show("Document Preview: \n format: " + GdPicture14.DocumentFormat.ToString() + "\n number of pages: " + pagesCount.ToString(), "GdPicture");
else
MessageBox.Show("Error: " + status.ToString(), "GdPicture");
See Also