pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bo Shi <bs1...@gmail.com>
Subject No text output with RenderUtil.convertToImage on document with embedded font
Date Fri, 18 Oct 2013 01:49:40 GMT
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

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