翻譯|使用教程|編輯:胡濤|2022-09-26 11:23:13.983|閱讀 214 次
概述:本文主要介紹了如何在 C# 中從 PDF 讀取條形碼,歡迎查閱!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.Note 是一款處理Microsoft Office OneNote文件的類庫。它允許開發人員在C#、VB.NET、ASP.NET web應用、web服務和Windows應用中中處理.one文件。它能夠打開文件并操作OneNote元素,從文本、圖像和屬性到更多復雜元素,然后到處PNG、GIF、JPEG、BMP或PDF格式。
PDF允許共享和打印文檔而不會丟失格式,這使其成為最流行的格式。在某些情況下,我們可能需要將 PDF 文檔的內容導入到 OneNote 文檔中。OneNote允許以筆記、繪圖、屏幕剪輯和音頻評論的形式收集、組織和協作自由形式的信息和多用戶協作。在本文中,我們將學習如何在 C# 中將 PDF 轉換為 OneNote。
要將 PDF 文檔轉換為 OneNote,我們將使用Aspose.Note for .NET API。它允許在不使用 Microsoft OneNote 的情況下以編程方式創建、閱讀和轉換 OneNote 文檔。它還允許將 PDF 文檔中的內容導入 OneNote 文檔。
API的Document類代表一個 OneNote 文檔。此類的Import()方法從提供的 PDF 文檔中導入一組頁面。Save()方法將OneNote 文檔保存到文件中。我們可以使用Merge()方法將一組頁面合并到文檔中。API的PdfImporter類使我們能夠從 PDF 格式的文檔中導入內容。您還可以在API 參考中閱讀更多關于類和方法的信息。
請下載 API 的 DLL或使用NuGet安裝它。
PM> Install-Package Aspose.Note
我們可以按照以下步驟輕松將任何 PDF 文檔轉換為 OneNote 文檔:
以下代碼示例展示了如何使用 C# 將 PDF 轉換為 OneNote 文檔。
// This code example demonstrates how to convert a PDF to a OneNote document. // Initialize a Document var document = new Document(); // Import a PDF document document.Import(@"C:\Files\sample.pdf"); // Save as OneNote document.Save(@"C:\Files\sample_from_PDF.one");
我們還可以按照以下步驟將多個 PDF 文件導入或轉換為單個 OneNote 文檔:
以下代碼示例展示了如何使用 C# 將多個 PDF 文件轉換為 OneNote 文檔。
// This code example demonstrates how to convert Multiple PDF files to a OneNote document. // Initialize a Document var document = new Document(); // Import multiple PDF documents document.Import(@"C:\Files\SampleText.pdf") .Import(@"C:\Files\SampleImage.pdf") .Import(@"C:\Files\SampleTable.pdf"); // Save as OneNote document.Save(@"C:\Files\Import_multiple_PDFs.one");
我們可以按照以下步驟將 PDF 文檔作為一頁導入 OneNote:
以下代碼示例展示了如何使用 C# 將每個 PDF 文檔插入到單個 OneNote 頁面。
// This code example demonstrates how to import every PDF on a single page in a OneNote document. // Initialize a Document var document = new Document(); // Initialize PDF importOptions var importOptions = new PdfImportOptions(); // Define MergeOptions var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 }; // Import multiple PDF documents document.Import(@"C:\Files\SampleText.pdf", importOptions, mergeOptions) .Import(@"C:\Files\SampleImage.pdf", importOptions, mergeOptions) .Import(@"C:\Files\SampleTable.pdf", importOptions, mergeOptions); // Save as OneNote document.Save(@"C:\Files\Pdf_as_single_OneNote_page.one");
我們可以從 PDF 文檔中導入所有頁面,并按照以下步驟在 OneNote 中合并所選頁面:
以下代碼示例顯示如何使用 C# 將 PDF 中的所有頁面(將 5 個頁面分組到單個 OneNote 頁面)導入。
// This code example demonstrates how to import all pages from PDF grouping 5 pages into a single OneNote page. // Initialize a Document var document = new Document(); // Define MergeOptions var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 }; // Get collection of pages from a PDF IEnumerable<Page> pages = PdfImporter.Import(@"C:\Files\SampleGrouping.pdf"); while (pages.Any()) { // Merge 5 pages document.Merge(pages.Take(5), mergeOptions); pages = pages.Skip(5); } // Save as OneNote document.Save(@"C:\Files\Note\sample_CustomMerge.one");
以上便是如何在 C# 中從 PDF 讀取條形碼 ,要是您還有其他關于產品方面的問題,歡迎咨詢我們,或者加入我們官方技術交流群。
歡迎下載|體驗更多Aspose產品
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn