Link Search Menu Expand Document

XMLExtractor Class

Represents PDF to XML extractor. Also able to extract data from PNG, JPEG, BMP and TIFF (single-page) images using Optical Character Recognition (OCR).
Inheritance Hierarchy
SystemObject
Bytescout.PDFExtractorBaseExtractor
Bytescout.PDFExtractorBaseTextExtractor
Bytescout.PDFExtractorXMLExtractor

Namespace:Bytescout.PDFExtractor
Assembly: Bytescout.PDFExtractor (in Bytescout.PDFExtractor.dll) Version: 13.4.0.4760-master
Syntax
public class XMLExtractor : BaseTextExtractor, 
	IXMLExtractor

The XMLExtractor type exposes the following members.

Constructors
NameDescription
Public methodXMLExtractor
Initializes a new instance of the XMLExtractor class.
Public methodXMLExtractor(String, String)
Initializes a new instance of the XMLExtractor class.
Top
Properties
NameDescription
Public propertyAllowStandalonePunctuation
Gets or sets whether to allow standalone punctuation characters. If false they will be merged with nearest text object.
Public propertyAutoAlignColumnsToHeader
Sets whether to align text in the columns to the header.
(Inherited from BaseTextExtractor.)
Public propertyCheckPermissions
Defines whether to respect permissions set by document owner. If True, extractor throws exception when the extraction is prohibited. IMPORTANT: THIS OPTION HAVE TO BE ENABLED AND SET TO "TRUE" TO RESPECT OWNERS OF PDF DOCUMENTS. IF YOU SET IT TO FALSE TO IGNORE PERMISSIONS WHICH ARE SET IN PDF DOCUMENT THEN YOU ARE SOLELY LIABLE FOR THIS ACTION AND ANY COPYRIGHT OR OTHER VIOLATIONS AT YOUR OWN RISK. BYTESCOUT IS NOT LIABLE FOR ANY DAMAGES, LOSSES, COPYRIGHT INFRINGEMENTS OR ANY OTHER CONSEQUENCES CAUSED BY IGNORING PERMISSIONS OF PDF DOCUMENT. BY CHANGING THIS OPTION YOU ARE CONFIRMING YOU ARE UNDERSTANDING ALL WRITTEN ABOVE AND DOING IT AT YOUR OWN RISK.
(Inherited from BaseExtractor.)
Public propertyColumnDetectionByTextAlignment
Suggests the extractor the visual text alignment in table cells. It helps to detect columns when tables don't have vertical separating lines between columns and the columns are formed by text alignment.
(Inherited from BaseTextExtractor.)
Public propertyColumnDetectionMode
Sets how columns are detected. Default is 'ContentGroupsAndBorders' - columns are detected by grouping of text objects and by vertical vector lines.
(Inherited from BaseTextExtractor.)
Public propertyComHelpers
Set of utility functions and properties to use from COM/ActiveX.
(Inherited from BaseExtractor.)
Public propertyConsiderBackgroundColors
Consider background colors under text objects when detecting table structure. It can be useful for striped tables, but may degrade extraction quality on scanned documents because of uneven image background. Default is false.
(Inherited from BaseTextExtractor.)
Public propertyConsiderFontColors
Consider font colors in document text when detecting table structure. Default is false.
(Inherited from BaseTextExtractor.)
Public propertyConsiderFontNames
Consider font names in document text when detecting table structure. Default is false.
(Inherited from BaseTextExtractor.)
Public propertyConsiderFontSizes
Consider font sizes in document text when detecting table structure. Default is false.
(Inherited from BaseTextExtractor.)
Public propertyConsiderHorizontalBorders
Consider horizontal borders between text objects when detecting table structure and merging objects. Default is true.
(Inherited from BaseTextExtractor.)
Public propertyConsiderVerticalBorders
Consider vertical borders between text objects when detecting table structure and merging objects. Default is true.
(Inherited from BaseTextExtractor.)
Public propertyContentType
Returns content type of PDF document: normal document, portfolio or XFA form. To extract files from PDF portfolio use AttachmentExtractor class. To extract XFA form content use XFAFormExtractor class.
(Inherited from BaseExtractor.)
Public propertyCustomExtractionColumns
Allows to override automatic columns detection with custom columns coordinates.
(Inherited from BaseTextExtractor.)
Public propertyDetectLinesInsteadOfParagraphsObsolete.
Lines detection option. Obsolete: Use LineGroupingMode instead.
(Inherited from BaseTextExtractor.)
Public propertyDetectNewColumnBySpacesRatio
Space ratio between words. Large spacing is treated as column separator. Using this parameter you can control the column detection.
(Inherited from BaseTextExtractor.)
Public propertyDetectStrikeoutTextStyle
Get or sets whether to detect the "strikeout" text style. Default is false.
Public propertyDetectUnderlineTextStyle
Get or sets whether to detect the "underline" text style. Default is false.
Public propertyEmbeddedFileCountObsolete.
Property is disabled to speed up the document loading. Use AttachmentExtractor to work with attachments.
(Inherited from BaseExtractor.)
Public propertyEnableTextAnalysis
Enables or disables extracted text analysis. Check TextAnalysisResults after the extraction for analysis results.
(Inherited from BaseTextExtractor.)
Public propertyEncrypted
Gets whether the document is encrypted.
(Inherited from BaseExtractor.)
Public propertyExtractAnnotations
Sets whether to extract text from annotation objects. Default is true.
(Inherited from BaseTextExtractor.)
Public propertyExtractColumnByColumn
Sets whether we should reconstruct table structure or extract text objects as they go in the PDF document stream. Default is true.
(Inherited from BaseTextExtractor.)
Public propertyExtractInvisibleText
Sets whether to extract invisible text from a PDF document.
(Inherited from BaseTextExtractor.)
Public propertyExtractionArea
Sets the extraction area by coordinates and dimensions (left, top, width, height).
(Inherited from BaseExtractor.)
Public propertyExtractionAreaRect
Sets the extraction area by rectangle.
(Inherited from BaseExtractor.)
Public propertyExtractionAreaUsageMode
Gets or sets how to use the ExtractionArea: whether to extract any object intersecting with the area or only objects completely located inside the area.
(Inherited from BaseExtractor.)
Public propertyExtractionColumns
Contains columns detected from last processed document page.
(Inherited from BaseTextExtractor.)
Public propertyExtractShadowLikeText
Sets whether to extract shadow-like text from a PDF document (when the same text is drawn twice with small offset). Default is 'true' - includes all decoded text, regardless of its appearance.
(Inherited from BaseTextExtractor.)
Public propertyImageFolder
Gets or sets the folder to put extracted images when SaveImages property is set to ImageHandling.OuterFile. Default is "images" - the extractor will create "images" sub-folder in the same folder with output XML file.
Public propertyImageFormat
Gets or sets the image format for extracted images. Default is PNG.
Public propertyIndentedXML
Get or sets whether to generate indented XML. Default is true.
Public propertyIsDocumentLoaded
Get the document loaded state.
(Inherited from BaseExtractor.)
Public propertyKeepOriginalFontNames
By default XMLExtractor replaces names of embedded fonts with standard (or "descendant") fonts similar by metrics and typeface. This is because embedded fonts differ from fonts installed into your system or absent there at all. Set this property to true if you want to keep the original font names.
Public propertyLicenseInfo
Gets license information.
(Inherited from BaseExtractor.)
Public propertyLineGroupingMode
Sets how lines are grouped into paragraphs. Default is None (no line grouping is performed).
(Inherited from BaseTextExtractor.)
Public propertyNormalizeText
Set whether the extracted text should be normalized. Default is false.
(Inherited from BaseTextExtractor.)
Public propertyOCRAutoModeMinExistingTextLength
Applies to OCRMode.Auto only. Sets the minimal total length of normal text objects on the current page to decide whether to perform OCR or not. If the length of the text is less than this value then extractor will use OCR for this page. Otherwise it extracts the existing normal text objects only.
(Inherited from BaseTextExtractor.)
Public propertyOCRBlackList
A set of characters not allowed to be recognized from scanned document. The resulting text will only contain characters that are not in this list. This helps improve uncertain recognition.
(Inherited from BaseTextExtractor.)
Public propertyOCRCacheMode
Sets caching of OCR results. Default is Off (no caching). In WholePage caching mode you can save processing time as the SDK will check if need to re-run OCR on the page or it can just pull results from previously cached OCR results.
(Inherited from BaseTextExtractor.)
Public propertyOCRCorrections
A set of corrections automatically applied to recognized text to fix repeating recognition errors.
(Inherited from BaseTextExtractor.)
Public propertyOCRDetectLines
Sets whether to detect horizontal and vertical lines during OCR. They help to detect the table structure in scanned documents. Default is false.
(Inherited from BaseTextExtractor.)
Public propertyOCRDetectPageRotation
Sets whether to detect scanned page rotation. Slightly slows down the processing.
(Inherited from BaseTextExtractor.)
Public propertyOCRDisableAutoSegmentation
Sets whether to disable the automatic segmentation. All pages will be treated as containing sparse text (as a typical document such as an invoice).
(Inherited from BaseTextExtractor.)
Public propertyOCRImagePreprocessingFilters
A set of corrections automatically applied to recognized text to fix repeating recognition errors.
(Inherited from BaseTextExtractor.)
Public propertyOCRLanguage
Language of OCR (Optical Character Recognition). The valid values are:
  • "eng" - English (default)
  • "deu" - German
  • "fra" - French
  • "spa" - Spanish

