NET的DOC转换器
引入 DOC Converter for .NET
DOC Converter for .NET 是一个插件,允许开发人员将 PDF 文档转换为 Word 文件格式. 本指南提供了可用的功能的概述,并解释了如何使用代码示例进行常见任务。
转换文件
DOC Converter for .NET 支持将 PDF 文档转换为流行的文件格式,如 Word 文件。
var inputPath = Path.Combine(@"C:\Samples\", "sample.pdf");
var outputPath = Path.Combine(@"C:\Samples\", "sample.docx");
// Create an instance of the PdfDoc plugin.
var plugin = new PdfDoc();
// Create an instance of the PdfToDocOptions class.
var options = new PdfToDocOptions
{
SaveFormat = SaveFormat.DocX
};
// Add the input and output file paths to the options.
options.AddInput(new FileDataSource(inputPath));
options.AddOutput(new FileDataSource(outputPath));
// Process the PDF to Word conversion using the plugin and options.
var resultContainer = plugin.Process(options);
// Get the result from the result container.
var result = resultContainer.ResultCollection[0];
// Print the result.
Console.WriteLine(result);
支持的文件格式
DOC Converter for .NET 支持以下输入和输出文件格式:
- 输入:PDF
- 输出:DOC、DOKX
最佳实践与解决问题
在使用 DOC Converter for .NET 时,最好遵循最佳做法,以确保最佳性能,避免常见问题。
- 使用正确的文件路径和名称
- 指定正确的输入和输出文件格式
- 按需要定制转换选项