使用PdfFormatProvider
RadWordsProcessing提供了一个PdfFormatProvider类,该类允许您导出RadFlowDocumentPDF。
你所要做的就是使用PdfFormatProvider是向下面列出的程序集添加引用:
- Telerik.Windows.Documents.Core.dll
- Telerik.Windows.Documents.Flow.dll
- Telerik.Windows.Zip.dll
- Telerik.Windows.Documents.Flow.FormatProviders.Pdf.dll
- Telerik.Windows.Documents.Fixed.dll
出口
为了将文档导出为PDF格式,您需要使用Export ()的方法PdfFormatProvider.
的net标准规范没有定义获取特定字体的api。PdfFormatProvider需要访问字体数据,以便读取它并将其添加到PDF文件中。的实现,以允许库创建和使用字体FontsProviderBase类,并将此实现设置为FontsProvider的属性FixedExtensibilityManager.有关详细信息,请查看跨平台的支持篇文章。
net标准:为了导出不同的图像Jpeg而且如Jpeg2000或了不同于High, theJpegImageConverter属性。FixedExtensibilityManager必须设置。的FixedExtensibilityManager中查看更多信息PdfProcessing的跨平台支持
中的代码片段示例1控件创建PdfFormatProvider实例并使用它导出RadFlowDocument到一个文件。
RadWordsProcessing的PdfFormatProvider类位于Telerik.Windows.Documents.Flow.FormatProviders.Pdf名称空间.
例1:导出为PDF文件
Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider提供商= new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();使用(流输出= File.OpenWrite("sample.pdf")) {RadFlowDocument文档= CreateRadFlowDocument();提供者。出口(document, output); }
该方法的结果是一个可以在任何支持PDF文档的应用程序中打开的文档。
示例2控件的内容RadFlowDocument到一个RadFIxedDocument.
例2:导出到RadFixedDocument
RadFlowDocument文档= CreateRadFlowDocument();Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider提供商= new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();RadFixedDocument fixedDocument = provider.ExportToFixedDocument(document);
RadFixedDocument类的基类RadPdfProcessing图书馆。关于这个库及其功能的更多信息可以在这里找到在这里.