PdfFileMend

Inheritance: java.lang.Object, com.aspose.pdf.facades.IVentureLicenseTarget, com.aspose.pdf.facades.Facade, com.aspose.pdf.facades.SaveableFacade

public final class PdfFileMend extends SaveableFacade

Represents a class for adding texts and images on the pages of existing PDF document.

Constructors

ConstructorDescription
PdfFileMend()Constructor.
PdfFileMend(String inputFileName, String outputFileName)Constructor.
PdfFileMend(InputStream inputStream, OutputStream outputStream)Constructor.
PdfFileMend(System.IO.Stream inputStream, System.IO.Stream outputStream)Constructor.
PdfFileMend(IDocument document)Initializes new PdfFileMend object on base of the document .
PdfFileMend(IDocument document, String outputFileName)Initializes new PdfFileMend object on base of the document .
PdfFileMend(IDocument document, System.IO.Stream outputStream)Initializes new PdfFileMend object on base of the document .

Methods

MethodDescription
getInputStream()Gets the input stream.
setInputStream(InputStream value)Sets the input stream.
getOutputStream()Gets the output stream.
setOutputStream(OutputStream value)This method is Deprecated.
getInputFile()Gets the input file.
setInputFile(String value)
getOutputFile()Gets the output file.
setOutputFile(String value)Sets the output file.
setWordWrap(boolean value)Sets a bool value that indicates word wrap in AddText methods.
getWrapMode()Gets word wrapping algorithm.
setWrapMode(int value)Sets word wrapping algorithm.
getTextPositioningMode()Gets text positioning strategy.
setTextPositioningMode(int value)Sets text positioning strategy.
addImage(InputStream imageStream, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)Adds image to the specified page of PDF document at specified coordinates.
addImage(InputStream imageStream, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY, CompositingParameters compositingParameters)Adds image to the specified page of PDF document at specified coordinates.
addImage(InputStream imageStream, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)Adds image to the specified pages of PDF document at specified coordinates.
addImage(InputStream imageStream, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY, CompositingParameters compositingParameters)Adds image to the specified pages of PDF document at specified coordinates.
addImage(String imageName, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)Adds image to the specified page of PDF document at specified coordinates.
addImage(String imageName, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY, CompositingParameters compositingParameters)Adds image to the specified page of PDF document at specified coordinates.
addImage(String imageName, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)Adds image to the specified pages of PDF document at specified coordinates.
addImage(String imageName, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY, CompositingParameters compositingParameters)Adds image to the specified pages of PDF document at specified coordinates.
addText(FormattedText text, int pageNum, float lowerLeftX, float lowerLeftY)Not implemented.
addText(FormattedText text, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)Not implemented.
addText(FormattedText text, Integer[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)Not implemented.
close()Closes PdfFileMend object.
dispose()Closes PdfFileMend object.
save(String destFile)Saves the PDF document to the specified file.
save(OutputStream destStream)Saves the PDF document to the specified file.
getDocument()Gets the document PdfFileMend is working on.

PdfFileMend()

public PdfFileMend()

Constructor.

PdfFileMend(String inputFileName, String outputFileName)

public PdfFileMend(String inputFileName, String outputFileName)

Constructor.

Obsolete(“Use constructor without destination.”)

Parameters:

ParameterTypeDescription
inputFileNamejava.lang.StringInput PDF file name.
outputFileNamejava.lang.StringOutput PDF file name.

PdfFileMend(InputStream inputStream, OutputStream outputStream)

public PdfFileMend(InputStream inputStream, OutputStream outputStream)

Constructor. Obsolete(“Use constructor without destination.”)

Parameters:

ParameterTypeDescription
inputStreamjava.io.InputStreamInput PDF stream.
outputStreamjava.io.OutputStreamOutput PDF stream.

PdfFileMend(System.IO.Stream inputStream, System.IO.Stream outputStream)

public PdfFileMend(System.IO.Stream inputStream, System.IO.Stream outputStream)

Constructor.

Obsolete(“Use constructor without destination.”)

Parameters:

ParameterTypeDescription
inputStreamcom.aspose.ms.System.IO.StreamInput PDF stream.
outputStreamcom.aspose.ms.System.IO.StreamOutput PDF stream.

PdfFileMend(IDocument document)

public PdfFileMend(IDocument document)

Initializes new PdfFileMend object on base of the document .

Parameters:

ParameterTypeDescription
documentIDocumentPdf document.

PdfFileMend(IDocument document, String outputFileName)

public PdfFileMend(IDocument document, String outputFileName)

Initializes new PdfFileMend object on base of the document .

Obsolete(“Use constructor without destination.”)

Parameters:

ParameterTypeDescription
documentIDocumentPdf document.
outputFileNamejava.lang.StringOutput PDF file name.

PdfFileMend(IDocument document, System.IO.Stream outputStream)

public PdfFileMend(IDocument document, System.IO.Stream outputStream)

Initializes new PdfFileMend object on base of the document .

Obsolete(“Use constructor without destination.”)

Parameters:

ParameterTypeDescription
documentIDocumentPdf document.
outputStreamcom.aspose.ms.System.IO.StreamOutput PDF stream.

getInputStream()

public InputStream getInputStream()

Gets the input stream.

Returns: java.io.InputStream - input stream.

setInputStream(InputStream value)

public void setInputStream(InputStream value)

Sets the input stream.

Parameters:

ParameterTypeDescription
valuejava.io.InputStreaminput stream.

getOutputStream()

public OutputStream getOutputStream()

Gets the output stream.

Returns: java.io.OutputStream - output stream.

setOutputStream(OutputStream value)

public void setOutputStream(OutputStream value)

This method is Deprecated. Use Save(outputStream) method for getting facade results.

Parameters:

ParameterTypeDescription
valuejava.io.OutputStreamoutput stream.

getInputFile()

public String getInputFile()

Gets the input file.

Returns: java.lang.String - String value

setInputFile(String value)

public void setInputFile(String value)

Parameters:

ParameterTypeDescription
valuejava.lang.String

getOutputFile()

public String getOutputFile()

Gets the output file.

Returns: java.lang.String - String value

setOutputFile(String value)

public void setOutputFile(String value)

Sets the output file.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

setWordWrap(boolean value)

public void setWordWrap(boolean value)

Sets a bool value that indicates word wrap in AddText methods. If the value is true, the text in FormattedText will word wrap. By defalt, the value is false.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getWrapMode()

public int getWrapMode()

Gets word wrapping algorithm.

Returns: int - WordWrapMode value

setWrapMode(int value)

public void setWrapMode(int value)

Sets word wrapping algorithm.

Parameters:

ParameterTypeDescription
valueintWordWrapMode element

getTextPositioningMode()

public int getTextPositioningMode()

Gets text positioning strategy. PositioningMode Default mode is Legacy.

Returns: int - PositioningMode element

setTextPositioningMode(int value)

public void setTextPositioningMode(int value)

Sets text positioning strategy. PositioningMode Default mode is Legacy.

Parameters:

ParameterTypeDescription
valueintPositioningMode element

addImage(InputStream imageStream, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)

public boolean addImage(InputStream imageStream, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)

Adds image to the specified page of PDF document at specified coordinates.


PdfFileMend mendor = new PdfFileMend("example.pdf", "out_example.pdf");
 InputStream stream = new FileInputStream("picture.jpg"))
 mendor.addImage(stream, 1, 10, 10, 100, 100);
 mendor.close();

