Hi,

Am 23.05.2012 15:31, schrieb Lucas Satabin:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

I am using pdfbox to convert pages from pdf files generated by pdflatex
to png files and I ran into a problem that was resolved in the past:
since the last update of my LaTeX distribution (texlive), pages
converted to png (or jpeg as well) are empty (only transparent image in
png, or black image in jpeg).
Sounds like a font issue ... and yes there are still some unresolved issues.

I used to work with pdfTeX-1.40.10 with which pdfbox worked like a charm
(see attached files pdf-ok.pdf and pdf-ok1.png) and since the update I
am using  pdfTeX-1.40.12 and the same code does not work anymore (see
attached files pdf-nok.pdf and pdf-nok1.png).
Your attachments didn't make it due to some restrictions. Please create
an issue on JIRA [1] and attach those examples to it.

The code snippet I used for this is the following:

import java.awt.image.BufferedImage;
import java.io.File;

import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.util.PDFImageWriter;

public class Test {
   public static void main(String[] args) throws Exception {
     PDDocument docOk = PDDocument.load(new File("pdf-ok.pdf"));
     PDDocument docNok = PDDocument.load(new File("pdf-nok.pdf"));

     PDFImageWriter imagewriter = new PDFImageWriter();
     try {
       imagewriter.writeImage(docOk, "png", null, 1, 1, "pdf-ok",
BufferedImage.TYPE_INT_RGB, 100);
       imagewriter.writeImage(docNok, "png", null, 1, 1, "pdf-nok",
BufferedImage.TYPE_INT_RGB, 100);
     } finally {
       docOk.close();
       docNok.close();
     }
   }
}

I tried this with both version 1.6.0 and 1.7.0-SNAPSHOT from the trunk I
checked out today. The result is the same with both versions.
Am I doing something wrong?

I looked for this problem on the Internet and as far as I understood,
this problem was fixed in version 1.6.0 (correct me if I misunderstood it).
I also heard about jai_imageio in different places, but I am not really
excited about using it in my code...
So is this a problem in my code or a bug in pdfbox while handling this pdf?

Thank you in advance for any hint!

Regards,
Lucas

BR
Andreas Lehmkühler

[1] https://issues.apache.org/jira/browse/PDFBOX

Reply via email to