You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "T. Groch" <t....@gmail.com> on 2010/11/25 08:00:14 UTC

Make the jar smaller?

Hi,

I just use PDFbox to edit some PDFs and I have some problems with the
filesize. Is it somehow possible to shrink it? I don't know which files I
can delete.
My own code generally looks like this:

PDDocument doc = PDDocument.load(fileFoo);
List<PDPage> list = doc.getDocumentCatalog().getAllPages();
PDPage page = (PDPage) list.get(0);
PDFont font = PDType1Font.HELVETICA_BOLD;
PDPageContentStream cs = new PDPageContentStream(doc, page, true, true);
cs.setFont(font, 8);
cs.beginText();
cs.moveTextPositionByAmount(140, 754);
cs.drawString("Foo");
cs.endText();
cs.close();
doc.save(sPathToOutputPDF + sPDFFilenamePrefix + sPDFFilenamePostfix +
".pdf");

So, I don't think I use much of PDFbox' capabilities. My program is on a LAN
server, so that all users can access it. And the 10 mb make it really slow.
Thanks in advance.

Best regards,

Tobias