Parameters:

ParameterTypeDescription
imageStreamjava.io.InputStreamInput image stream.
pageNumintThe number of page that will receive the image.
lowerLeftXfloatThe lower left x of image rectangle.
lowerLeftYfloatThe lower left y of image rectangle.
upperRightXfloatThe upper right x of image rectangle.
upperRightYfloatThe upper right y of image rectangle.

Returns: boolean - True if success false otherwise.

addImage(InputStream imageStream, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY, CompositingParameters compositingParameters)

public boolean addImage(InputStream imageStream, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY, CompositingParameters compositingParameters)

Adds image to the specified page of PDF document at specified coordinates.


PdfFileMend mendor = new PdfFileMend("example.pdf", "out_example.pdf");
 InputStream stream = new FileInputStream("picture.jpg"))
 mendor.addImage(stream, 1, 10, 10, 100, 100, new CompositingParameters(BlendMode.Multiply);
 mendor.close();

Parameters:

ParameterTypeDescription
imageStreamjava.io.InputStreamInput image stream.
pageNumintThe number of page that will receive the image.
lowerLeftXfloatThe lower left x of image rectangle.
lowerLeftYfloatThe lower left y of image rectangle.
upperRightXfloatThe upper right x of image rectangle.
upperRightYfloatThe upper right y of image rectangle.
compositingParametersCompositingParametersThe graphics compositing parameters for the image.

Returns: boolean - True if success false otherwise.

addImage(InputStream imageStream, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)

public boolean addImage(InputStream imageStream, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)

Adds image to the specified pages of PDF document at specified coordinates.


PdfFileMend mendor = new PdfFileMend("example.pdf", "out_example.pdf");
 InputStream stream = new FileInputStream("picture.jpg")
     mendor.addImage(stream, new int[]{1, 2}, 10, 10, 100, 100);
 mendor.close();

Parameters:

ParameterTypeDescription
imageStreamjava.io.InputStreamInput image stream.
pageNumsint[]The numbers of pages that will receive the image.
lowerLeftXfloatThe lower left x of image rectangle.
lowerLeftYfloatThe lower left y of image rectangle.
upperRightXfloatThe upper right x of image rectangle.
upperRightYfloatThe upper right y of image rectangle.

Returns: boolean - True if success false otherwise.

addImage(InputStream imageStream, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY, CompositingParameters compositingParameters)

public boolean addImage(InputStream imageStream, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY, CompositingParameters compositingParameters)

Adds image to the specified pages of PDF document at specified coordinates.


PdfFileMend mendor = new PdfFileMend("example.pdf", "out_example.pdf");
 InputStream stream = new FileInputStream("picture.jpg")
     mendor.addImage(stream, new int[]{1, 2}, 10, 10, 100, 100, new CompositingParameters(BlendMode.Multiply);
 mendor.close();

Parameters:

ParameterTypeDescription
imageStreamjava.io.InputStreamInput image stream.
pageNumsint[]The numbers of pages that will receive the image.
lowerLeftXfloatThe lower left x of image rectangle.
lowerLeftYfloatThe lower left y of image rectangle.
upperRightXfloatThe upper right x of image rectangle.
upperRightYfloatThe upper right y of image rectangle.
compositingParametersCompositingParametersThe graphics compositing parameters for the images.

Returns: boolean - True if success false otherwise.

addImage(String imageName, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)

public boolean addImage(String imageName, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)

Adds image to the specified page of PDF document at specified coordinates.


PdfFileMend mendor = new PdfFileMend("example.pdf", "out_example.pdf");
 mendor.addImage("picture.jpg", 1, 10, 10, 100, 100);
 mendor.close();

Parameters:

ParameterTypeDescription
imageNamejava.lang.StringThe path of input image file.
pageNumintThe number of page that will receive the image.
lowerLeftXfloatThe lower left x of image rectangle.
lowerLeftYfloatThe lower left y of image rectangle.
upperRightXfloatThe upper right x of image rectangle.
upperRightYfloatThe upper right y of image rectangle.

Returns: boolean - True if success false otherwise.

addImage(String imageName, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY, CompositingParameters compositingParameters)

public boolean addImage(String imageName, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY, CompositingParameters compositingParameters)

Adds image to the specified page of PDF document at specified coordinates.


PdfFileMend mendor = new PdfFileMend("example.pdf", "out_example.pdf");
 mendor.addImage("picture.jpg", 1, 10, 10, 100, 100, new CompositingParameters(BlendMode.Multiply));
 mendor.close();

Parameters:

ParameterTypeDescription
imageNamejava.lang.StringThe path of input image file.
pageNumintThe number of page that will receive the image.
lowerLeftXfloatThe lower left x of image rectangle.
lowerLeftYfloatThe lower left y of image rectangle.
upperRightXfloatThe upper right x of image rectangle.
upperRightYfloatThe upper right y of image rectangle.
compositingParametersCompositingParametersThe graphics compositing parameters for the images.

Returns: boolean - True if success false otherwise.

addImage(String imageName, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)

public boolean addImage(String imageName, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)

Adds image to the specified pages of PDF document at specified coordinates.


PdfFileMend mendor = new PdfFileMend("example.pdf", "out_example.pdf");
 mendor.addImage("picture.jpg", 1, 10, 10, 100, 100);
 mendor.close();

Parameters:

ParameterTypeDescription
imageNamejava.lang.StringThe path of input image file.
pageNumsint[]The numbers of pages that will receive the image.
lowerLeftXfloatThe lower left x of image rectangle.
lowerLeftYfloatThe lower left y of image rectangle.
upperRightXfloatThe upper right x of image rectangle.
upperRightYfloatThe upper right y of image rectangle.

Returns: boolean - True if success false otherwise.

addImage(String imageName, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY, CompositingParameters compositingParameters)

public boolean addImage(String imageName, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY, CompositingParameters compositingParameters)

Adds image to the specified pages of PDF document at specified coordinates.


PdfFileMend mendor = new PdfFileMend("example.pdf", "out_example.pdf");
 mendor.addImage("picture.jpg", 1, 10, 10, 100, 100, new CompositingParameters(BlendMode.Multiply));
 mendor.close();

Parameters:

ParameterTypeDescription
imageNamejava.lang.StringThe path of input image file.
pageNumsint[]The numbers of pages that will receive the image.
lowerLeftXfloatThe lower left x of image rectangle.
lowerLeftYfloatThe lower left y of image rectangle.
upperRightXfloatThe upper right x of image rectangle.
upperRightYfloatThe upper right y of image rectangle.
compositingParametersCompositingParametersThe graphics compositing parameters for the images.

Returns: boolean - True if success false otherwise.

addText(FormattedText text, int pageNum, float lowerLeftX, float lowerLeftY)

public boolean addText(FormattedText text, int pageNum, float lowerLeftX, float lowerLeftY)

Not implemented.

Parameters:

ParameterTypeDescription
textFormattedTextFormattedText object.
pageNumintPage number.
lowerLeftXfloatLower left X coordinate.
lowerLeftYfloatLower left Y coordinate.

Returns: boolean - True in case text was successfully added.

addText(FormattedText text, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)

public boolean addText(FormattedText text, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)

Not implemented.

Parameters:

ParameterTypeDescription
textFormattedTextFormattedText object.
pageNumintPage number.
lowerLeftXfloatLower left X coordinate.
lowerLeftYfloatLower left Y coordinate.
upperRightXfloatUpper right X coordinate.
upperRightYfloatUpper right Y coordinate.

Returns: boolean - True in case text was successfully added.

addText(FormattedText text, Integer[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)

public boolean addText(FormattedText text, Integer[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY)

Not implemented.

Parameters:

ParameterTypeDescription
textFormattedTextFormattedText object.
pageNumsjava.lang.Integer[]Page numbers array.
lowerLeftXfloatLower left X coordinate.
lowerLeftYfloatLower left Y coordinate.
upperRightXfloatUpper right X coordinate.
upperRightYfloatUpper right Y coordinate.

Returns: boolean - True in case text was successfully added.

close()

public void close()

Closes PdfFileMend object.

dispose()

public void dispose()

Closes PdfFileMend object. This method is obsolete, use close() instead.

save(String destFile)

public void save(String destFile)

Saves the PDF document to the specified file.

Parameters:

ParameterTypeDescription
destFilejava.lang.StringThe destination file.

save(OutputStream destStream)

public void save(OutputStream destStream)

Saves the PDF document to the specified file.

Parameters:

ParameterTypeDescription
destStreamjava.io.OutputStreamThe destination stream.

getDocument()

public IDocument getDocument()

Gets the document PdfFileMend is working on.

Returns: IDocument - IDocument object