pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clark, Raymond C" <Raymond.C.Cl...@ehi.com>
Subject PostScript files out of PDFBox seem to be bloated
Date Fri, 26 Aug 2016 19:25:32 GMT

I am using PDFBox to create PDFs and that is working great.  I need to take those PDF files
and produce PostScript files from them.  I can do that but the file is bloated.  I am creating
the content streams with compress = true.  It seems to be that the following code is producing
the PS file as an image of the page instead of extracting the text and images and coding that
as a PostScript file.  Is it possible to use PDFBox to create a PostScript file with the text
in it instead of an image of the page?

This is a snippet of the code I am using to create the PostScript file:

             DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
             StreamPrintServiceFactory[] factories =
             if (factories.length == 0) {
                    throw new PrinterException("No PostScript factories available");
             PDDocument document = pdfGenerator.getDocument();

             PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
//         aset.add(Sides.DUPLEX);

             DocAttributeSet daset = new HashDocAttributeSet();
//           daset.add(Compression.GZIP);

             FileOutputStream fos = new FileOutputStream(filePathAndName);
             Map<Integer, String> pageLayoutMap = pdfGenerator.getPageLayoutMap();
             for (int i = 1; i <= document.getNumberOfPages(); i++) {
                    aset.add(new PageRanges(i, i));
                    if (pageLayoutMap.get(i).equals(PDFGenerator.ORIENTATION_LANDSCAPE)) {
                    } else {
                                 new SimpleDoc(new PDFPrintable(document, Scaling.ACTUAL_SIZE,
false), flavor, daset), aset);

Thank you,


CONFIDENTIALITY NOTICE: This e-mail and any files transmitted with it are intended solely
for the use of the individual or entity to whom they are addressed and may contain confidential
and privileged information protected by law. If you received this e-mail in error, any review,
use, dissemination, distribution, or copying of the e-mail is strictly prohibited. Please
notify the sender immediately by return e-mail and delete all copies from your system.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message