Package com.itextpdf.pdfocr
Class OcrPdfCreatorProperties
java.lang.Object
com.itextpdf.pdfocr.OcrPdfCreatorProperties
Properties that will be used by the
OcrPdfCreator.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newOcrPdfCreatorPropertiesinstance.Creates a newOcrPdfCreatorPropertiesinstance based on anotherOcrPdfCreatorPropertiesinstance (copy constructor). -
Method Summary
Modifier and TypeMethodDescriptionGets preferred font family to be used when selecting font fromFontProvider.com.itextpdf.layout.font.FontProviderReturns FontProvider that was set previously or if it isnulla new instance ofPdfOcrFontProvideris returned.final StringGets name of image layer.Gets image rotation handler instance.final com.itextpdf.kernel.geom.RectangleGets required size for output PDF document.final StringGets PDF language.final ScaleModeGets scale mode for input images using available options fromScaleModeenumeration.final com.itextpdf.kernel.colors.ColorGets text color in output PDF document.final StringGets name of text layer.final StringgetTitle()Gets PDF document title.booleanisTagged()Retrieve information on whether pdf document should be tagged or not.setFontProvider(com.itextpdf.layout.font.FontProvider fontProvider) Sets font provider.setFontProvider(com.itextpdf.layout.font.FontProvider fontProvider, String defaultFontFamily) Sets font provider and default font family.final OcrPdfCreatorPropertiessetImageLayerName(String layerName) Sets name for the image layer,nullby default.setImageRotationHandler(IImageRotationHandler imageRotationDetector) Sets image rotation handler instance.setMetaInfo(com.itextpdf.commons.actions.contexts.IMetaInfo metaInfo) Set meta info for thisOcrPdfCreatorProperties.final OcrPdfCreatorPropertiessetPageSize(com.itextpdf.kernel.geom.Rectangle pageSize) Sets required size for output PDF document.final OcrPdfCreatorPropertiessetPdfLang(String language) Specify PDF natural language, and optionally locale.final OcrPdfCreatorPropertiessetScaleMode(ScaleMode scaleMode) Sets scale mode for input images using available options fromScaleModeenumeration.setTagged(boolean tagged) Defines whether pdf document should be tagged or not.final OcrPdfCreatorPropertiessetTextColor(com.itextpdf.kernel.colors.Color textColor) Sets text color in output PDF document.final OcrPdfCreatorPropertiessetTextLayerName(String layerName) Sets name for the text layer.final OcrPdfCreatorPropertiesSets PDF document title.
-
Constructor Details
-
OcrPdfCreatorProperties
public OcrPdfCreatorProperties()Creates a newOcrPdfCreatorPropertiesinstance. -
OcrPdfCreatorProperties
Creates a newOcrPdfCreatorPropertiesinstance based on anotherOcrPdfCreatorPropertiesinstance (copy constructor).- Parameters:
-
other- the otherOcrPdfCreatorPropertiesinstance
-
-
Method Details
-
getTextColor
public final com.itextpdf.kernel.colors.Color getTextColor()Gets text color in output PDF document.- Returns:
-
set text
Color
-
setTextColor
Sets text color in output PDF document. Text will be transparent by default.- Parameters:
-
textColor- required textColor - Returns:
-
the
OcrPdfCreatorPropertiesinstance
-
getScaleMode
Gets scale mode for input images using available options fromScaleModeenumeration.- Returns:
-
selected
ScaleMode
-
setScaleMode
Sets scale mode for input images using available options fromScaleModeenumeration.This property has no effect when pdf file is being OCRed (
OcrPdfCreator.makePdfSearchable(java.io.File, java.io.File)).- Parameters:
-
scaleMode- selectedScaleMode - Returns:
-
the
OcrPdfCreatorPropertiesinstance
-
getPageSize
public final com.itextpdf.kernel.geom.Rectangle getPageSize()Gets required size for output PDF document. Real size of the page will be calculated according to the selectedScaleMode.- Returns:
-
required page size as
Rectangle
-
setPageSize
Sets required size for output PDF document.This property has no effect when pdf file is being OCRed (
OcrPdfCreator.makePdfSearchable(java.io.File, java.io.File)).- Parameters:
-
pageSize- requested page size asRectangle - Returns:
-
the
OcrPdfCreatorPropertiesinstance
-
getImageLayerName
Gets name of image layer.- Returns:
-
image layer's name as
Stringif it was manually set, otherwise -null
-
setImageLayerName
Sets name for the image layer,nullby default.If
nullthen image is placed directly in canvas instead of layer. If image layer name is equal to text layer name then text and image placed in one layer. This property has no effect when pdf file is being OCRed (OcrPdfCreator.makePdfSearchable(java.io.File, java.io.File)).- Parameters:
-
layerName- name of the image layer asString - Returns:
-
the
OcrPdfCreatorPropertiesinstance
-
getTextLayerName
Gets name of text layer.- Returns:
-
text layer's name as
Stringif it was manually set, otherwise -null
-
setTextLayerName
Sets name for the text layer.nullby default. If null then text is placed directly in canvas instead of layer. If text layer name is equal to image layer name then text and image placed in one layer.- Parameters:
-
layerName- of the text layer asString - Returns:
-
the
OcrPdfCreatorPropertiesinstance
-
getPdfLang
Gets PDF language.- Returns:
-
PDF document language as
String
-
setPdfLang
Specify PDF natural language, and optionally locale. Language identifier shall either be the empty text string, to indicate that the language is unknown, or a Language-Tag as defined in BCP 47 (2009), Tags for the Identification of Languages.- Parameters:
-
language- PDF document language asString, e.g. "en-US", etc. - Returns:
-
the
OcrPdfCreatorPropertiesinstance
-
getTitle
Gets PDF document title.- Returns:
-
PDF title as
String
-
setTitle
Sets PDF document title.- Parameters:
-
title- PDF title asString - Returns:
-
the
OcrPdfCreatorPropertiesinstance
-
getFontProvider
public com.itextpdf.layout.font.FontProvider getFontProvider()Returns FontProvider that was set previously or if it isnulla new instance ofPdfOcrFontProvideris returned.- Returns:
-
FontProviderobject
-
setFontProvider
Sets font provider. Please note that passed FontProvider is not to be used in multithreaded environments or for any parallel processing. There will be set the following default font family:PdfOcrFontProvider.getDefaultFontFamily()- Parameters:
-
fontProvider- selectedFontProviderinstance - Returns:
-
the
OcrPdfCreatorPropertiesinstance
-
setFontProvider
public OcrPdfCreatorProperties setFontProvider(com.itextpdf.layout.font.FontProvider fontProvider, String defaultFontFamily) Sets font provider and default font family. Please note that passed FontProvider is not to be used in multithreaded environments or for any parallel processing.- Parameters:
-
fontProvider- selectedFontProviderinstance -
defaultFontFamily- preferred font family to be used when selecting font fromFontProvider. - Returns:
-
the
OcrPdfCreatorPropertiesinstance
-
getDefaultFontFamily
Gets preferred font family to be used when selecting font fromFontProvider.- Returns:
-
if default font family is not set or it is null or empty
PdfOcrFontProvider.getDefaultFontFamily()is returned
-
getImageRotationHandler
Gets image rotation handler instance.- Returns:
- image rotation handler
-
setImageRotationHandler
public OcrPdfCreatorProperties setImageRotationHandler(IImageRotationHandler imageRotationDetector) Sets image rotation handler instance. If not set - image rotation handling is not applied.- Parameters:
-
imageRotationDetector- image rotation handler instance - Returns:
-
the
OcrPdfCreatorPropertiesinstance
-
setTagged
Defines whether pdf document should be tagged or not.- Parameters:
-
tagged-trueif the result pdf is expected to be tagged,falseotherwise. - Returns:
-
this
OcrPdfCreatorPropertiesinstance.
-
isTagged
public boolean isTagged()Retrieve information on whether pdf document should be tagged or not.- Returns:
-
trueif the result pdf is expected to be tagged,falseotherwise.
-
setMetaInfo
public OcrPdfCreatorProperties setMetaInfo(com.itextpdf.commons.actions.contexts.IMetaInfo metaInfo) Set meta info for thisOcrPdfCreatorProperties.- Parameters:
-
metaInfo- meta info - Returns:
-
the instance of the current
OcrPdfCreatorProperties
-