ExaminerResults Class |
Namespace: Atalasoft.PdfDoc.Examiner
The ExaminerResults type exposes the following members.
Name | Description | |
---|---|---|
DocumentVersion |
Gets the document version advertised by the document. The resulting value is the maximum of the value
in the document header and the value in the document catalog. The value will always be for the form
major.minor. Currently major is always 1. Note many incorrect documents contain PDF features that are
beyond their advertised version.
| |
ErrorsEncountered |
Gets a list of errors encountered while opening the document. Since only a narrow subset of the document
is examined, this list is not guaranteed to be exhaustive.
| |
FormUsesXFA |
Gets a value indicating whether the AcroForm in the document uses Adobe's Extensible Form
Architecture, XFA.
| |
HasForm |
Gets a value indicating whether the document contains an AcroForm.
| |
HasSignatures |
Gets a value indicating whether the AcroForm advertises that it contains digital signatures. This
does not indicate that the signatures are valid.
| |
HasXmp |
Gets a value indicating whether the document has XMP metatdata.
| |
IsBadlyDamaged |
Gets a value indicating whether the document is badly damaged. If, during the process of opening the
file, errors were encountered that were of Major severity or worse then IsBadlyDamaged will be set to
true. If true, only the properties IsPdf, [P:IsValidHeader],
and IsEncrypted will be valid. All other values are suspect.
| |
IsEncrypted |
Gets a value indicating whether the document contains encryption. Not all documents that are
encrypted require a non-empty password. This property merely indicates that a password might be
required to correctly open the document. If FromStream(Stream, SecureString, SecureString) throws an
IncorrectPasswordException, then the document requires a non-empty password or the supplied
password(s) are incorrect.
| |
IsIncorrectVersionForXrefStream |
Gets a value indicating whether the PDF document's advertised document version is incorrect.
Specifically, some PDF document generators use a PDF featured called cross-reference streams that
require that the document be version 1.5 or greater. If there is evidence of a cross-reference stream
and the version is less than 1.5, this property will true.
| |
IsPdf |
Gets a value indicating whether the document is a PDF. This test is more lenient than the
specification allows and will return true if the document contains the PDF header
including in some pathological cases. If the PDF header meets specification, [P:IsValidHeader]
will return true. If it returns
false, the document is well out-of-spec and no other information in ExaminerResults
will be valid.
| |
IsPdfA |
Gets a value indicating whether the document advertises itself as conforming to the PDF/A-1b
archival specification. This does not mean that the document in any way complies with the specification,
merely that it says it does. For example, if IsPdfA returns true and HasXmp returns false,
then the document is NOT a PDF/A compliant document.
| |
IsPdfPortfolio |
Gets a value indicating whether the document contains a PDF Portfolio. This test looks specifically
for a Collection object in the document's catalog. A PDF Portfolio is a feature wherein a PDF document
doesn't necessarily contain any PDF data at all, but instead contains a series of embedded files which
represent the content of the document. Some PDF documents that have a Portfolion include an ersatz page
which is shown for compatibility. The presentation of embedded files is application dependent.
| |
IsValidPdfHeader |
Gets a value indicating whether the document contains a valid PDF header. If the document
does not meet the PDF specification for a header but still contains the text "%PDF-" this will
return false. For example, if the document start with the following:
%!PS-Adobe - this is PostScript not %PDF-1.0 this will be considered to be a PDF, even though it is not within specification (and because it's labeled as PostScript, it will likely generate other errors). | |
Metadata |
Gets the metadata associated with the PDF document from the DocumentInfo object within the file. This
value may be null.
| |
PageCount |
Gets the page count of the document.
| |
RequiresDynamicFormRendering |
Gets a value indicating whether requires dynamic form rendering. Typically, this is set when a document
contains an XFA form and has embedded form data that has not yet been converted into PDF content.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
FromStream(Stream) |
Attempts to build an ExaminerResults object from the stream provided. To the greatest extent
possible, FromStream attempts to get some information from the file. If the file is a PDF
and it is encrypted, FromStream will throw an IncorrectPasswordException.
Note that many of the properties in the file cascade. For example, if IsPdf returns false, no other property will be valid. If IsEncrypted is true, no other properties except IsPdf, IsPdfA, and IsIncorrectVersionForXrefStream will be valid. The properties within ExaminerResults are meant to reflect a very lightweight examination of the file and are in no way are exhaustive. PDF is a very complicated file format and there are a number of exceptions in the specification that are counter to the goal of having a light-weight interface to the information within the file. For example, because a PDF file presents information that indicates that it meets the archival variant, PDF/A, this doesn't guarantee that the document meets all requirements. ExaminerResults reflects what is advertised by the file and not necessarily the entire depth of content. The stream position can not be counted on to be at a consistent location upon return. If the document is encrypted, FromStream will throw an IncorrectPasswordException. Examples
The following example examines PDF document. If PDF document is encrypted, a password will be requested
from the user.
ExaminePdfExample ExaminerResults res = null; using (FileStream stm = File.OpenRead(path)) { try { res = ExaminerResults.FromStream(stm); } catch (IncorrectPasswordException) { while (true) { using (var userSecure = GetPasswordFromUser()) try { res = ExaminerResults.FromStream(stm, userSecure, null); break; } catch (IncorrectPasswordException) { OnIncorrectUserPassword(); } } } } | |
FromStream(Stream, SecureString, SecureString) |
Attempts to build an ExaminerResults object from the stream provided. To the greatest extent
possible, FromStream attempts to get some information from the file. If the file is a PDF
and it is encrypted, FromStream will throw an IncorrectPasswordException.
Note that many of the properties in the file cascade. For example, if IsPdf returns false, no other property will be valid. If IsEncrypted is true, no other properties except IsPdf, IsPdfA, and IsIncorrectVersionForXrefStream will be valid. The properties within ExaminerResults are meant to reflect a very lightweight examination of the file and are in no way are exhaustive. PDF is a very complicated file format and there are a number of exceptions in the specification that are counter to the goal of having a light-weight interface to the information within the file. For example, because a PDF file presents information that indicates that it meets the archival variant, PDF/A, this doesn't guarantee that the document meets all requirements. ExaminerResults reflects what is advertised by the file and not necessarily the entire depth of content. The stream position can not be counted on to be at a consistent location upon return. The supplied passwords may either or both be null indicating no password. If passwords are supplied and the document is not encrypted, the passwords will be ignored. If the document is encrypted and the password(s) are incorrect or null FromStream will throw an IncorrectPasswordException. Examples
The following example examines PDF document. If PDF document is encrypted, a password will be requested
from the user.
ExaminePdfExample ExaminerResults res = null; using (FileStream stm = File.OpenRead(path)) { try { res = ExaminerResults.FromStream(stm); } catch (IncorrectPasswordException) { while (true) { using (var userSecure = GetPasswordFromUser()) try { res = ExaminerResults.FromStream(stm, userSecure, null); break; } catch (IncorrectPasswordException) { OnIncorrectUserPassword(); } } } } | |
FromStream(Stream, String, String) | Obsolete.
Attempts to build an ExaminerResults object from the stream provided. To the greatest extent
possible, FromStream attempts to get some information from the file. If the file is a PDF
and it is encrypted, FromStream will throw an IncorrectPasswordException.
Note that many of the properties in the file cascade. For example, if IsPdf returns false, no other property will be valid. If IsEncrypted is true, no other properties except IsPdf, IsPdfA, and IsIncorrectVersionForXrefStream will be valid. The properties within ExaminerResults are meant to reflect a very lightweight examination of the file and are in no way are exhaustive. PDF is a very complicated file format and there are a number of exceptions in the specification that are counter to the goal of having a light-weight interface to the information within the file. For example, because a PDF file presents information that indicates that it meets the archival variant, PDF/A, this doesn't guarantee that the document meets all requirements. ExaminerResults reflects what is advertised by the file and not necessarily the entire depth of content. The stream position can not be counted on to be at a consistent location upon return. The supplied passwords may either or both be null indicating no password. If passwords are supplied and the document is not encrypted, the passwords will be ignored. If the document is encrypted and the password(s) are incorrect or null FromStream will throw an IncorrectPasswordException. Examples
The following example examines PDF document. If PDF document is encrypted, a password will be requested
from the user.
ExaminePdfExample ExaminerResults res = null; using (FileStream stm = File.OpenRead(path)) { try { res = ExaminerResults.FromStream(stm); } catch (IncorrectPasswordException) { while (true) { using (var userSecure = GetPasswordFromUser()) try { res = ExaminerResults.FromStream(stm, userSecure, null); break; } catch (IncorrectPasswordException) { OnIncorrectUserPassword(); } } } } | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |