public final class PsDocument extends Document
This class encapsulates PS/EPS documents.
| Constructor and Description |
|---|
PsDocument()
Initializes empty
PsDocument with initialized page. |
PsDocument(InputStream psStream)
Initializes
PsDocument with a stream of PS/EPS file. |
PsDocument(OutputStream psStream,
PsSaveOptions options)
Initializes empty
PsDocument with initialized page. |
PsDocument(OutputStream psStream,
PsSaveOptions options,
boolean multipaged)
Initializes empty
PsDocument. |
PsDocument(OutputStream psStream,
PsSaveOptions options,
int numberOfPages)
Initializes empty
PsDocument when the number of Postscript document pages is known in advance. |
PsDocument(String psFilePath)
Initializes
PsDocument with an input PS/EPS file. |
PsDocument(String outPsFilePath,
PsSaveOptions options)
Initializes empty
PsDocument with initialized page. |
PsDocument(String outPsFilePath,
PsSaveOptions options,
boolean multipaged)
Initializes empty
PsDocument. |
PsDocument(String outPsFilePath,
PsSaveOptions options,
int numberOfPages)
Initializes empty
PsDocument when the number of Postscript document pages is known in advance. |
| Modifier and Type | Method and Description |
|---|---|
void |
clip(Shape s)
Adds clip to current graphics state.
|
void |
clipAndNewPath(Shape s)
Adds clip to current graphics state and than writes "newpath" operator.
|
void |
clipRectangle(Rectangle2D.Float rect)
Adds clipping rectangle to current graphics state.
|
void |
clipText(String text,
Font font,
float x,
float y)
Adds clip from an outline of given text in given font.
|
void |
closePage()
Complete current page.
|
void |
convertType1FontToTTF(String type1FontFilePath,
String outputDir)
Converts Type 1 font to TrueType.
|
void |
convertType3FontToTTF(String type3FontFilePath,
OutputStream outputStream)
Converts Type 3 font to TrueType.
|
void |
convertType3FontToTTF(String type3FontFilePath,
String outputDir)
Converts Type 3 font to TrueType.
|
void |
cropEps(OutputStream epsStream,
float[] cropBox)
Crops given
PsDocument as EPS file. |
void |
cropEps(String outEpsFilePath,
float[] cropBox)
Crops given
PsDocument as EPS file. |
void |
draw(Shape shape)
Draw an arbitrary path.
|
void |
drawExplicitImageMask(BufferedImage image24bpp,
BufferedImage alphaMask1bpp,
AffineTransform transform)
Draw masked image.
|
void |
drawImage(BufferedImage image)
Draw an image.
|
void |
drawImage(BufferedImage image,
AffineTransform transform,
Color bkg)
Draw transformed image with background.
|
void |
drawTransparentImage(BufferedImage image,
AffineTransform transform,
int transparencyThreshold)
Draw transformed transparent image with background.
|
int[] |
extractEpsBoundingBox()
Reads EPS file and extracts bounding box of EPS image from %%BoundingBox comment or bounds for default page size (0, 0, 595, 842) if it doesn't exist.
|
Dimension |
extractEpsSize()
Reads EPS file and extracts a size of EPS image from %%BoundingBox comment or default page size (595, 842) if it doesn't exist.
|
String |
extractText(SaveOptions options,
int startPage,
int endPage)
Extracts text from PS file.
|
void |
fill(Shape shape)
Fill an arbitrary path.
|
void |
fillAndStrokeText(String text,
com.aspose.foundation.drawing.DrFont drFont,
float x,
float y,
Paint fillPaint,
Paint strokePaint,
Stroke stroke)
Adds a text string by filling interior of glyphs and drawing glyphs contours.
|
void |
fillAndStrokeText(String text,
float[] advances,
com.aspose.foundation.drawing.DrFont drFont,
float x,
float y,
Paint fillPaint,
Paint strokePaint,
Stroke stroke)
Adds a text string by filling interior of glyphs and drawing glyphs contours.
|
void |
fillAndStrokeText(String text,
float[] advances,
Font font,
float x,
float y,
Paint fillPaint,
Paint strokePaint,
Stroke stroke)
Adds a text string by filling interior of glyphs and drawing glyphs contours.
|
void |
fillAndStrokeText(String text,
Font font,
float x,
float y,
Paint fillPaint,
Paint strokePaint,
Stroke stroke)
Adds a text string by filling interior of glyphs and drawing glyphs contours.
|
void |
fillText(String text,
com.aspose.foundation.drawing.DrFont drFont,
float x,
float y)
Adds a text string by filling interior of glyphs.
|
void |
fillText(String text,
com.aspose.foundation.drawing.DrFont drFont,
float x,
float y,
Paint fill)
Adds a text string by filling interior of glyphs.
|
void |
fillText(String text,
float[] advances,
com.aspose.foundation.drawing.DrFont drFont,
float x,
float y)
Adds a text string by filling interior of glyphs.
|
void |
fillText(String text,
float[] advances,
com.aspose.foundation.drawing.DrFont drFont,
float x,
float y,
Paint fill)
Adds a text string by filling interior of glyphs.
|
void |
fillText(String text,
float[] advances,
Font font,
float x,
float y)
Adds a text string by filling interior of glyphs.
|
void |
fillText(String text,
float[] advances,
Font font,
float x,
float y,
Paint fill)
Adds a text string by filling interior of glyphs.
|
void |
fillText(String text,
Font font,
float x,
float y)
Adds a text string by filling interior of glyphs.
|
void |
fillText(String text,
Font font,
float x,
float y,
Paint fill)
Adds a text string by filling interior of glyphs.
|
InputStream |
getInputStream() |
int |
getNumberOfPages()
Gets a quantity of pages in resulting PDF document.
|
Paint |
getPaint()
Gets paint in current graphics state.
|
Stroke |
getStroke()
Gets stroke in current graphics state.
|
XmpMetadata |
getXmpMetadata()
Reads PS/EPS file and extracts XmpMetdata if it already exists or add new one if it doesn't exist.
|
void |
merge(String[] filesForMerge,
Device device,
SaveOptions options)
Deprecated.
As of release 24.3, replaced by mergeToPdf() method.
|
void |
mergeToPdf(OutputStream pdfStream,
String[] filesForMerge,
SaveOptions options)
Merges PS/EPS files to a device.
|
void |
mergeToPdf(String outPdfFilePath,
String[] filesForMerge,
SaveOptions options)
Merges PS/EPS files to a device.
|
void |
openPage(float width,
float height)
Creates new page and make it current one.
|
void |
openPage(String pageName)
Creates new page with document's size and make it current one.
|
void |
outlineText(String text,
com.aspose.foundation.drawing.DrFont drFont,
float x,
float y)
Adds a text string by drawing glyphs contours.
|
void |
outlineText(String text,
com.aspose.foundation.drawing.DrFont drFont,
float x,
float y,
Paint outlinePaint,
Stroke stroke)
Adds a text string by drawing glyphs contours.
|
void |
outlineText(String text,
float[] advances,
com.aspose.foundation.drawing.DrFont drFont,
float x,
float y)
Adds a text string by drawing glyphs contours.
|
void |
outlineText(String text,
float[] advances,
com.aspose.foundation.drawing.DrFont drFont,
float x,
float y,
Paint outlinePaint,
Stroke stroke)
Adds a text string by drawing glyphs contours.
|
void |
outlineText(String text,
float[] advances,
Font font,
float x,
float y)
Adds a text string by drawing glyphs contours.
|
void |
outlineText(String text,
float[] advances,
Font font,
float x,
float y,
Paint outlinePaint,
Stroke stroke)
Adds a text string by drawing glyphs contours.
|
void |
outlineText(String text,
Font font,
float x,
float y)
Adds a text string by drawing glyphs contours.
|
void |
outlineText(String text,
Font font,
float x,
float y,
Paint outlinePaint,
Stroke stroke)
Adds a text string by drawing glyphs contours.
|
void |
resizeEps(OutputStream epsStream,
DimensionF newSizeInUnits,
Units units)
Resizes given
PsDocument as EPS file. |
void |
resizeEps(String outEpsFilePath,
DimensionF newSizeInUnits,
Units units)
Resizes given
PsDocument as EPS file. |
void |
rotate(float angleRadians)
Adds rotation counterclockwise about the origin to current graphics state (rotate current matrix).
|
void |
rotate(int angleDegrees)
Adds rotation counterclockwise about the origin to current graphics state (rotate current matrix).
|
void |
save()
Saves given PsDocument as PS or EPS file.
|
void |
save(Device device,
SaveOptions options)
Deprecated.
As of release 24.3, replaced by saveAsPdf() and saveAsImage(). In 24.6 this method will be hidden.
|
void |
save(OutputStream epsStream)
Saves given PsDocument to the stream.
|
void |
save(String outEpsFilePath)
Saves given PsDocument as EPS file.
|
void |
saveAsImage(ImageSaveOptions options)
Saves PS/EPS file to image file.
|
void |
saveAsImage(ImageSaveOptions options,
String outDir,
String fileNameTemplate)
Saves PS/EPS file to image file to the specified directory with the specified file name.
|
byte[][] |
saveAsImagesBytes(ImageSaveOptions options)
Saves PS/EPS file to images bytes arrays.
|
void |
saveAsPdf(OutputStream pdfStream,
PdfSaveOptions options)
Saves PS/EPS file to an output PDF stream.
|
void |
saveAsPdf(String outPdfFilePath,
PdfSaveOptions options)
Saves PS/EPS file to PDF file.
|
static void |
saveImageAsEps(BufferedImage image,
OutputStream epsStream,
PsSaveOptions options)
Saves BufferedImage object to EPS file.
|
static void |
saveImageAsEps(BufferedImage image,
String epsFilePath,
PsSaveOptions options)
Saves BufferedImage object to EPS file.
|
static void |
saveImageAsEps(InputStream imageStream,
OutputStream epsStream,
PsSaveOptions options)
Saves PNG/JPEG/BMP/GIF image from input stream to EPS output stream.
|
static void |
saveImageAsEps(String imageFilePath,
String epsFilePath,
PsSaveOptions options)
Saves PNG/JPEG/BMP/GIF image from file to EPS file.
|
void |
scale(float xScale,
float yScale)
Adds scale to current graphics state (scale current matrix).
|
void |
setInputStream(InputStream is)
Specifies an input stream.
|
void |
setPageDevice(Map<String,Object> pageParams)
Sets page device parameters (see operator "setpagedevice" PostScript spesification).
|
void |
setPageSize(float width,
float height)
Sets page size.
|
void |
setPaint(Paint paint)
Sets paint in current graphics state.
|
void |
setStroke(Stroke stroke)
Sets stroke in current graphics state.
|
void |
setTransform(AffineTransform matrix)
Set current transformation to this one.
|
void |
shear(float shx,
float shy)
Adds shear transformation to current graphics state (shear current matrix).
|
void |
transform(AffineTransform matrix)
Adds transformation to current graphics state (concatenates this matrix with current one).
|
void |
translate(float x,
float y)
Adds translation to current graphics state (translates current matrix).
|
void |
writeGraphicsRestore()
Writes restoring of the current graphics state (see PostScript specification on operator "grestore").
|
void |
writeGraphicsSave()
Writes saving of the current graphics state (see PostScript specification on operator "gsave").
|
isLicensedpublic PsDocument()
Initializes empty PsDocument with initialized page. This constructor is used only for additional operations that are not related to PostScript files,
for example, converting fonts.
public PsDocument(String outPsFilePath, PsSaveOptions options) throws Exception
Initializes empty PsDocument with initialized page.
outPsFilePath - The output PS/EPS file path.options - A set of parameters controlling saving of PostScript file.IOException - I/O exception.Exceptionpublic PsDocument(OutputStream psStream, PsSaveOptions options) throws Exception
Initializes empty PsDocument with initialized page.
psStream - Stream where to save PS/EPS file.options - A set of parameters controlling saving of PostScript file.IOException - I/O exception.Exceptionpublic PsDocument(String outPsFilePath, PsSaveOptions options, boolean multipaged) throws Exception
Initializes empty PsDocument.
outPsFilePath - The output PS/EPS file path.options - A set of parameters controlling saving of PostScript file.multipaged - If false page will not be initialized. In this case page initialization should be performed via explicit "openPage(width, height) call."IOException - I/O exception.Exceptionpublic PsDocument(OutputStream psStream, PsSaveOptions options, boolean multipaged) throws Exception
Initializes empty PsDocument.
psStream - Stream where to save PS/EPS file.options - A set of parameters controlling saving of PostScript file.multipaged - If false page will not be initialized. In this case page initialization should be performed via explicit "openPage(width, height) call."IOException - I/O exception.Exceptionpublic PsDocument(String outPsFilePath, PsSaveOptions options, int numberOfPages) throws Exception
Initializes empty PsDocument when the number of Postscript document pages is known in advance.
outPsFilePath - The output PS/EPS file path.options - A set of parameters controlling saving of PostScript file.numberOfPages - The number of pages in the PostScript document.IOException - I/O exception.Exceptionpublic PsDocument(OutputStream psStream, PsSaveOptions options, int numberOfPages) throws Exception
Initializes empty PsDocument when the number of Postscript document pages is known in advance.
psStream - Stream where to save PS/EPS file.options - A set of parameters controlling saving of PostScript file.numberOfPages - The number of pages in the PostScript document.IOException - I/O exception.Exceptionpublic PsDocument(String psFilePath) throws IOException
Initializes PsDocument with an input PS/EPS file.
psFilePath - PS/EPS file path.IOException - I/O exception.public PsDocument(InputStream psStream) throws IOException
Initializes PsDocument with a stream of PS/EPS file.
psStream - Stream of PS/EPS file.IOException - I/O exception.public void setInputStream(InputStream is) throws IOException
Specifies an input stream.
is - Input stream of PS/EPS file.IOException - I/O exception.public InputStream getInputStream()
@Deprecated public void save(Device device, SaveOptions options) throws Exception
Saves PS/EPS file to a device.
public void saveAsPdf(String outPdfFilePath, PdfSaveOptions options) throws Exception
Saves PS/EPS file to PDF file.
outPdfFilePath - An output PDF file path.options - Contains flags that specify output of errors thrown during conversion.Exceptionpublic void saveAsPdf(OutputStream pdfStream, PdfSaveOptions options) throws Exception
Saves PS/EPS file to an output PDF stream.
pdfStream - An output PDF stream.options - Contains flags that specify output of errors thrown during conversion.Exceptionpublic void saveAsImage(ImageSaveOptions options) throws Exception
Saves PS/EPS file to image file. The output directory and the file name will be the same as from input PS file. The file extension will correspond to image format in "options" param. If the document was initialized with a stream that is not derived from FileInputStream, image file will be saved in the current folder with default file name template.
options - Contains necessary parameters for saving image and flags that specify output of errors thrown during conversion.Exceptionpublic void saveAsImage(ImageSaveOptions options, String outDir, String fileNameTemplate) throws Exception
Saves PS/EPS file to image file to the specified directory with the specified file name. The file extension will correspond to the image format in "options" param.
options - Contains necessary parameters for saving image and flags that specify output of errors thrown during conversion.outDir - The output directory where the image file will be saved.fileNameTemplate - The file name template for the image (without extension). If the input PS/EPS file is 1-paged it will be precisely the file name,
otherwise "_[n]", where "n" - a number of page starting from 0, suffix will be appended to this. The file extension will correspond to image format in "option" param.Exceptionpublic byte[][] saveAsImagesBytes(ImageSaveOptions options) throws Exception
Saves PS/EPS file to images bytes arrays.
options - Contains necessary parameters for saving image and flags that specify output of errors thrown during conversion.Exceptionpublic void save(String outEpsFilePath) throws Exception
Saves given PsDocument as EPS file. This method is used only after updating XMP metadata. It saves initial EPS file with updated existing metadata or new one created while calling getMetadata method. In the last case all necessary PostScript code and EPS comments are added.
outEpsFilePath - An output EPS file path..Exceptionpublic void save(OutputStream epsStream) throws Exception
Saves given PsDocument to the stream. This method is used only after updating XMP metadata. It saves initial EPS file with updated existing metadata or new one created while calling getMetadata method. In the last case all necessary PostScript code and EPS comments are added.
epsStream - Stream of output EPS file.Exceptionpublic void save()
throws Exception
Saves given PsDocument as PS or EPS file. This method is used only when PsDocument was created from scratch.
Exceptionpublic XmpMetadata getXmpMetadata() throws Exception
Reads PS/EPS file and extracts XmpMetdata if it already exists or add new one if it doesn't exist.
Exceptionpublic String extractText(SaveOptions options, int startPage, int endPage) throws Exception
Extracts text from PS file. It works only for text that is written with TrueType fonts (Type 42) or composite fonts (Type 0) that consists of TrueType fonts.
options - The save options.startPage - The page from which inclusively to start to extract text.endPage - The page to which inclusively to extract text.Exceptionpublic Dimension extractEpsSize() throws Exception
Reads EPS file and extracts a size of EPS image from %%BoundingBox comment or default page size (595, 842) if it doesn't exist.
Exceptionpublic void resizeEps(String outEpsFilePath, DimensionF newSizeInUnits, Units units) throws Exception
Resizes given PsDocument as EPS file. This method is used only after extracting EPS size.
It saves initial EPS file with updated existing %%BoundingBox or new one will be created. Page transformation matrix also will be set.
outEpsFilePath - The output EPS file path.newSizeInUnits - New size of EPS image in assigned units.units - The units of the new size. Can be points, inches, millimeters, centimeters and percents of initial size.Exceptionpublic void resizeEps(OutputStream epsStream, DimensionF newSizeInUnits, Units units) throws Exception
Resizes given PsDocument as EPS file. This method is used only after extracting EPS size.
It saves initial EPS file with updated existing %%BoundingBox or new one will be created. Page transformation matrix also will be set.
epsStream - The stream of output EPS file.newSizeInUnits - New size of EPS image in assigned units.units - The units of the new size. Can be points, inches, millimeters, centimeters and percents of initial size.Exceptionpublic int[] extractEpsBoundingBox()
throws Exception
Reads EPS file and extracts bounding box of EPS image from %%BoundingBox comment or bounds for default page size (0, 0, 595, 842) if it doesn't exist.
Exceptionpublic void cropEps(String outEpsFilePath, float[] cropBox) throws Exception
Crops given PsDocument as EPS file.
It saves initial EPS file with updated existing %%BoundingBox or new one will be created.
outEpsFilePath - The output EPS file path.cropBox - The crop box (x0, y0, x, y).Exceptionpublic void cropEps(OutputStream epsStream, float[] cropBox) throws Exception
Crops given PsDocument as EPS file.
It saves initial EPS file with updated existing %%BoundingBox or new one will be created.
epsStream - The stream of output EPS file.cropBox - The crop box (x0, y0, x, y).Exceptionpublic static void saveImageAsEps(InputStream imageStream, OutputStream epsStream, PsSaveOptions options) throws Exception
Saves PNG/JPEG/BMP/GIF image from input stream to EPS output stream.
imageStream - Image input stream.epsStream - EPS output stream.options - Contains parameters that specify output of errors thrown during conversion.Exceptionpublic static void saveImageAsEps(String imageFilePath, String epsFilePath, PsSaveOptions options) throws Exception
Saves PNG/JPEG/BMP/GIF image from file to EPS file.
imageFilePath - Image file path.epsFilePath - EPS file path.options - Contains parameters that specify output of errors thrown during conversion.Exceptionpublic static void saveImageAsEps(BufferedImage image, String epsFilePath, PsSaveOptions options) throws Exception
Saves BufferedImage object to EPS file.
image - The Image.epsFilePath - EPS file path.options - Contains parameters that specify output of errors thrown during conversion.Exceptionpublic static void saveImageAsEps(BufferedImage image, OutputStream epsStream, PsSaveOptions options) throws Exception
Saves BufferedImage object to EPS file.
image - The Image.epsStream - EPS output stream.options - Contains parameters that specify output of errors thrown during conversion.Exceptionpublic void convertType1FontToTTF(String type1FontFilePath, String outputDir) throws Exception
Converts Type 1 font to TrueType. The name of the converted TTF font file will be the same as input Type 1 font with ".ttf" extension. TTF file will be saved to assigned output directory.
type1FontFilePath - The Type 1 font file path..outputDir - Output dir where to save resulting TrueType font.Exceptionpublic void convertType3FontToTTF(String type3FontFilePath, String outputDir) throws Exception
Converts Type 3 font to TrueType. The name of the converted TTF font file will be the same as input Type 3 font with ".ttf" extension. TTF file will be saved to assigned output directory.
type3FontFilePath - The Type 3 font file path..outputDir - Output dir where to save resulting TrueType font.Exceptionpublic void convertType3FontToTTF(String type3FontFilePath, OutputStream outputStream) throws Exception
Converts Type 3 font to TrueType. TTF file will be saved to the provided output stream.
type3FontFilePath - The Type 3 font file path.outputStream - Output stream where to save resulting TrueType font.Exceptionpublic void setPageSize(float width,
float height)
Sets page size. To create pages with different sizes in one document use setPageDevice
method just after this method.
width - The width of page in resulting PostScript file.height - The height of page in resulting PostScript file.public void setPageDevice(Map<String,Object> pageParams)
Sets page device parameters (see operator "setpagedevice" PostScript spesification). Among these can be page size and color etc.
pageParams - Parameters of the page. In this dictionary can be page size and color etc.public void openPage(float width,
float height)
Creates new page and make it current one.
width - The width of new page.height - The height of new page.public void openPage(String pageName)
Creates new page with document's size and make it current one.
pageName - The name of new page. If it is null the name o the page will be an order number of the page.public void closePage()
Complete current page.
public void writeGraphicsSave()
Writes saving of the current graphics state (see PostScript specification on operator "gsave").
public void writeGraphicsRestore()
Writes restoring of the current graphics state (see PostScript specification on operator "grestore").
public void setTransform(AffineTransform matrix)
Set current transformation to this one.
matrix - The transformation.public void transform(AffineTransform matrix)
Adds transformation to current graphics state (concatenates this matrix with current one).
matrix - The transformation.public void translate(float x,
float y)
Adds translation to current graphics state (translates current matrix).
x - The translation in X direction.y - The translation in Y direction.public void scale(float xScale,
float yScale)
Adds scale to current graphics state (scale current matrix).
xScale - The scale in X axis.yScale - The scale in Y axis.public void rotate(float angleRadians)
Adds rotation counterclockwise about the origin to current graphics state (rotate current matrix).
angleRadians - The angle of rotation in radians.public void rotate(int angleDegrees)
Adds rotation counterclockwise about the origin to current graphics state (rotate current matrix).
angleDegrees - The angle of rotation in degrees.public void shear(float shx,
float shy)
Adds shear transformation to current graphics state (shear current matrix).
shx - The shear in X axis.shy - The shear in Y axis.public void clip(Shape s)
Adds clip to current graphics state.
s - The clipping path.public void clipText(String text, Font font, float x, float y)
Adds clip from an outline of given text in given font.
text - The text.font - The font.x - An X coordinate of the text position.x - An Y coordinate of the text position.public void clipRectangle(Rectangle2D.Float rect)
Adds clipping rectangle to current graphics state.
rect - The clipping rectangle.public void clipAndNewPath(Shape s)
Adds clip to current graphics state and than writes "newpath" operator. It is necessary to do to escape of confluence of this clipping path and some subsequent pathes such as glyphs outlined with "charpath" operator.
s - The clipping path.public void setPaint(Paint paint)
Sets paint in current graphics state.
paint - The paint. It can be any subclass of Paint class existed in JDK.public Paint getPaint()
Gets paint in current graphics state.
public void setStroke(Stroke stroke)
Sets stroke in current graphics state.
stroke - The stroke.public Stroke getStroke()
Gets stroke in current graphics state.
public void fillText(String text, Font font, float x, float y)
Adds a text string by filling interior of glyphs.
text - The text to add.font - System font that will be used to draw text.x - X coordinate for text origin.y - Y coordinate for text origin.public void fillText(String text, float[] advances, Font font, float x, float y)
Adds a text string by filling interior of glyphs.
text - The text to add.advances - An array of glyphs width. It's length must comply with the number of glyphs in the string.font - System font that will be used to draw text.x - X coordinate for text origin.y - Y coordinate for text origin.public void fillText(String text, com.aspose.foundation.drawing.DrFont drFont, float x, float y)
Adds a text string by filling interior of glyphs.
text - The text to add.drFont - DrFont that will be used to draw text. It can be used with custom font that is located in custom folder.x - X coordinate for text origin.y - Y coordinate for text origin.public void fillText(String text, float[] advances, com.aspose.foundation.drawing.DrFont drFont, float x, float y)
Adds a text string by filling interior of glyphs.
text - The text to add.advances - An array of glyphs width. It's length must comply with the number of glyphs in the string.drFont - DrFont that will be used to draw text. It can be used with custom font that is located in custom folder.x - X coordinate for text origin.y - Y coordinate for text origin.public void fillText(String text, Font font, float x, float y, Paint fill)
Adds a text string by filling interior of glyphs.
text - The text to add.font - The font that will be used to draw text.x - X coordinate for text origin.y - Y coordinate for text origin.fill - The fill used for painting glyphs.public void fillText(String text, float[] advances, Font font, float x, float y, Paint fill)
Adds a text string by filling interior of glyphs.
text - The text to add.advances - An array of glyphs width. It's length must comply with the number of glyphs in the string.font - The font that will be used to draw text.x - X coordinate for text origin.y - Y coordinate for text origin.fill - The fill used for painting glyphs.public void fillText(String text, com.aspose.foundation.drawing.DrFont drFont, float x, float y, Paint fill)
Adds a text string by filling interior of glyphs.
text - The text to add.drFont - DrFont that will be used to draw text. It can be used with custom font that is located in custom folder.x - X coordinate for text origin.y - Y coordinate for text origin.fill - The fill used for painting glyphs.public void fillText(String text, float[] advances, com.aspose.foundation.drawing.DrFont drFont, float x, float y, Paint fill)
Adds a text string by filling interior of glyphs.
text - The text to add.advances - An array of glyphs width. It's length must comply with the number of glyphs in the string.drFont - DrFont that will be used to draw text. It can be used with custom font that is located in custom folder.x - X coordinate for text origin.y - Y coordinate for text origin.fill - The fill used for painting glyphs.public void outlineText(String text, Font font, float x, float y)
Adds a text string by drawing glyphs contours.
text - The text to add.font - System font that will be used to draw text.x - X coordinate for text origin.y - Y coordinate for text origin.public void outlineText(String text, float[] advances, Font font, float x, float y)
Adds a text string by drawing glyphs contours.
text - The text to add.advances - An array of glyphs width. It's length must comply with the number of glyphs in the string.font - System font that will be used to draw text.x - X coordinate for text origin.y - Y coordinate for text origin.public void outlineText(String text, com.aspose.foundation.drawing.DrFont drFont, float x, float y)
Adds a text string by drawing glyphs contours.
text - The text to add.drFont - DrFont that will be used to draw text. It can be used with custom font that is located in custom folder.x - X coordinate for text origin.y - Y coordinate for text origin.public void outlineText(String text, float[] advances, com.aspose.foundation.drawing.DrFont drFont, float x, float y)
Adds a text string by drawing glyphs contours.
text - The text to add.advances - An array of glyphs width. It's length must comply with the number of glyphs in the string.drFont - DrFont that will be used to draw text. It can be used with custom font that is located in custom folder.x - X coordinate for text origin.y - Y coordinate for text origin.public void outlineText(String text, Font font, float x, float y, Paint outlinePaint, Stroke stroke)
Adds a text string by drawing glyphs contours.
text - The text to add.font - The font that will be used to draw text.x - X coordinate for text origin.y - Y coordinate for text origin.outlinePaint - The java.awt.Paint used for painting glyphs outlines. Can be any subclass of java.awt.Paint class in JDK.stroke - The stroke used for drawing glyphs contours.public void outlineText(String text, float[] advances, Font font, float x, float y, Paint outlinePaint, Stroke stroke)
Adds a text string by drawing glyphs contours.
text - The text to add.advances - An array of glyphs width. It's length must comply with the number of glyphs in the string.font - The font that will be used to draw text.x - X coordinate for text origin.y - Y coordinate for text origin.outlinePaint - The java.awt.Paint used for painting glyphs outlines. Can be any subclass of java.awt.Paint class in JDK.stroke - The stroke used for drawing glyphs contours.public void outlineText(String text, com.aspose.foundation.drawing.DrFont drFont, float x, float y, Paint outlinePaint, Stroke stroke)
Adds a text string by drawing glyphs contours.
text - The text to add.drFont - DrFont that will be used to draw text. It can be used with custom font that is located in custom folder.x - X coordinate for text origin.y - Y coordinate for text origin.outlinePaint - The java.awt.Paint used for painting glyphs outlines. Can be any subclass of java.awt.Paint class in JDK.stroke - The stroke used for drawing glyphs contours.public void outlineText(String text, float[] advances, com.aspose.foundation.drawing.DrFont drFont, float x, float y, Paint outlinePaint, Stroke stroke)
Adds a text string by drawing glyphs contours.
text - The text to add.advances - An array of glyphs width. It's length must comply with the number of glyphs in the string.drFont - DrFont that will be used to draw text. It can be used with custom font that is located in custom folder.x - X coordinate for text origin.y - Y coordinate for text origin.outlinePaint - The java.awt.Paint used for painting glyphs outlines. Can be any subclass of java.awt.Paint class in JDK.stroke - The stroke used for drawing glyphs contours.public void fillAndStrokeText(String text, Font font, float x, float y, Paint fillPaint, Paint strokePaint, Stroke stroke)
Adds a text string by filling interior of glyphs and drawing glyphs contours.
text - The text to add.font - System font that will be used to draw text.x - X coordinate for text origin.y - Y coordinate for text origin.fillPaint - The fill used for painting glyphs interior.strokePaint - The java.awt.Paint used for painting glyphs outlines. Can be any subclass of java.awt.Paint class in JDK.stroke - The stroke used for drawing glyphs contours.public void fillAndStrokeText(String text, float[] advances, Font font, float x, float y, Paint fillPaint, Paint strokePaint, Stroke stroke)
Adds a text string by filling interior of glyphs and drawing glyphs contours.
text - The text to add.
advances An array of glyphs width. It's length must comply with the number of glyphs in the string.font - System font that will be used to draw text.x - X coordinate for text origin.y - Y coordinate for text origin.fillPaint - The fill used for painting glyphs interior.strokePaint - The java.awt.Paint used for painting glyphs outlines. Can be any subclass of java.awt.Paint class in JDK.stroke - The stroke used for drawing glyphs contours.public void fillAndStrokeText(String text, com.aspose.foundation.drawing.DrFont drFont, float x, float y, Paint fillPaint, Paint strokePaint, Stroke stroke)
Adds a text string by filling interior of glyphs and drawing glyphs contours.
text - The text to add.drFont - DrFont that will be used to draw text. It can be used with custom font that is located in custom folder.x - X coordinate for text origin.y - Y coordinate for text origin.fillPaint - The fill used for painting glyphs interior.strokePaint - The java.awt.Paint used for painting glyphs outlines. Can be any subclass of java.awt.Paint class in JDK.stroke - The stroke used for drawing glyphs contours.public void fillAndStrokeText(String text, float[] advances, com.aspose.foundation.drawing.DrFont drFont, float x, float y, Paint fillPaint, Paint strokePaint, Stroke stroke)
Adds a text string by filling interior of glyphs and drawing glyphs contours.
text - The text to add.advances - An array of glyphs width. It's length must comply with the number of glyphs in the string.drFont - DrFont that will be used to draw text. It can be used with custom font that is located in custom folder.x - X coordinate for text origin.y - Y coordinate for text origin.fillPaint - The fill used for painting glyphs interior.strokePaint - The java.awt.Paint used for painting glyphs outlines. Can be any subclass of java.awt.Paint class in JDK.stroke - The stroke used for drawing glyphs contours.public void fill(Shape shape)
Fill an arbitrary path.
shape - The path to fill.public void draw(Shape shape)
Draw an arbitrary path.
shape - The path to fill.public void drawImage(BufferedImage image)
Draw an image.
image - The image to draw.public void drawImage(BufferedImage image, AffineTransform transform, Color bkg)
Draw transformed image with background.
image - The image to draw.transform - The matrix to transform image.bkg - The background for the image.public void drawTransparentImage(BufferedImage image, AffineTransform transform, int transparencyThreshold)
Draw transformed transparent image with background. If image doesn't have Alpha channel it will be drawn as opaque image.
image - The image to draw.transform - The matrix to transform image.transparencyThreshold - A threshold that defines from which value of transparency pixel will be interpreted as fully transparent. All values below this threshold will be interpreted as fully opaque.public void drawExplicitImageMask(BufferedImage image24bpp, BufferedImage alphaMask1bpp, AffineTransform transform)
Draw masked image.
image24bpp - The image to draw. Must be in 24bpp RGB image formatalphaMask1bpp - The image mask. Must be in 1bpp image format.transform - The matrix to transform image.public int getNumberOfPages()
Gets a quantity of pages in resulting PDF document.
@Deprecated public void merge(String[] filesForMerge, Device device, SaveOptions options) throws Exception
Merges PS/EPS files to a device.
filesForMerge - PS/EPS files for merging with this file to an output device.device - An output device.options - Contains flags that specify output of errors thrown during conversion.Exceptionpublic void mergeToPdf(String outPdfFilePath, String[] filesForMerge, SaveOptions options) throws Exception
Merges PS/EPS files to a device.
outPdfFilePath - An output PDF file path.filesForMerge - PS/EPS files for merging with this file to an output device.options - Contains flags that specify output of errors thrown during conversion.Exceptionpublic void mergeToPdf(OutputStream pdfStream, String[] filesForMerge, SaveOptions options) throws Exception
Merges PS/EPS files to a device.
pdfStream - An output PDF stream.filesForMerge - PS/EPS files for merging with this file to an output device.options - Contains flags that specify output of errors thrown during conversion.ExceptionCopyright © 2025 Aspose. All Rights Reserved.