Class ReplaceImage


  • public class ReplaceImage
    extends Object
    Utility class to replace images in PDF files in order to decrease the final size of the same file.
    • Constructor Detail

      • ReplaceImage

        public ReplaceImage()
    • Method Detail

      • main

        public static void main​(String[] args)
                         throws com.itextpdf.text.DocumentException,
                                IOException
        Throws:
        com.itextpdf.text.DocumentException
        IOException
      • manipulatePdf

        public void manipulatePdf​(String src,
                                  String dest)
                           throws com.itextpdf.text.DocumentException,
                                  IOException
        Throws:
        com.itextpdf.text.DocumentException
        IOException
      • makeBlackAndWhitePng

        public static com.itextpdf.text.Image makeBlackAndWhitePng​(com.itextpdf.text.pdf.parser.PdfImageObject image)
                                                            throws IOException,
                                                                   com.itextpdf.text.DocumentException
        Throws:
        IOException
        com.itextpdf.text.DocumentException
      • replaceStream

        public static void replaceStream​(com.itextpdf.text.pdf.PRStream orig,
                                         com.itextpdf.text.pdf.PdfStream stream)
                                  throws IOException
        Throws:
        IOException