I am using PDFBox to create PDFs and that is working great. I also have a need to create PostScript files which I would like to generate from the PDF I create. I am using the following code to have PDFBox work with SimpleDoc to create the PostScript file. That is working but the file is massive. A 30KB PDF produces a 2meg PostScript file. What do I need to change to create a reasonably sized PostScript file?
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(MediaSizeName.NA_LETTER);
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);
}
StreamPrintService sps = factories[0].getPrintService(fos);
DocPrintJob dpj = sps.createPrintJob();
SimpleDoc sd = new SimpleDoc(new PDFPrintable(document, Scaling.ACTUAL_SIZE, false), flavor, null);
factories[0].getPrintService(fos).createPrintJob().print(
new SimpleDoc(new PDFPrintable(document, Scaling.ACTUAL_SIZE, false), flavor, daset), aset);
}
fos.close();
document.close();
Thank you