Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
以下代码片段也适用于 Aspose.PDF.Drawing 库。
有时您可能会有现有的 XML 文件,其中包含应用程序数据,您希望使用这些文件生成 PDF 报告。您可以使用 XSLT 将现有的 XML 文档转换为 Aspose.Pdf 兼容的 XML 文档,然后生成 PDF 文件。使用 XML 和 XSLT 生成 PDF 有 3 个步骤。
请按照以下步骤使用 XSLT 将 XML 文件转换为 PDF 文档:
<?xml version="1.0" encoding="utf-8" ?>
<Contents>
<Content>Hello World!</Content>
</Contents>
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="text()"/>
<xsl:template match="/Contents">
<html>
<Document xmlns="Aspose.Pdf" IsAutoHyphenated="false">
<PageInfo>
<DefaultTextState
Font = "Helvetica" FontSize="8" LineSpacing="4"/>
<Margin Left="5cm" Right="5cm" Top="3cm" Bottom="15cm" />
</PageInfo>
<Page id="mainSection">
<TextFragment>
<TextSegment>
<xsl:value-of select="Content"/>
</TextSegment>
</TextFragment>
</Page>
</Document>
</html>
</xsl:template>
</xsl:stylesheet>
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.