Hi, Am 18.10.2013 03:49, schrieb Bo Shi:
Hi - was test driving the page rendering functionality in PDFBox when I ran across an interesting case. Here's the snippet to reproduce (Using PDFBox 2.0.0-SNAPSHOT, 10/9)package testdrive; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.util.RenderUtil; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.net.URL; public class Experiment { public static void main(String[] argv) throws Exception { PDDocument document = PDDocument.load( new URL("http://www.mathworks.com/moler/random.pdf")); PDPage p1 = (PDPage) document.getDocumentCatalog().getAllPages().get(0); RenderUtil.convertToImage(p1, BufferedImage.TYPE_INT_RGB, 150); BufferedImage image = RenderUtil.convertToImage(p1, BufferedImage.TYPE_INT_RGB, 150); ImageIO.write(image, "jpg", new File("/tmp/test.jpg")); ImageIO.write(image, "png", new File("/tmp/test.png")); } } The result are a blank page. It seems whatever kind of embedded font the PDF is using is not supported. I'm not getting any messages in stdout (that might be improperly configured logging). Is this a known issue? Any workarounds?
Sounds like a PDFbox issue. Did you try to render the pdf using the PDFReader coming with PDFBox? Can you provide us with the pdf in question? BTW: why are you calling convertToImage twice? Remove the first call to save some time and resources. BR Andreas Lehmkühler

