1 | $ java org.apache.fop.fonts.apps.TTFReader C:\windows\fonts\Arialuni.ttf arialuni.xml |
1 2 3 4 5 6 7 | <font metrics-file="C:/temp/font/arialuni/arialuni.xml" embed-file="C:/windows/Fonts/arialuni.ttf" kerning="yes"> <font-triplet name="arialuni" style="normal" weight="normal"/> <font-triplet name="arialuni" style="normal" weight="bold"/> <font-triplet name="arialuni" style="italic" weight="normal"/> <font-triplet name="arialuni" style="italic" weight="bold"/> </font> |
1 2 3 4 5 6 7 8 | <configuration> <pdf-fonts> <userconfig name="pdf-unicode" path="font\userconfig.xml" enabled="false" comment="for Unicode Font"/> </pdf-fonts> </configuration> |
1 2 3 4 5 6 7 8 9 | ... try { File userConfigFile = new File("userconfig.xml"); org.apache.fop.apps.Options options = new org.apache.fop.apps.Options(userConfigFile); } catch (FOPException fe) { fe.printStackTrace(); } ... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | public class SampleXslFoAction extends Action { private String xmlUsed = "/xml/sample_transform.xml"; //default private String successFwd = "success"; //default public org.apache.struts.action.ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { //************************** // make user selections //************************** decideSuccessFwd(request); decideXmlUsed(request); //******************* // Construct XML //******************* Document doc = null; try { String fileName = request.getRealPath(xmlUsed); FileInputStream fis = new FileInputStream(fileName); doc = new SAXBuilder().build(fis); } catch (Exception ex) { ex.printStackTrace(); } saveDocument(request, doc); //**************************** // process PDF doc view option //**************************** if(request.getParameter("viewformat").equalsIgnoreCase("download")){ response.setContentType("application/pdf"); response.setHeader("Content-Disposition", "attachment;filename=pdfdoc.pdf"); } //************************** //Go forward rendering it //************************** return mapping.findForward(successFwd); } ... } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |