pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Murray-Rust <pm...@cam.ac.uk>
Subject Re: Extracting vector graphics from PDF
Date Mon, 07 May 2012 09:21:25 GMT
On Mon, May 7, 2012 at 10:10 AM, Andrey Kuznetsov <imagero@gmx.de> wrote:

> Hi Peter,****
>
> ** **
>
> did you tried to trace from where setFont() get called?****
>
> ** **
>
> Best Regards****
>
> ** **
>
> Andrey****
>
>
>
Andrey - this is very helpful of you - I hope you have time to comment on
the stack trace:

PDFSVGGraphics2D is my extended SVGGraphics engine
PDF2SVGReader.writePage(PDF2SVGReader.java:115) is given below


    at
org.xmlcml.graphics.pdf2svg.PDFSVGGraphics2D.setFont(PDFSVGGraphics2D.java:81)
    at
org.apache.pdfbox.pdmodel.font.PDSimpleFont.writeFont(PDSimpleFont.java:304)
    at
org.apache.pdfbox.pdmodel.font.PDSimpleFont.drawString(PDSimpleFont.java:114)
    at
org.apache.pdfbox.pdfviewer.PageDrawer.processTextPosition(PageDrawer.java:194)
    at
org.apache.pdfbox.util.PDFStreamEngine.processEncodedText(PDFStreamEngine.java:494)
    at
org.apache.pdfbox.util.operator.ShowTextGlyph.process(ShowTextGlyph.java:62)
    at
org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:551)
    at
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:274)
    at
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:251)
    at
org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:225)
    at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:107)
    at
org.xmlcml.graphics.pdf2svg.PDF2SVGReader.writePage(PDF2SVGReader.java:115)
    at
org.xmlcml.graphics.pdf2svg.PDF2SVGReader.readPDFFile(PDF2SVGReader.java:99)
    at
org.xmlcml.graphics.pdf2svg.PDF2SVGReader.main(PDF2SVGReader.java:210)
    at org.xmlcml.graphics.pdf.PDFReaderTest.testBMC(PDFReaderTest.java:16)

// writePage is hacked from PDFReader

     private void writePage(int pageNumber)
    {
        try        {
            // PMR
            PageDrawer drawer = new PageDrawer();
            PageWrapper wrapper = new PageWrapper( this );
            PDPage page = (PDPage)pages.get(pageNumber);
            wrapper.displayPage( page );
            PDRectangle cropBox = page.findCropBox();
            Dimension drawDimension = cropBox.createDimension();
            svgGraphics2D = this.createSVGGraphics();
            drawer.drawPage( svgGraphics2D, page, drawDimension );
            writeSVG(pageNumber);
        } catch (IOException exception) {
            exception.printStackTrace();
        }
    }




> **
>
> ** **
>
> --
Peter Murray-Rust
Reader in Molecular Informatics
Unilever Centre, Dep. Of Chemistry
University of Cambridge
CB2 1EW, UK
+44-1223-763069

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