When I open a pdf generated with pdfbox with adobe, I get the following
error:  insufficient data for an image .

I'm using this code (stripped down version) to create the pdf.

PDDocument pdDocument = new PDDocument();
BufferedImage image = myObject.toBufferedImage();
PDPage pdPage = new PDPage(new PDRectangle(image.getWidth() + border * 2,
image.getHeight() + border * 2));
pdPage.setRotation(myObject.getRotation());
contentStream = new PDPageContentStream(pdDocument,pdPage,false,false);
contentStream.drawImage(new PDJpeg(pdDocument,image),border,border);
pdDocument.addPage(pdPage);
pdDocument.save(outputStream = new FileOutputStream(file));


Any ideas about what I'm doing wrong?

--
Grant Overby
Senior Developer
FloorSoft, Inc.

Often people, especially computer engineers, focus on the machines. They
think, "By doing this, the machine will run faster. By doing this, the
machine will run more effectively. By doing this, the machine will something
something something." They are focusing on machines. But in fact we need to
focus on humans, on how humans care about doing programming or operating the
application of the machines. We are the masters. They are the slaves. --
Yukihiro Matsumoto

Reply via email to