C# PDF操作之-PDF转WORD
生活随笔
收集整理的這篇文章主要介紹了
C# PDF操作之-PDF转WORD
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
特別說明:需引用Aspose.PDF.dll
代碼案例:
OpenFileDialog openFileDialog1 = new OpenFileDialog(); //顯示選擇文件對話框openFileDialog1.Filter = "All files (*.*)|*.*|pdf files (*.pdf)|*.pdf";openFileDialog1.FilterIndex = 2;openFileDialog1.RestoreDirectory = true;if (openFileDialog1.ShowDialog() == DialogResult.OK){int index = openFileDialog1.FileName.LastIndexOf('\\');PdfHelper.dataDir = openFileDialog1.FileName.Substring(0, index) + "\\";//顯示文件路徑PdfHelper.dataName = openFileDialog1.FileName.Substring(index + 1, openFileDialog1.FileName.Length - index - 1);PdfHelper.Run();MessageBox.Show("結束");}?PdfHelper.cs幫助類:
class PdfHelper{public static string dataDir = "";public static string dataName = "";public static void Run(){// ExStart:PDFToDOC// The path to the documents directory.//string dataDir = //RunExamples.GetDataDir_AsposePdf_DocumentConversion();// Open the source PDF documentDocument pdfDocument = new Document(dataDir + dataName);// Save the file into MS document formatpdfDocument.Save(dataDir + "PDFToDOC_out.doc", SaveFormat.Doc);// ExEnd:PDFToDOC }}?
總結
以上是生活随笔為你收集整理的C# PDF操作之-PDF转WORD的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 路径规划算法1.3抽样算法——PRM与R
- 下一篇: PHP读取Excel和导出数据至Exce