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 RE: PostScript files out of PDFBox seem to be bloated
Date Fri, 26 Aug 2016 19:57:37 GMT

Hi Tilman,

Thank you for the reply.  I don't see how that post was the same as mine and is answered.
 Forgive me.

That question was "What do I need to change to create a reasonably sized PostScript file?"
 The only answer that I see is that PostScript files are big by nature.

My question was, "Is there a way in PDFBox to have it put the text directly into the PostScript
file instead of passing it on as part of an image?"  Seems like a different question to me.
 Sorry if I am mistaken.


-----Original Message-----
From: Tilman Hausherr [mailto:THausherr@t-online.de] 
Sent: Friday, August 26, 2016 2:33 PM
To: users@pdfbox.apache.org
Subject: Re: PostScript files out of PDFBox seem to be bloated

Asked and answered in

Additionally, re the comment of Ken Sharp (who is a Ghostcript guy and thus has my maximum
respect): PDFBox is not a converter, it renders regardless of the target format.

In theory, it might be possible to make a converter, by replacing all graphics method calls
with postscript commands.


Am 26.08.2016 um 21:25 schrieb Clark, Raymond C:
> Hi,
> 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:
>               pdfGenerator.finishFileCreation();
>               DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
>               StreamPrintServiceFactory[] factories =
>                             StreamPrintServiceFactory.lookupStreamPrintServiceFactories(flavor,
>                                          DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType());
>               if (factories.length == 0) {
>                      throw new PrinterException("No PostScript factories available");
>               }
>               PDDocument document = pdfGenerator.getDocument();
>               PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
>               aset.add(MediaSizeName.NA_LETTER);
> //         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))
>                             aset.add(OrientationRequested.LANDSCAPE);
>                      } else {
>                             aset.add(OrientationRequested.PORTRAIT);
>                      }
>                      factories[0].getPrintService(fos).createPrintJob().print(
>                                   new SimpleDoc(new PDFPrintable(document, Scaling.ACTUAL_SIZE,
false), flavor, daset), aset);
>               }
>               fos.close();
>               document.close();
> Thank you,
> Ray
> ________________________________
> 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.

To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org

To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org

View raw message