翻譯|行業(yè)資訊|編輯:胡濤|2023-07-05 10:23:01.570|閱讀 128 次
概述:本文介紹了如何免費(fèi)在線將 PUB Publisher 文件轉(zhuǎn)換為 JPG/JPEG 圖像,歡迎查閱!
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.PUB 是靈活且易于使用的庫(kù),可用于處理電子發(fā)布文件。它支持將流行的電子出版物文件格式(.pub)加載和轉(zhuǎn)換為PDF,并且無需任何軟件依賴性
Aspose API支持流行文件格式處理,并允許將各類文檔導(dǎo)出或轉(zhuǎn)換為固定布局文件格式和最常用的圖像/多媒體格式。
Microsoft Publisher PUB文件主要用于創(chuàng)建和編輯印刷出版物,例如小冊(cè)子、新聞通訊和傳單。雖然 Publisher 被廣泛使用,但它可能不像其他文件格式那樣普遍可訪問。將 PUB 文件轉(zhuǎn)換為廣泛支持的通用JPG (JPEG) 格式有幾個(gè)優(yōu)點(diǎn)。因此,本文介紹了如何免費(fèi)在線將 PUB Publisher 文件轉(zhuǎn)換為 JPG/JPEG 圖像。
此PUB 到 JPG 轉(zhuǎn)換器在線應(yīng)用程序可用于免費(fèi)將 Publisher 文件轉(zhuǎn)換為 JPG 圖像,無需安裝任何軟件或插件。
在線將 PUB 轉(zhuǎn)換為 JPG 為輕松共享 Publisher 文件打開了一個(gè)可能性的世界。
您的數(shù)據(jù)不會(huì)存儲(chǔ)在我們的服務(wù)器上,因此下載鏈接將在 24 小時(shí)后停止工作。
無論您需要向客戶發(fā)送小冊(cè)子、與同事分享時(shí)事通訊還是將傳單上傳到網(wǎng)站,將 PUB 文件轉(zhuǎn)換為廣泛支持的 JPG 格式都可以確保跨不同設(shè)備和平臺(tái)的無縫訪問。您可以輕松將此功能集成到您的應(yīng)用程序中。
您可以按照以下步驟將 PUB 轉(zhuǎn) JPG 圖像嵌入到 C# 應(yīng)用程序中:
使用以下 NuGet 命令配置 Aspose.PUB for .NET 和 Aspose.PDF for .NET:
PM> Install-Package Aspose.Pdf
PM> Install-Package Aspose.PUB
以下代碼片段演示了如何在 C# 中將 PUB 轉(zhuǎn)換為 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 圖像轉(zhuǎn)換為 JPG 圖像:
在您的環(huán)境中設(shè)置 Aspose.PUB for Java 和 Aspose.PDF for Java。
下面的代碼示例詳細(xì)說明了如何在 Java 中將 PUB 轉(zhuǎn)換為 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++ 應(yīng)用程序中將 PUB 轉(zhuǎn)換為 JPG 圖像格式:
使用下面的 NuGet 安裝命令在您的應(yīng)用程序中配置 Aspose.PUB for C++ 和 Aspose.PDF for C++ API。
PM> Install-Package Aspose.PUB.Cpp
PM> Install-Package Aspose.PDF.Cpp
下面的代碼片段解釋了如何在 C++ 中將 PUB 轉(zhuǎn)換為 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(); }
借助可靠的在線轉(zhuǎn)換工具,您現(xiàn)在可以快速輕松地將 PUB 文件轉(zhuǎn)換為 JPG。提供支持 。但是,您可以參考以下資源來探索使用 Microsoft Publisher 文件的許多其他功能。
我需要安裝任何軟件才能使用 PUB 到 JPG 在線轉(zhuǎn)換器嗎?
不需要,PUB 到 JPG 在線轉(zhuǎn)換器是一個(gè)基于 Web 的工具,您不需要安裝任何其他軟件或插件。只要您有互聯(lián)網(wǎng)連接,就可以使用各種設(shè)備上的網(wǎng)絡(luò)瀏覽器訪問它,包括計(jì)算機(jī)、筆記本電腦、平板電腦和智能手機(jī)。
PUB 到 JPG 在線轉(zhuǎn)換器如何工作?
該轉(zhuǎn)換器使用先進(jìn)的算法來處理您的 PUB 文件并將其轉(zhuǎn)換為高質(zhì)量的 JPG 圖像。只需將 PUB 文件上傳到轉(zhuǎn)換器,等待轉(zhuǎn)換過程完成,然后下載生成的 JPG 文件即可。
PUB 到 JPG 在線轉(zhuǎn)換器可以免費(fèi)使用嗎?
是的,PUB 到 JPG 在線轉(zhuǎn)換器可以免費(fèi)使用,您無需注冊(cè)或使用電子郵件或信用卡詳細(xì)信息登錄。
本文演示了如何在線將 PUB 轉(zhuǎn)換為 JPG 文件 ,要是您還有其他關(guān)于產(chǎn)品方面的問題,歡迎咨詢我們,或者加入我們官方技術(shù)交流群。
歡迎下載|體驗(yàn)更多Aspose產(chǎn)品
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@ke049m.cn