Download more languages at https://github.com/bytescout/ocrdata.

(Inherited from BaseTextExtractor.)
Public propertyOCRLanguageDataFolder
Folder containing OCR language data files.
(Inherited from BaseTextExtractor.)
Public propertyOCRMaximizeCPUUtilization
Gets or sets maximum OCR performance using Intel OpenMP (if available) to accelerate to approximately 30%. Default is false.
(Inherited from BaseTextExtractor.)
Public propertyOCRMode
Enables use of the OCR (Optical Character Recognition) which allows you to recognize text from images embedded in PDF pages. Set the language using the OCRLanguage property.

This option requires Bytescout.PDFExtractor.OCRExtension.dll assembly reference and relevant language files in OCRLanguageDataFolder folder. The SDK is shipped with language files for English, French, German and Spanish. You can download more languages at https://github.com/bytescout/ocrdata.

(Inherited from BaseTextExtractor.)
Public propertyOCROverallConfidence
Gets overall OCR confidence. This value is calculated after the extraction is performed.
(Inherited from BaseTextExtractor.)
Public propertyOCRPageCount
Gets count of processed pages for which OCR was performed. This value is calculated after the extraction is finished.
(Inherited from BaseTextExtractor.)
Public propertyOCRResolution
Resolution of OCR (Optical Character Recognition). Default is 300 DPI.
(Inherited from BaseTextExtractor.)
Public propertyOCRWhiteList
A set of characters allowed to be recognized from scanned document. Only characters from this list will appear in the result text. This helps improve uncertain recognition.
(Inherited from BaseTextExtractor.)
Public propertyPageDataCaching
Controls page data caching behavior.
(Inherited from BaseExtractor.)
Public propertyPassword
PDF document password.
(Inherited from BaseExtractor.)
Public propertyPreserveFormattingOnTextExtraction
Sets whether to preserve the text formatting on the extraction.
(Inherited from BaseTextExtractor.)
Public propertyProfiles
Comma-separated list of profiles to apply to the extractor. Profiles must be previously loaded.
(Inherited from BaseExtractor.)
Public propertyRegistrationKey
Registration key.
(Inherited from BaseExtractor.)
Public propertyRegistrationName
Registration name.
(Inherited from BaseExtractor.)
Public propertyRemoveHyphenation
Sets whether to automatically remove hyphenations in end of lines (works when is true).
(Inherited from BaseTextExtractor.)
Public propertyRotationAngle
Sets whether to rotate document pages to specified angle before the extraction.
(Inherited from BaseTextExtractor.)
Public propertyRTLTextAutoDetectionEnabled
Enables RTL (Right-To-Left) text auto detection. Default is true.
(Inherited from BaseTextExtractor.)
Public propertySaveImages
Get or sets the image saving way: do not save; save to outer file; embed into result XML as Base64 string. Default is ImageHandling.None.
Public propertySaveVectors
Get or sets whether to save vector objects. Default is false.
Public propertyShrinkMultipleSpaces
Replaces multiple spaces in text objects with a single space. Multiple spaces affect column detection, so removing them may improve the result. Default is false.
(Inherited from BaseTextExtractor.)
Public propertyTableXMinIntersectionRequiredInPercents
During the reconstruction of table structure, sets how much of the cell rectangle should intersect (by X coordinate axis) with the previous cell to treat both cells belong to the same row.
(Inherited from BaseTextExtractor.)
Public propertyTableYMinIntersectionRequiredInPercents
During the reconstruction of table structure, sets how much of the cell rectangle should intersect (by Y coordinate axis) with the previous cell to treat both cells belong to the same column.
(Inherited from BaseTextExtractor.)
Public propertyTextAnalysisCorruptedTextThreshold
The criterion of detection of the corrupted text used in text analysis. Default is 0.5.
(Inherited from BaseTextExtractor.)
Public propertyTextAnalysisResults
Results of the text analysis. Enable the analysis using EnableTextAnalysis property.
(Inherited from BaseTextExtractor.)
Public propertyTextEncodingCodePage
Sets the default text encoding. Default encoding is "iso-8859-1".
(Inherited from BaseTextExtractor.)
Public propertyTrimSpaces
Sets whether to remove trailing and ending spaces from the text of table cells. Default is true.
(Inherited from BaseTextExtractor.)
Public propertyUnwrap
Sets whether to unwrap the contents of a multiline table cell into a single line. Default is true.
(Inherited from BaseTextExtractor.)
Public propertyVersion
Gets the component version number.
(Inherited from BaseExtractor.)
Public propertyXCoordinateToleranceFactor
Sets X coordinate tolerance to use when constructing table structure of PDF page.
(Inherited from BaseTextExtractor.)
Public propertyYCoordinateToleranceFactor
Sets Y coordinate tolerance to use when constructing table structure of PDF page.
(Inherited from BaseTextExtractor.)
Top
Methods
NameDescription
Public methodAddFilter(String, Boolean, Boolean)
Adds a filter to remove a text from extracted data.
(Inherited from BaseTextExtractor.)
Public methodAddFilter(String, Int32, Boolean)
Adds filter to exclude text objects with specified attributes.
(Inherited from BaseTextExtractor.)
Public methodAddFilter(String, Int32, Color, Boolean)
Adds filter to exclude text objects with specified attributes.
(Inherited from BaseTextExtractor.)
Public methodAddFilter(String, String, Boolean, Boolean)
Adds a filter to replace a text in extracted data.
(Inherited from BaseTextExtractor.)
Public methodAddFilter(String, Int32, Int32, Int32, Int32, Boolean)
Adds filter to exclude text objects with specified attributes.
(Inherited from BaseTextExtractor.)
Public methodCreateProfile(String, Boolean, Boolean, Boolean)
Creates JSON profile will all extractor properties with current values.
(Inherited from BaseExtractor.)
Public methodCreateProfile(String, String, Boolean, Boolean, Boolean)
Creates JSON profile will all extractor properties with current values.
(Inherited from BaseExtractor.)
Public methodDispose
Releases the unmanaged resources used by the instance and optionally releases the managed resources.
(Inherited from BaseExtractor.)
Public methodDisposePage
Disposes the page object. Uses this method carefully to destroy the page object that should not be used further. Useful to free allocated memory when processing huge PDF documents.
(Inherited from BaseTextExtractor.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Protected methodFireParsingError (Inherited from BaseExtractor.)
Protected methodFireProgressChanged (Inherited from BaseExtractor.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetPageCount
Returns document page count.
(Inherited from BaseExtractor.)
Public methodGetPageRect_Height
Gets the specified page height.
(Inherited from BaseExtractor.)
Public methodGetPageRect_Left
Gets the specified page left coordinate.
(Inherited from BaseExtractor.)
Public methodGetPageRect_Top
Gets the specified page top coordinate.
(Inherited from BaseExtractor.)
Public methodGetPageRect_Width
Gets the specified page width.
(Inherited from BaseExtractor.)
Public methodGetPageRectangle(Int32)
Gets the page rectangle in PDF Points (1 Point = 1/72 in.).
(Inherited from BaseExtractor.)
Public methodGetPageRectangle(Int32, Boolean)
Gets the page rectangle in PDF Points (1 Point = 1/72 in.).
(Inherited from BaseExtractor.)
Public methodGetPageRotationAngle
Returns the rotation angle of specified page.
(Inherited from BaseExtractor.)
Public methodGetPageXMLAsVariant
Returns extracted XML data as array of bytes. This is COM/ActiveX-compatible version of the method SavePageXMLToStream(Int32, Stream) for in-memory processing of PDF documents or images.
Public methodGetPreprocessedPagePreview
Returns preview image of document page with preprocessing filters applied.
(Inherited from BaseTextExtractor.)
Public methodGetType (Inherited from Object.)
Public methodGetXML
Extracts XML data from the entire document as string.
Public methodGetXML(IListInt32)
Extracts XML data from specified page range.
Public methodGetXML(String)
Extracts XML data from specified page range.
Public methodGetXML(Int32, Int32)
Extracts XML data from specified page range.
Public methodGetXMLAsVariant
Returns extracted XML data as array of bytes. This is COM/ActiveX-compatible version of the method SaveXMLToStream(Stream) for in-memory processing of PDF documents or images.
Public methodGetXMLAsVariant(String)
Returns extracted XML data as array of bytes. This is COM/ActiveX-compatible version of the method SaveXMLToStream(String, Stream) for in-memory processing of PDF documents or images.
Public methodGetXMLAsVariant(Int32, Int32)
Returns extracted XML data as array of bytes. This is COM/ActiveX-compatible version of the method SaveXMLToStream(Int32, Int32, Stream) for in-memory processing of PDF documents or images.
Public methodGetXMLDocument
Extracts XML data from the entire document as XmlDocument.
Public methodGetXMLDocument(IListInt32)
Extracts XML data from specified pages as XmlDocument.
Public methodGetXMLDocument(String)
Extracts XML data from specified page ranges as XmlDocument.
Public methodGetXMLDocument(Int32, Int32)
Extracts XML data from specified page range as XmlDocument.
Public methodGetXMLDocumentFromPage
Extracts XML data from specified document page as XmlDocument.
Public methodGetXMLFromPage
Extracts XML data from specified document page as string.
Public methodIsEncrypted
Gets the document encrypted state.
(Inherited from BaseExtractor.)
Public methodIsOCRRecommendedForPage
Detects whether OCR is recommended for specified page. OCR (Optical Character Recognition) is recommended when pages has no text objects bat has an image that might contain text.
(Inherited from BaseTextExtractor.)
Public methodLoadAndApplyProfiles
Loads profiles from JSON string and automatically applies them. Note that profiles containing detection keywords will be deferred until the extraction.
(Inherited from BaseExtractor.)
Public methodLoadDocumentFromFile
Loads PDF document from specified file.
(Inherited from BaseExtractor.)
Public methodLoadDocumentFromStream
Loads PDF document from provided stream.
(Inherited from BaseExtractor.)
Public methodLoadDocumentFromVariant
Loads PDF document from byte array presented as array of Variant or Byte objects ('Variant()' or 'Byte()'). This is COM/ActiveX-compatible version of the method LoadDocumentFromStream(Stream) for in-memory processing of PDF files.
(Inherited from BaseExtractor.)
Public methodLoadProfiles
Loads profiles from JSON file.
(Inherited from BaseExtractor.)
Public methodLoadProfilesFromString
Loads profiles from JSON string.
(Inherited from BaseExtractor.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodPerformTextAnalysis (Inherited from BaseTextExtractor.)
Public methodReset (Overrides BaseTextExtractorReset.)
Protected methodResetBaseExtractionData (Inherited from BaseTextExtractor.)
Public methodResetExtractionArea
Resets the extraction area to the full page.
(Inherited from BaseExtractor.)
Public methodResetFilters
Reset text filters.
(Inherited from BaseTextExtractor.)
Public methodSavePageXMLToFile
Saves page XML data to file.
Public methodSavePageXMLToStream
Saves page XML data to stream.
Public methodSavePreprocessedPagePreview
Saves preview image of document page with preprocessing filters applied. Image is saved in PNG format.
(Inherited from BaseTextExtractor.)
Public methodSaveXMLToFile(String)
Saves XML data from the entire document to file.
Public methodSaveXMLToFile(IListInt32, String)
Saves XML data from specified pages to file.
Public methodSaveXMLToFile(String, String)
Saves XML data from specified page ranges to file.
Public methodSaveXMLToFile(Int32, Int32, String)
Saves XML data from specified page range to file.
Public methodSaveXMLToStream(Stream)
Saves XML data to stream.
Public methodSaveXMLToStream(IListInt32, Stream)
Saves XML data from specified pages to stream.
Public methodSaveXMLToStream(String, Stream)
Saves XML data from specified page ranges to stream.
Public methodSaveXMLToStream(Int32, Int32, Stream)
Saves XML data from specified page range to stream.
Public methodSetCustomExtractionColumns
Helper method to set CustomExtractionColumns property when using the extractor though COM from VC++ VB, VBA, VBScript, or Delphi.
(Inherited from BaseTextExtractor.)
Public methodSetExtractionArea(RectangleF)
Sets the extraction area by rectangle.
(Inherited from BaseExtractor.)
Public methodSetExtractionArea(Double, Double, Double, Double)
Sets the extraction area by coordinates and dimensions.
(Inherited from BaseExtractor.)
Public methodSetExtractionArea(Single, Single, Single, Single)
Sets the extraction area by coordinates and dimensions.
(Inherited from BaseExtractor.)
Public methodToString (Inherited from Object.)
Top
Events
NameDescription
Public eventParsingError
Raised on PDF document parsing errors. This usually indicates a damaged document.
(Inherited from BaseExtractor.)
Public eventPasswordRequired
Occurs when the password required to decrypt the document.
(Inherited from BaseExtractor.)
Public eventProgressChanged
Raised for each reported progress value. Allows to cancel the processing.
(Inherited from BaseExtractor.)
Top
Fields
NameDescription
Protected fieldExtractionAreaInternal (Inherited from BaseExtractor.)
Top
See Also

Reference