pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bo Shi <bs1...@gmail.com>
Subject Re: No text output with RenderUtil.convertToImage on document with embedded font
Date Mon, 21 Oct 2013 17:36:16 GMT
Hi Andreas, the URL in the sample code* is exactly the PDF I was using to
test.  The sample provided is unchanged from what I was using to produce
the issue.  For what it's worth it appears to be a LaTeX generated PDF.
 Please excuse the duplicate line of logic.


*http://www.mathworks.com/**moler/random.pdf<http://www.mathworks.com/moler/random.pdf>


On Sun, Oct 20, 2013 at 11:22 PM, Andreas Lehmkuehler <andreas@lehmi.de>wrote:

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

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