Class PageExtractor

  • All Implemented Interfaces:
    DSCParserConstants

    public final class PageExtractor
    extends Object
    implements DSCParserConstants
    This class can extract a certain range of pages from a DSC-compliant PostScript file.
    • Method Detail

      • extractPages

        public static void extractPages​(InputStream in,
                                        OutputStream out,
                                        int from,
                                        int to)
                                 throws IOException,
                                        DSCException
        Parses a DSC-compliant file and pipes the content through to the OutputStream omitting all pages not within the range.
        Parameters:
        in - the InputStream to parse from
        out - the OutputStream to write the modified file to
        from - the starting page (1-based)
        to - the last page (inclusive, 1-based)
        Throws:
        IOException - In case of an I/O error
        DSCException - In case of a violation of the DSC spec