Package com.itextpdf.kernel.pdf.xobject
Class PdfFormXObject
java.lang.Object
com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfStream>
com.itextpdf.kernel.pdf.xobject.PdfXObject
com.itextpdf.kernel.pdf.xobject.PdfFormXObject
- Direct Known Subclasses:
-
SvgImageXObject
A wrapper for Form XObject. ISO 32000-1, 8.10 FormXObjects.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPdfFormXObject(Rectangle bBox) Creates a new instance of Form XObject.PdfFormXObject(WmfImageData image, PdfDocument pdfDocument) Creates a form XObject fromWmfImageData.PdfFormXObject(PdfPage page) Creates form XObject from page content.PdfFormXObject(PdfStream pdfStream) CreatePdfFormXObjectinstance byPdfStream. -
Method Summary
Modifier and TypeMethodDescriptionstatic RectangleCalculates the coordinates of the xObject BBox multiplied by the Matrix field.voidflush()To manually flush aPdfObjectbehind this wrapper, you have to ensure that this object is added to the document, i.e.getBBox()Gets Form XObject's BBox,PdfName.BBoxkey.floatGets height based on XObject's BBox.Gets a text string representing the printer’s mark in human-readable form.Gets process color model of trap network appearance,PdfName.PCMkey.GetsPdfResourcesof the Form XObject.Gets separation color names of trap network appearance,PdfName.SeparationColorNameskey.Gets an array of TrapRegion objects defining the page’s trapping zones and the associated trapping parameters, as described in Adobe Technical Note #5620, Portable Job Ticket Format.Gets a human-readable text string that described this trap network to the user.floatgetWidth()Gets width based on XObject's BBox.booleanIf the form xobject is relative sized.Puts the value into Image XObject dictionary and associates it with the specified key.Sets Form XObject's BBox,PdfName.BBoxkey.setGroup(PdfTransparencyGroup transparency) Sets a group attributes dictionary indicating that the contents of the form XObject shall be treated as a group and specifying the attributes of that group.setMarkStyle(PdfString markStyle) Sets a text string representing the printer’s mark in human-readable form.setProcessColorModel(PdfName model) Sets process color model for trap network appearance,PdfName.PCMkey.setSeparationColorNames(PdfArray colorNames) Sets separation color names for the trap network appearance,PdfName.SeparationColorNameskey.setTrapRegions(PdfArray regions) Sets an array of TrapRegion objects defining the page’s trapping zones and the associated trapping parameters, as described in Adobe Technical Note #5620, Portable Job Ticket Format.setTrapStyles(PdfString trapStyles) Sets a human-readable text string that described this trap network to the user.Methods inherited from class com.itextpdf.kernel.pdf.xobject.PdfXObject
addAssociatedFile, calculateProportionallyFitRectangleWithHeight, calculateProportionallyFitRectangleWithWidth, getAssociatedFiles, isWrappedObjectMustBeIndirect, makeXObject, setLayerMethods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
Field Details
-
resources
-
-
Constructor Details
-
PdfFormXObject
Creates a new instance of Form XObject.- Parameters:
-
bBox- the form XObject’s bounding box.
-
PdfFormXObject
CreatePdfFormXObjectinstance byPdfStream. Note, this constructor doesn't perform any additional checks- Parameters:
-
pdfStream-PdfStreamwith Form XObject. - See Also:
-
PdfFormXObject
Creates form XObject from page content. The page shall be from the document, to which FormXObject will be added.- Parameters:
-
page- an instance ofPdfPage
-
PdfFormXObject
Creates a form XObject fromWmfImageData. Unlike other images,WmfImageDataimages are represented asPdfFormXObject, not asPdfImageXObject.- Parameters:
-
image- image to create form object from -
pdfDocument- document instance which is needed for writing form stream contents
-
-
Method Details
-
calculateBBoxMultipliedByMatrix
Calculates the coordinates of the xObject BBox multiplied by the Matrix field.For mor information see paragraph 8.10.1 in ISO-32000-1.
- Parameters:
-
form- the object for which calculate the coordinates of the bBox - Returns:
-
the bBox
Rectangle
-
getResources
GetsPdfResourcesof the Form XObject. Note, if there is no resources, a new instance will be created.- Returns:
-
not null instance of
PdfResources.
-
getBBox
Gets Form XObject's BBox,PdfName.BBoxkey. -
setBBox
Sets Form XObject's BBox,PdfName.BBoxkey. -
setGroup
Sets a group attributes dictionary indicating that the contents of the form XObject shall be treated as a group and specifying the attributes of that group.PdfName.Groupkey.- Parameters:
-
transparency- instance ofPdfTransparencyGroup. - Returns:
- object itself.
- See Also:
-
getWidth
public float getWidth()Gets width based on XObject's BBox.- Overrides:
-
getWidthin classPdfXObject - Returns:
- float value.
-
getHeight
public float getHeight()Gets height based on XObject's BBox.- Overrides:
-
getHeightin classPdfXObject - Returns:
- float value.
-
flush
public void flush()To manually flush aPdfObjectbehind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference. Basically this means that before flushing you need to explicitly callPdfObjectWrapper.makeIndirect(PdfDocument). For example: wrapperInstance.makeIndirect(document).flush(); Note that not every wrapper require this, only those that have such warning in documentation.- Overrides:
-
flushin classPdfObjectWrapper<PdfStream>
-
setProcessColorModel
Sets process color model for trap network appearance,PdfName.PCMkey.- Parameters:
-
model- shall be one of the valid values:PdfName.DeviceGray,PdfName.DeviceRGB,PdfName.DeviceCMYK,PdfName.DeviceCMY,PdfName.DeviceRGBK, andPdfName.DeviceN. - Returns:
- object itself.
-
getProcessColorModel
Gets process color model of trap network appearance,PdfName.PCMkey.- Returns:
-
a
PdfNameinstance, possible values:PdfName.DeviceGray,PdfName.DeviceRGB,PdfName.DeviceCMYK,PdfName.DeviceCMY,PdfName.DeviceRGBK, andPdfName.DeviceN.
-
setSeparationColorNames
Sets separation color names for the trap network appearance,PdfName.SeparationColorNameskey.- Parameters:
-
colorNames- an array of names identifying the colorants that were assumed when the trap network appearance was created. - Returns:
- object itself.
-
getSeparationColorNames
Gets separation color names of trap network appearance,PdfName.SeparationColorNameskey.- Returns:
-
an
PdfArrayof names identifying the colorants.
-
setTrapRegions
Sets an array of TrapRegion objects defining the page’s trapping zones and the associated trapping parameters, as described in Adobe Technical Note #5620, Portable Job Ticket Format.PdfName.TrapRegionskey.- Parameters:
-
regions- APdfArrayof indirect references to TrapRegion objects. - Returns:
- object itself.
-
getTrapRegions
Gets an array of TrapRegion objects defining the page’s trapping zones and the associated trapping parameters, as described in Adobe Technical Note #5620, Portable Job Ticket Format.PdfName.TrapRegionskey.- Returns:
-
A
PdfArrayof indirect references to TrapRegion objects.
-
setTrapStyles
Sets a human-readable text string that described this trap network to the user.PdfName.TrapStyleskey.- Parameters:
-
trapStyles- aPdfStringvalue. - Returns:
- object itself.
-
getTrapStyles
Gets a human-readable text string that described this trap network to the user.PdfName.TrapStyleskey.- Returns:
-
a
PdfStringvalue.
-
setMarkStyle
Sets a text string representing the printer’s mark in human-readable form.- Parameters:
-
markStyle- a string value. - Returns:
- object itself.
-
getMarkStyle
Gets a text string representing the printer’s mark in human-readable form.- Returns:
- a string value.
-
put
Puts the value into Image XObject dictionary and associates it with the specified key. If the key is already present, it will override the old value with the specified one.- Parameters:
-
key- key to insert or to override -
value- the value to associate with the specified key - Returns:
- object itself.
-
isRelativeSized
public boolean isRelativeSized()If the form xobject is relative sized. This information is used during xobject layout to resolve it's relative size.- Returns:
-
trueif the xobject is relative sized,falseotherwise
-