我有SVG从GSP传递到我的Grails Controller 。我将其渲染为pdf格式并保存文件。但是,没有附加样式。这是有道理的,因为样式是使用外部样式表完成的。
我的问题是是否可以在grails中使用蜡染使用样式表将样式添加到svg?
这是我的源代码:
String svg_URI_input = params.image
TranscoderInput input_svg_image = new TranscoderInput(svg_URI_input);
OutputStream pdf_ostream = new FileOutputStream("report.pdf");
TranscoderOutput output_pdf_file = new TranscoderOutput(pdf_ostream);
Transcoder transcoder = new PDFTranscoder();
transcoder.transcode(input_svg_image, output_pdf_file);
pdf_ostream.flush();
pdf_ostream.close();
File fd = new File("report.pdf")
我是新蜡染,找不到任何可以帮助我的教程示例。
解决方案如下:
要使用外部SVG,必须在SVG内容之前添加以下说明:<?xml-stylesheet type="text/css" href="http://ww.test.com/svgstyle.css" ?>