只需几步,轻松在线将 PUB 转换为 JPG 文件

Aspose.PUB 是灵活且易于使用的库,可用于处理电子发布文件。它支持将流行的电子出版物文件格式(.pub)加载和转换为PDF,并且无需任何软件依赖性

Aspose API支持流行文件格式处理,并允许将各类文档导出或转换为固定布局文件格式和最常用的图像/多媒体格式。

Microsoft Publisher PUB文件主要用于创建和编辑印刷出版物,例如小册子、新闻通讯和传单。虽然 Publisher 被广泛使用,但它可能不像其他文件格式那样普遍可访问。将 PUB 文件转换为广泛支持的通用JPG (JPEG) 格式有几个优点。因此,本文介绍了如何免费在线将 PUB Publisher 文件转换为 JPG/JPEG 图像。

一、免费在线 PUB 到 JPG 转换器

此PUB 到 JPG 转换器在线应用程序可用于免费将 Publisher 文件转换为 JPG 图像,无需安装任何软件或插件。

二、如何在线将 Publisher PUB 文件转换为 JPG

在线将 PUB 转换为 JPG 为轻松共享 Publisher 文件打开了一个可能性的世界。

  1. 拖放PUB 文件或使用在线链接从 OneDrive、Google Drive 等访问该文件。
  2. 单击“转换”按钮以执行 PUB 转换。
  3. 输出的 JPG 图像将可供下载。
  4. 将输出的 JPG 图像保存到您的计算机或手机。

您的数据不会存储在我们的服务器上,因此下载链接将在 24 小时后停止工作。

三、将 PUB 转换为 JPG 开发人员指南

无论您需要向客户发送小册子、与同事分享时事通讯还是将传单上传到网站,将 PUB 文件转换为广泛支持的 JPG 格式都可以确保跨不同设备和平台的无缝访问。您可以轻松将此功能集成到您的应用程序中。

四、在 C# 中将 PUB 转换为 JPG 图像

您可以按照以下步骤将 PUB 转 JPG 图像嵌入到 C# 应用程序中:

使用以下 NuGet 命令配置 Aspose.PUB for .NET 和 Aspose.PDF for .NET:

PM> Install-Package Aspose.Pdf
PM> Install-Package Aspose.PUB

  • 加载源 Publisher 文件。
  • 解析加载的 Publisher 文件。
  • 使用 ConvertToPdf() 方法将 PUB 转换为 PDF。
  • 创建 JpegDevice 类对象。
  • 保存输出的 JPG 图像。

以下代码片段演示了如何在 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

您可以通过以下步骤在 Java 中将 PUB 图像转换为 JPG 图像:

在您的环境中设置 Aspose.PUB for Java 和 Aspose.PDF for Java。

  • 获取输入 PUB Publisher 文件。
  • 解析输入 PUB 文件并将其呈现为 PDF 格式。
  • 转换 PDF 文件并保存输出 JPG 图像。

下面的代码示例详细说明了如何在 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

您可以通过以下步骤在 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

  • 加载源 PUB Publisher 文件。
  • 将 PUB 文件转换为 PDF 文档。
  • 将中间 PDF 文件渲染为 JPG 图像。

下面的代码片段解释了如何在 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 文件 – 学习资源

借助可靠的在线转换工具,您现在可以快速轻松地将 PUB 文件转换为 JPG。 PUB 转 JPG 在线转换提供支持 。但是,您可以参考以下资源来探索使用 Microsoft Publisher 文件的许多其他功能。

八、常见问题解答

我需要安装任何软件才能使用 PUB 到 JPG 在线转换器吗?

不需要,PUB 到 JPG 在线转换器是一个基于 Web 的工具,您不需要安装任何其他软件或插件。只要您有互联网连接,就可以使用各种设备上的网络浏览器访问它,包括计算机、笔记本电脑、平板电脑和智能手机。

PUB 到 JPG 在线转换器如何工作?

该转换器使用先进的算法来处理您的 PUB 文件并将其转换为高质量的 JPG 图像。只需将 PUB 文件上传到转换器,等待转换过程完成,然后下载生成的 JPG 文件即可。

PUB 到 JPG 在线转换器可以免费使用吗?

是的,PUB 到 JPG 在线转换器可以免费使用,您无需注册或使用电子邮件或信用卡详细信息登录。

本文演示了如何在线将 PUB 转换为 JPG 文件 ,要是您还有其他关于产品方面的问题,欢迎咨询我~

猜你喜欢

转载自blog.csdn.net/m0_67129275/article/details/131550351