pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Kuznetsov" <imag...@gmx.de>
Subject AW: Extracting vector graphics from PDF
Date Mon, 07 May 2012 09:58:44 GMT
Hi Peter,

 

There are must be COSDictionary field called font (in PDSimpleFont).

Can you dump it and post here?

 

Andrey

 

 

 

Von: peter.murray.rust@googlemail.com
[mailto:peter.murray.rust@googlemail.com] Im Auftrag von Peter Murray-Rust
Gesendet: Montag, 7. Mai 2012 11:21
An: Andrey Kuznetsov
Cc: users@pdfbox.apache.org
Betreff: Re: Extracting vector graphics from PDF

 

 

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:8
1)
    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:1
94)
    at
org.apache.pdfbox.util.PDFStreamEngine.processEncodedText(PDFStreamEngine.ja
va: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:22
5)
    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 <tel:%2B44-1223-763069> 


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