![Convert PUB to PNG Online | Free Publisher to PNG Converter](images/convert-pub-to-png-online.jpg#center)
Microsoft Publisher 使用 PUB 文件格式來存儲專業外觀的市場材料,如小冊子、傳單、通訊、海報和名片。在處理 Microsoft Publisher (PUB) 文件時,有時您可能需要將這些文件轉換為像 PNG 這樣的圖像格式。無論是為了共享、展示,還是將內容嵌入到其他格式中,將 Publisher 文件轉換為 PNG 在線從未如此簡單。在這篇博客文章中,我們將探索一個免費的在線工具來將 PUB 轉換為 PNG。
免費在線轉換 Publisher 為 PNG
輕鬆地使用這個 免費在線 PUB 到 PNG 轉換器 工具將您的 Publisher 文件轉換為 PNG 圖像。您不需要安裝任何東西——只需在任何網頁瀏覽器中打開它並立即開始轉換。
![](images/free-publisher-pub-to-png-online-converter.jpg)
Microsoft Publisher 文件非常適合準備美觀的文檔、廣告、傳單和其他項目。然而,PUB 格式的兼容性不如 PNG 等格式廣泛。將您的 Publisher 文件轉換為 PNG 使得您的設計可以在任何設備上查看而無需安裝任何額外的軟件。這也使得在多種方式中使用這些圖像變得更加容易,例如在網頁出版物、社交平台上,甚至是打印目的。
如何在線轉換 PUB 為 PNG
- 拖放 PUB 文件或使用在線連結從 OneDrive、Dropbox 等處訪問它。
- 點擊 “轉換” 按鈕以開始 PUB 轉換。
- 輸出的 PNG 圖像將準備好下載。
- 將生成的 PNG 文件保存到您的電腦或移動設備上。
請放心,我們會完全保護您的數據。每個下載鏈接在 24 小時內會自動過期,確保您的數據被永久刪除。
免費 Publisher 到 PNG 轉換器的優勢
用戶友好的界面: 該工具設計簡單,即使是技術能力有限的用戶也能輕鬆使用。
不需要安裝: 由於這是一個在線工具,因此不需要下載或安裝任何軟件。
快速有效: 轉換過程非常快速,確保您能迅速獲得 PNG 文件。
將 PUB 轉換為 PNG:開發者指南
我們的免費在線轉換器,由 Aspose.PUB 庫提供支持,使開發者能夠在 .NET 和 Java 應用程序中以編程方式轉換和處理 Microsoft Publisher (PUB) 文件。在以下部分,您將找到詳細的步驟和代碼示例,用於以編程方式將 PUB 文件轉換為 PNG 圖像。
在 C# 中將 Publisher 轉換為 PNG 圖像
您可以通過以下步驟輕鬆地在 C# 中以編程方式將 Publisher PUB 文件轉換為 PNG 圖像:
- 在您的應用程序中安裝 Aspose.PUB for .NET 和 Aspose.PDF for .NET。
PM> Install-Package Aspose.Note
PM> Install-Package Aspose.PDF
- 使用以下代碼加載 Publisher 文件並將其轉換為 PNG 圖像:
// This code example demonstrates how to convert Publisher PUB file to PNG image format. | |
// Load PUB file and create PUB Parser | |
var parser = PubFactory.CreateParser("C:\\Files\\sample.pub"); | |
// Parse the PUB file | |
var doc = parser.Parse(); | |
// Initialize memory stream | |
MemoryStream stream = new MemoryStream(); | |
// Convert PUB to PDF file | |
PubFactory.CreatePdfConverter().ConvertToPdf(doc, stream); | |
// Load PDF document stream | |
Aspose.Pdf.Document document = new Aspose.Pdf.Document(stream); | |
// Loop through all the pages of PDF | |
foreach (Page page in document.Pages) | |
{ | |
// Get PDF file info | |
PdfFileInfo info = new PdfFileInfo(document); | |
// Get Page width and height | |
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 | |
PngDevice PngDevice = new PngDevice(width, height, resolution); | |
// Process the Page file and save output PNG image | |
PngDevice.Process(page, "C:\\Files\\Page" + page.Number + ".png"); |
在 Java 中將 Publisher 轉換為 PNG
同樣,您可以通過以下步驟在 Java 中以編程方式將 Publisher PUB 文件轉換為 PNG 圖像:
- 在您的應用程序中安裝 Aspose.PUB for Java 和 Aspose.PDF for Java。
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-pub</artifactId>
<version>22.8</version>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-pdf</artifactId>
<version>24.7</version>
</dependency>
- 使用以下代碼加載 Publisher 文件並將其轉換為 PNG 圖像:
// Load input PUB file | |
IPubParser parser = PubFactory.createParser("sample.pub"); | |
Document doc = parser.parse(); | |
// Convert PUB to PDF file | |
PubFactory.createPdfConverter().convertToPdf(doc, "Test.pdf"); | |
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())); | |
// Create PNG device with specified Width and Height | |
devices.PngDevice pngDevice = new devices.PngDevice(width, height); | |
// Convert PUB to PNG image | |
pngDevice.process(page, "Page" + page.getNumber() + ".png"); | |
} |
在 C++ 中將 PUB 轉換為 PNG
如果您是 C++ 開發者,您可以通過以下步驟在 C++ 應用程序中將 PUB 轉換為 PNG 圖像格式:
- 在您的應用程序中安裝 Aspose.PUB for C++ 和 Aspose.PDF for C++。
PM> Install-Package Aspose.PUB.Cpp
PM> Install-Package Aspose.PDF.Cpp
- 使用以下 C++ 代碼將 Publisher 文件轉換為 PNG 圖像:
// 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 PNG device with the specified Width, Height and Resolution | |
auto device = MakeObject<Devices::PngDevice>(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}.png", page->get_Number())); | |
// Convert the PDF page to PNG image | |
device->Process(page, imageStream); | |
// Close the stream | |
imageStream->Close(); | |
} |
獲取免費授權
您可以 獲取免費臨時授權 以在沒有評估限制的情況下試用這些庫。
在線轉換 PUB 為 PNG 文件:學習資源
除了將 PUB 轉換為 PNG,您還可以通過使用以下資源來探索該庫的其他功能:
結論
將 Publisher PUB 文件轉換為 PNG 圖像對於提升您的 Publisher 文件的靈活性非常有用。使用 PUB 到 PNG 在線轉換工具非常簡單,更重要的是,它是免費的。無論您需要轉換單個文件還是多個 PUB 文件,這個應用程序最終會讓您有效地完成任務。按照本文中概述的步驟,您可以無縫地將 PUB 文件轉換為 PNG 圖像,並在各種平台上保持設計的質量。
如果您有任何問題,請隨時在我們的 免費支持論壇 與我們聯繫。
PUB 到 PNG:常見問題
如何將 Publisher 文件轉換為 PNG?
要轉換文件,點擊藍色區域的任意位置或點擊 “瀏覽文件” 按鈕上傳文件,或直接拖放文件。您還可以通過在指定字段中輸入其 URL 來添加文檔。上傳文件後,點擊 “轉換” 按鈕。當轉換完成後,您可以下載 PNG 文件。
將 PUB 文件轉換為 PNG 需要多長時間?
轉換過程非常快速,通常只需幾秒鐘。
我可以免費將 Publisher 轉換為 PNG 嗎?
是的,Aspose 工具可以在線免費轉換 PUB 為 PNG。使用基本轉換功能不需要任何隱藏費用或訂閱。
文件大小有限制嗎?
此在線工具能有效處理大多數 PUB 文件。然而,大文件可能需要更長時間轉換為 PNG 圖像。
使用這個免費轉換器將 PUB 轉換為 PNG 是否安全?
是的,這完全安全!轉換完成後,您的轉換文件下載鏈接將立即可用。我們會在 24 小時後禁用下載鏈接並刪除所有文檔。沒有人能夠訪問您的文件,確保您的數據保持安全。
我可以在 Linux、Mac OS 或 Android 上使用這個應用程序嗎?
絕對可以!您可以在任何具有網頁瀏覽器的操作系統上使用這個轉換工具。我們的 PUB 轉換器在線運行,無需安裝任何軟件。