xmlgraphics-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Smith <thomat...@gmail.com>
Subject Re: How to use native text with EPSDocumentGraphics2D?
Date Thu, 15 Mar 2012 13:17:42 GMT
Hi,
Rendering text as text is important because the output files get
unreasonably huge and slow otherwise.  This is a requirement for my
application, and I can't figure out how to do it with the Apache libraries.
 So I gave up on all y'all and found out that this is quite easy in FreeHEP.

    UserProperties p = new UserProperties();
    p.setProperty(PSGraphics2D.TEXT_AS_SHAPES,false);
    VectorGraphics g = new PSGraphics2D(new File("BLAH-freehep.ps"), new
Dimension(layout.getWidth(), layout.getHeight()));
    g.setProperties(p);
    g.startExport();
    g.drawString("Hi there", 50, 50);
    g.endExport();
    g.dispose();

Also, I tried to export to SVG through Batik (1.7) with SVGGraphics2D, and
when I did a drawString of a string with an apostrophe in it, it didn't
escape the apostrophe and so it produced SVG that Chrome refused to render.
 I wonder if there's an XSS vulnerability buried in there, improper
escaping is bad news.
-Thomas

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