用C#语言开发,希望能提一些原理或思路,以及开发过程中要用到的一些资源,有源码能提供的最好.这关系到小弟我的毕业问题,我将大力散分啊.
------解决方案--------------------------------------------------------
用Ghostscript好像可以,具体没做过,跟你一起问。
------解决方案--------------------------------------------------------
没具体做 不过 思路上
应该是 将xml 导入 为 word
然后 将word转换为 pdf
Word转换PDF格式
http://blog.csdn.net/lybid2002/articles/491441.aspx
------解决方案--------------------------------------------------------
不知道你到底要做什么?打印出来?
我就会activereport
------解决方案--------------------------------------------------------
xml就是数据源了.弄个pdf报表.看你用什么报表了.其他的没用过,只熟悉activereport
------解决方案--------------------------------------------------------
二. 从XML到PDF
对于一个具有一定模板性质的XML文件,我们可以用FOP API来实现其到PDF的转换.
FOP需要fop.jar. 我们可以到http://xml.apache.org/fop/ 上获取和了解其用法.
以一个一般复杂的XML文件为例:
要转换XML文档 test.xml 如下:
<FeatureSRS title= "SRS ">
<introduction>
<objective> objective here </objective>
<scope> scope here </scope>
<responsibilities> responsibilities here </responsibilities>
<references> reference here </references>
<DAA>
<term>
term here
</term>
<definition>
definition here
</definition>
</DAA>
</introduction>
<generalDescription>
<featureName>
<summary> summary here </summary>
<breakdown> breakdown here </breakdown>
</featureName>
<requirement>
<content>
content here.
</content>
</requirement>
<requirement>
<content>
content2 here.
</content>
</requirement>
<featureInteractions> featureInteractions here </featureInteractions>
</generalDescription>
<strResources>
<strResource>
<estring>
estring here
</estring>
<resourceid>
resourceid here
</resourceid>
<rqmt>
rqmt here.
</rqmt>
</strResource>
</strResources>
</FeatureSRS>
对于这样一个XML文档,我们要将其转化成PDF格式必须建立一个XSL-FO文件,来定义对各element和value格
式的转换.
------解决方案--------------------------------------------------------
我们建立XSL-FO文件 test.xsl 如下:
<?xml version= "1.0 " encoding= "UTF-8 "?>
<xsl:stylesheet version= "1.1 " xmlns:xsl= "http://www.w3.org/1999/XSL/Transform " xmlns:fo= "http://www.w3.org/1999/XSL/Format " exclude-result-prefixes= "fo ">
<xsl:output method= "xml " version= "1.0 " omit-xml-declaration= "no " indent= "yes "/>
<!-- ========================= -->
<!-- root element: projectteam -->
<!-- ========================= -->
<xsl:template match= "FeatureSRS ">
<fo:root xmlns:fo= "http://www.w3.org/1999/XSL/Format ">
<fo:layout-master-set>
<fo:simple-page-master master-name= "simpleA4 " page-height= "29.7cm " page-width= "21cm " margin-top= "2cm " margin-bottom= "2cm " margin-left= "2cm " margin-right= "2cm ">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference= "simpleA4 ">