Package com.itextpdf.pdfocr
Class OcrPdfCreatorProperties
java.lang.Object
com.itextpdf.pdfocr.OcrPdfCreatorProperties
Properties that will be used by the
OcrPdfCreator
.
-
Constructor Summary
ConstructorDescriptionCreates a newOcrPdfCreatorProperties
instance.Creates a newOcrPdfCreatorProperties
instance based on anotherOcrPdfCreatorProperties
instance (copy constructor). -
Method Summary
Modifier and TypeMethodDescriptionGets preferred font family to be used when selecting font fromFontProvider
.com.itextpdf.layout.font.FontProvider
Returns FontProvider that was set previously or if it isnull
a new instance ofPdfOcrFontProvider
is returned.final String
Gets name of image layer.Gets image rotation handler instance.final com.itextpdf.kernel.geom.Rectangle
Gets required size for output PDF document.final String
Gets PDF language.final ScaleMode
Gets scale mode for input images using available options fromScaleMode
enumeration.final com.itextpdf.kernel.colors.Color
Gets text color in output PDF document.final String
Gets name of text layer.final String
getTitle()
Gets PDF document title.boolean
isTagged()
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 OcrPdfCreatorProperties
setImageLayerName
(String layerName) Sets name for the image layer.setImageRotationHandler
(IImageRotationHandler imageRotationDetector) Sets image rotation handler instance.setMetaInfo
(com.itextpdf.commons.actions.contexts.IMetaInfo metaInfo) Set meta info for thisOcrPdfCreatorProperties
.final OcrPdfCreatorProperties
setPageSize
(com.itextpdf.kernel.geom.Rectangle pageSize) Sets required size for output PDF document.final OcrPdfCreatorProperties
setPdfLang
(String language) Specify PDF natural language, and optionally locale.final OcrPdfCreatorProperties
setScaleMode
(ScaleMode scaleMode) Sets scale mode for input images using available options fromScaleMode
enumeration.setTagged
(boolean tagged) Defines whether pdf document should be tagged or not.final OcrPdfCreatorProperties
setTextColor
(com.itextpdf.kernel.colors.Color textColor) Sets text color in output PDF document.final OcrPdfCreatorProperties
setTextLayerName
(String layerName) Sets name for the text layer.final OcrPdfCreatorProperties
Sets PDF document title.
-
Constructor Details
-
OcrPdfCreatorProperties
public OcrPdfCreatorProperties()Creates a newOcrPdfCreatorProperties
instance. -
OcrPdfCreatorProperties
Creates a newOcrPdfCreatorProperties
instance based on anotherOcrPdfCreatorProperties
instance (copy constructor).- Parameters:
-
other
- the otherOcrPdfCreatorProperties
instance
-
-
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
OcrPdfCreatorProperties
instance
-
getScaleMode
Gets scale mode for input images using available options fromScaleMode
enumeration.- Returns:
-
selected
ScaleMode
-
setScaleMode
Sets scale mode for input images using available options fromScaleMode
enumeration.- Parameters:
-
scaleMode
- selectedScaleMode
- Returns:
-
the
OcrPdfCreatorProperties
instance
-
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.- Parameters:
-
pageSize
- requested page size asRectangle
- Returns:
-
the
OcrPdfCreatorProperties
instance
-
getImageLayerName
Gets name of image layer.- Returns:
-
image layer's name as
String
if it was manually set, otherwise -null
-
setImageLayerName
Sets name for the image layer.null
by default. If null then 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.- Parameters:
-
layerName
- name of the image layer asString
- Returns:
-
the
OcrPdfCreatorProperties
instance
-
getTextLayerName
Gets name of text layer.- Returns:
-
text layer's name as
String
if it was manually set, otherwise -null
-
setTextLayerName
Sets name for the text layer.null
by 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
OcrPdfCreatorProperties
instance
-
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
OcrPdfCreatorProperties
instance
-
getTitle
Gets PDF document title.- Returns:
-
PDF title as
String
-
setTitle
Sets PDF document title.- Parameters:
-
title
- PDF title asString
- Returns:
-
the
OcrPdfCreatorProperties
instance
-
getFontProvider
public com.itextpdf.layout.font.FontProvider getFontProvider()Returns FontProvider that was set previously or if it isnull
a new instance ofPdfOcrFontProvider
is returned.- Returns:
-
FontProvider
object
-
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
- selectedFontProvider
instance - Returns:
-
the
OcrPdfCreatorProperties
instance
-
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
- selectedFontProvider
instance -
defaultFontFamily
- preferred font family to be used when selecting font fromFontProvider
. - Returns:
-
the
OcrPdfCreatorProperties
instance
-
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
OcrPdfCreatorProperties
instance
-
setTagged
Defines whether pdf document should be tagged or not.- Parameters:
-
tagged
-true
if the result pdf is expected to be tagged,false
otherwise. - Returns:
-
this
OcrPdfCreatorProperties
instance.
-
isTagged
public boolean isTagged()Retrieve information on whether pdf document should be tagged or not.- Returns:
-
true
if the result pdf is expected to be tagged,false
otherwise.
-
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
-