com.aspose.pdf.facades

Class PdfFileMend

  • All Implemented Interfaces:
    com.aspose.ms.System.IDisposable, IFacade, ISaveableFacade


    public final class PdfFileMend
    extends SaveableFacade

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

    • Constructor Detail

      • PdfFileMend

        public PdfFileMend()

        Constructor.

      • PdfFileMend

        @Deprecated
        public PdfFileMend(String inputFileName,
                                        String outputFileName)
        Deprecated. 

        Constructor.

        Obsolete("Use constructor without destination.")

        Parameters:
        inputFileName - Input PDF file name.
        outputFileName - Output PDF file name.
      • PdfFileMend

        @Deprecated
        public PdfFileMend(InputStream inputStream,
                                        OutputStream outputStream)
        Deprecated. 

        Constructor. Obsolete("Use constructor without destination.")

        Parameters:
        inputStream - Input PDF stream.
        outputStream - Output PDF stream.
      • PdfFileMend

        @Deprecated
        public PdfFileMend(com.aspose.ms.System.IO.Stream inputStream,
                                        com.aspose.ms.System.IO.Stream outputStream)
        Deprecated. 

        Constructor.

        Obsolete("Use constructor without destination.")

        Parameters:
        inputStream - Input PDF stream.
        outputStream - Output PDF stream.
      • PdfFileMend

        public PdfFileMend(IDocument document)

        Initializes new PdfFileMend object on base of the document.

        Parameters:
        document - Pdf document.
      • PdfFileMend

        @Deprecated
        public PdfFileMend(IDocument document,
                                        String outputFileName)
        Deprecated. 

        Initializes new PdfFileMend object on base of the document.

        Obsolete("Use constructor without destination.")

        Parameters:
        document - Pdf document.
        outputFileName - Output PDF file name.
      • PdfFileMend

        @Deprecated
        public PdfFileMend(IDocument document,
                                        com.aspose.ms.System.IO.Stream outputStream)
        Deprecated. 

        Initializes new PdfFileMend object on base of the document.

        Obsolete("Use constructor without destination.")

        Parameters:
        document - Pdf document.
        outputStream - Output PDF stream.
    • Method Detail

      • getInputStream

        public InputStream getInputStream()

        Gets the input stream.

        Returns:
        input stream.
      • setInputStream

        public void setInputStream(InputStream value)

        Sets the input stream.

        Parameters:
        value - input stream.
      • getOutputStream

        @Deprecated
        public OutputStream getOutputStream()
        Deprecated. 

        Gets the output stream.

        Returns:
        output stream.
      • setOutputStream

        @Deprecated
        public void setOutputStream(OutputStream value)
        Deprecated. 

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

        Parameters:
        value - output stream.
      • getInputFile

        @Deprecated
        public String getInputFile()
        Deprecated. 

        Gets the input file.

        Returns:
        String value
      • getOutputFile

        @Deprecated
        public String getOutputFile()
        Deprecated. 

        Gets the output file.

        Returns:
        String value
      • setOutputFile

        @Deprecated
        public void setOutputFile(String value)
        Deprecated. 

        Sets the output file.

        Parameters:
        value - String value
      • setWordWrap

        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:
        value - boolean value
      • getWrapMode

        public int getWrapMode()

        Gets word wrapping algorithm.

        Returns:
        WordWrapMode value
        See Also:
        WordWrapMode
      • setWrapMode

        public void setWrapMode(int value)

        Sets word wrapping algorithm.

        Parameters:
        value - WordWrapMode element
        See Also:
        WordWrapMode
      • getTextPositioningMode

        public int getTextPositioningMode()

        Gets text positioning strategy. PositioningMode Default mode is Legacy.

        Returns:
        PositioningMode element
        See Also:
        PositioningMode
      • setTextPositioningMode

        public void setTextPositioningMode(int value)

        Sets text positioning strategy. PositioningMode Default mode is Legacy.

        Parameters:
        value - PositioningMode element
        See Also:
        PositioningMode
      • addImage

        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:
        imageStream - Input image stream.
        pageNum - The number of page that will receive the image.
        lowerLeftX - The lower left x of image rectangle.
        lowerLeftY - The lower left y of image rectangle.
        upperRightX - The upper right x of image rectangle.
        upperRightY - The upper right y of image rectangle.
        Returns:
        True if success false otherwise.
      • addImage

        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:
        imageStream - Input image stream.
        pageNum - The number of page that will receive the image.
        lowerLeftX - The lower left x of image rectangle.
        lowerLeftY - The lower left y of image rectangle.
        upperRightX - The upper right x of image rectangle.
        upperRightY - The upper right y of image rectangle.
        compositingParameters - The graphics compositing parameters for the image.
        Returns:
        True if success false otherwise.
      • addImage

        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:
        imageStream - Input image stream.
        pageNums - The numbers of pages that will receive the image.
        lowerLeftX - The lower left x of image rectangle.
        lowerLeftY - The lower left y of image rectangle.
        upperRightX - The upper right x of image rectangle.
        upperRightY - The upper right y of image rectangle.
        Returns:
        True if success false otherwise.
      • addImage

        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:
        imageStream - Input image stream.
        pageNums - The numbers of pages that will receive the image.
        lowerLeftX - The lower left x of image rectangle.
        lowerLeftY - The lower left y of image rectangle.
        upperRightX - The upper right x of image rectangle.
        upperRightY - The upper right y of image rectangle.
        compositingParameters - The graphics compositing parameters for the images.
        Returns:
        True if success false otherwise.
      • addImage

        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:
        imageName - The path of input image file.
        pageNum - The number of page that will receive the image.
        lowerLeftX - The lower left x of image rectangle.
        lowerLeftY - The lower left y of image rectangle.
        upperRightX - The upper right x of image rectangle.
        upperRightY - The upper right y of image rectangle.
        Returns:
        True if success false otherwise.
      • addImage

        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:
        imageName - The path of input image file.
        pageNum - The number of page that will receive the image.
        lowerLeftX - The lower left x of image rectangle.
        lowerLeftY - The lower left y of image rectangle.
        upperRightX - The upper right x of image rectangle.
        upperRightY - The upper right y of image rectangle.
        compositingParameters - The graphics compositing parameters for the images.
        Returns:
        True if success false otherwise.
      • addImage

        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:
        imageName - The path of input image file.
        pageNums - The numbers of pages that will receive the image.
        lowerLeftX - The lower left x of image rectangle.
        lowerLeftY - The lower left y of image rectangle.
        upperRightX - The upper right x of image rectangle.
        upperRightY - The upper right y of image rectangle.
        Returns:
        True if success false otherwise.
      • addImage

        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:
        imageName - The path of input image file.
        pageNums - The numbers of pages that will receive the image.
        lowerLeftX - The lower left x of image rectangle.
        lowerLeftY - The lower left y of image rectangle.
        upperRightX - The upper right x of image rectangle.
        upperRightY - The upper right y of image rectangle.
        compositingParameters - The graphics compositing parameters for the images.
        Returns:
        True if success false otherwise.
      • addText

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

        Not implemented.

        Parameters:
        text - FormattedText object.
        pageNum - Page number.
        lowerLeftX - Lower left X coordinate.
        lowerLeftY - Lower left Y coordinate.
        Returns:
        True in case text was successfully added.
      • addText

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

        Not implemented.

        Parameters:
        text - FormattedText object.
        pageNum - Page number.
        lowerLeftX - Lower left X coordinate.
        lowerLeftY - Lower left Y coordinate.
        upperRightX - Upper right X coordinate.
        upperRightY - Upper right Y coordinate.
        Returns:
        True in case text was successfully added.
      • addText

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

        Not implemented.

        Parameters:
        text - FormattedText object.
        pageNums - Page numbers array.
        lowerLeftX - Lower left X coordinate.
        lowerLeftY - Lower left Y coordinate.
        upperRightX - Upper right X coordinate.
        upperRightY - Upper right Y coordinate.
        Returns:
        True in case text was successfully added.
      • close

        public void close()

        Closes PdfFileMend object.

        Specified by:
        close in interface IFacade
        Overrides:
        close in class Facade
      • dispose

        public void dispose()
        Closes PdfFileMend object.
        Specified by:
        dispose in interface com.aspose.ms.System.IDisposable
        Overrides:
        dispose in class Facade
      • save

        public void save(String destFile)

        Saves the PDF document to the specified file.

        Specified by:
        save in interface ISaveableFacade
        Overrides:
        save in class SaveableFacade
        Parameters:
        destFile - The destination file.
      • getDocument

        public IDocument getDocument()

        Gets the document PdfFileMend is working on.

        Overrides:
        getDocument in class Facade
        Returns:
        IDocument object