I am using the saveToSvg method of the Slide and then I am writing those SVG files out to a PDF using iText + batik. Although the PDF generation is successful I am getting the following stacktrace:
The attribute “font-family” represents an invalid CSS value (“1”).
Original message:
The “font-family” property does not support integer values.
***** CSSEngine: exception property.syntax.error:org.w3c.dom.DOMException: The “font-family” property does not support integer values.
AttrValue:1
Exception:org.w3c.dom.DOMException
org.w3c.dom.DOMException: The “font-family” property does not support integer values.
at org.apache.batik.css.engine.value.AbstractValueFactory.createInvalidLexicalUnitDOMException(Unknown Source)
at org.apache.batik.css.engine.value.css2.FontFamilyManager.createValue(Unknown Source)
at org.apache.batik.css.engine.CSSEngine$1.property(Unknown Source)
at org.apache.batik.css.engine.CSSEngine.getCascadedStyleMap(Unknown Source)
at org.apache.batik.css.engine.CSSEngine.getComputedStyle(Unknown Source)
at org.apache.batik.bridge.CSSUtilities.getComputedStyle(Unknown Source)
at org.apache.batik.bridge.CSSUtilities.convertDisplay(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
at org.apache.batik.transcoder.print.PrintTranscoder.transcode(Unknown Source)
at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
at org.apache.batik.transcoder.print.PrintTranscoder.print(Unknown Source)
at com.vanguard.etf.util.PDFGenerator.main(PDFGenerator.java:56)
I looked at the SVG file and there are nodes that have the following attribute:
font-family="1"
So I am wondering if
a) the saveToSvg method is writing invalid SVG markup
b) This has nothing to do with Aspose and I need to track it down on the batik level
Here is the code I am using to generate the PDF
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(“image.test.pdf”));
document.open();
int width = 800;
int height = 600;
PdfContentByte cb = writer.getDirectContent();
PdfTemplate template = cb.createTemplate(width,height);
Graphics2D g2 = template.createGraphics(width,height);
PrintTranscoder prm = new PrintTranscoder();
TranscoderInput ti = new TranscoderInput(“520.svg”);
prm.transcode(ti, null);
PageFormat pg = new PageFormat();
Paper pp= new Paper();
// bunch of paper options here
ImgTemplate img = new ImgTemplate(template);
document.add(img);
document.close();
Thanks for the tipcs
font-family property should have font name like “Arial”, “Times New Roman” etc.
Thank you for the report, we will check why it happens in Java version.