pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Wilson <williamstonconsult...@gmail.com>
Subject Re: insufficient data for an image
Date Fri, 01 Oct 2010 19:54:23 GMT
As begun at
http://www.experts-exchange.com/Programming/Languages/Java/Q_26515004.html...

Can you create an issue in JIRA with this *and include* both the image
you're using and the PDF you're getting?

Thanks.

Daniel


On Fri, Oct 1, 2010 at 2:29 PM, Grant Overby <grant@floorsoft.com> wrote:

> 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
>

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