翻譯|行業資訊|編輯:胡濤|2023-07-05 10:23:01.570|閱讀 121 次
概述:本文介紹了如何免費在線將 PUB Publisher 文件轉換為 JPG/JPEG 圖像,歡迎查閱!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.PUB 是靈活且易于使用的庫,可用于處理電子發布文件。它支持將流行的電子出版物文件格式(.pub)加載和轉換為PDF,并且無需任何軟件依賴性
Aspose API支持流行文件格式處理,并允許將各類文檔導出或轉換為固定布局文件格式和最常用的圖像/多媒體格式。
Microsoft Publisher PUB文件主要用于創建和編輯印刷出版物,例如小冊子、新聞通訊和傳單。雖然 Publisher 被廣泛使用,但它可能不像其他文件格式那樣普遍可訪問。將 PUB 文件轉換為廣泛支持的通用JPG (JPEG) 格式有幾個優點。因此,本文介紹了如何免費在線將 PUB Publisher 文件轉換為 JPG/JPEG 圖像。
此PUB 到 JPG 轉換器在線應用程序可用于免費將 Publisher 文件轉換為 JPG 圖像,無需安裝任何軟件或插件。
在線將 PUB 轉換為 JPG 為輕松共享 Publisher 文件打開了一個可能性的世界。
您的數據不會存儲在我們的服務器上,因此下載鏈接將在 24 小時后停止工作。
無論您需要向客戶發送小冊子、與同事分享時事通訊還是將傳單上傳到網站,將 PUB 文件轉換為廣泛支持的 JPG 格式都可以確保跨不同設備和平臺的無縫訪問。您可以輕松將此功能集成到您的應用程序中。
您可以按照以下步驟將 PUB 轉 JPG 圖像嵌入到 C# 應用程序中:
使用以下 NuGet 命令配置 Aspose.PUB for .NET 和 Aspose.PDF for .NET:
PM> Install-Package Aspose.Pdf
PM> Install-Package Aspose.PUB
以下代碼片段演示了如何在 C# 中將 PUB 轉換為 JPG:
// Declare MemoryStream class object MemoryStream stream = new MemoryStream(); var parser = PubFactory.CreateParser("Test.pub"); // Parse input PUB file with Parse method var doc = parser.Parse(); // Convert PUB to PDF file PubFactory.CreatePdfConverter().ConvertToPdf(doc, stream); Document document = new Document(stream); PdfFileInfo info = new PdfFileInfo(document); foreach (Page page in document.Pages) { int width = Convert.ToInt32(info.GetPageWidth(page.Number)); int height = Convert.ToInt32(info.GetPageHeight(page.Number)); // Create Resolution object Resolution resolution = new Resolution(300); // Create Jpeg device with specified Width, Height, and Resolution JpegDevice JpegDevice = new JpegDevice(width, height, resolution); // Convert the PUB file and save output JPEG image JpegDevice.Process(page, "Page" + page.Number + ".jpg"); }
您可以通過以下步驟在 Java 中將 PUB 圖像轉換為 JPG 圖像:
在您的環境中設置 Aspose.PUB for Java 和 Aspose.PDF for Java。
下面的代碼示例詳細說明了如何在 Java 中將 PUB 轉換為 JPG:
// Load input PUB file IPubParser parser = PubFactory.createParser("Test.pub"); Document doc = parser.parse(); // Convert PUB to PDF file PubFactory.createPdfConverter().convertToPdf(doc, "Test.pdf"); // Load the PDF file Document document = new Document("Test.pdf"); facades.PdfFileInfo info = new facades.PdfFileInfo(document); for (Page page : document.getPages()) { // Get page dimensions from the PDF document int width = (int) info.getPageWidth(page.getNumber()); int height = (int) (info.getPageHeight(page.getNumber())); // Set resolution for the output image devices.Resolution resolution = new devices.Resolution(300); // Create JPEG device with specified Width and Height devices.JpegDevice jpegDevice = new devices.JpegDevice(width, height , resolution); // Convert PUB to JPG image jpegDevice.process(page, "Page" + page.getNumber() + ".jpg"); }
您可以通過以下步驟在 C++ 應用程序中將 PUB 轉換為 JPG 圖像格式:
使用下面的 NuGet 安裝命令在您的應用程序中配置 Aspose.PUB for C++ 和 Aspose.PDF for C++ API。
PM> Install-Package Aspose.PUB.Cpp
PM> Install-Package Aspose.PDF.Cpp
下面的代碼片段解釋了如何在 C++ 中將 PUB 轉換為 JPG:
// Source PUB and output PDF file paths System::String filePub = u"SourceDirectory\\1.pub"; System::String filePdf = u"OutputDirectory\\1.pdf"; // Load the PUB file System::SharedPtr<IPubParser> parser = PubFactory::CreateParser(filePub); System::SharedPtr<Aspose::Pub::Document> document = parser->Parse(); // Convert the PUB file to PDF PubFactory::CreatePdfConverter()->ConvertToPdf(document, filePdf); // Load the generated PDF file auto pdfDocument = MakeObject<Aspose::Pdf::Document>(filePdf); auto info = MakeObject<Facades::PdfFileInfo>(pdfDocument); // Iterate through the PDF pages for (auto page : pdfDocument->get_Pages()) { // Get dimensions of the PDF page int width = info->GetPageWidth(page->get_Number()); int height = info->GetPageHeight(page->get_Number()); // Create an instance of the Resolution class auto resolution = MakeObject<Devices::Resolution>(300); // Create JPEG device with the specified Width, Height and Resolution auto device = MakeObject<Devices::JpegDevice>(width, height, resolution); // Create the File Stream for the output image System::SharedPtr<System::IO::FileStream> imageStream = System::IO::File::Create(String::Format(u"OutputDirectory\\page_{0}.jpg", page->get_Number())); // Convert the PDF page to JPG image device->Process(page, imageStream); // Close the stream imageStream->Close(); }
借助可靠的在線轉換工具,您現在可以快速輕松地將 PUB 文件轉換為 JPG。提供支持 。但是,您可以參考以下資源來探索使用 Microsoft Publisher 文件的許多其他功能。
我需要安裝任何軟件才能使用 PUB 到 JPG 在線轉換器嗎?
不需要,PUB 到 JPG 在線轉換器是一個基于 Web 的工具,您不需要安裝任何其他軟件或插件。只要您有互聯網連接,就可以使用各種設備上的網絡瀏覽器訪問它,包括計算機、筆記本電腦、平板電腦和智能手機。
PUB 到 JPG 在線轉換器如何工作?
該轉換器使用先進的算法來處理您的 PUB 文件并將其轉換為高質量的 JPG 圖像。只需將 PUB 文件上傳到轉換器,等待轉換過程完成,然后下載生成的 JPG 文件即可。
PUB 到 JPG 在線轉換器可以免費使用嗎?
是的,PUB 到 JPG 在線轉換器可以免費使用,您無需注冊或使用電子郵件或信用卡詳細信息登錄。
本文演示了如何在線將 PUB 轉換為 JPG 文件 ,要是您還有其他關于產品方面的問題,歡迎咨詢我們,或者加入我們官方技術交流群。
歡迎下載|體驗更多Aspose產品
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn