像 Photoshop 质量一样将 PDF 转换为 JPG - Commercial C++ / 德尔福库

发布于 2025-01-06 21:38:08 字数 407 浏览 1 评论 0原文

为了实现基于 Windows 的翻页应用程序,我需要能够将大量 PDF 页面转换为高质量的 JPG,而不仅仅是缩略图。

目的是实现最佳质量/文件大小,类似于 Photoshop 的 Save for Web 的做法。

目前我使用 Datalogics Adob​​e PDF Library SDK,它似乎无法完成该任务。因此,我正在寻找一个替代的商业 C++ 或 Delphi 库,它提供良好的质量/大小/速度。

在这里做了一些搜索后,我注意到大多数帖子都是关于 GS 和 GS 的。 Imagekick,我也测试过,但我对输出和速度不满意。

目标是导入 300dpi 的 PDF 并将其转换为 JPG 质量 50、高度 1500px、输出大小 300-500kb。

如果有人能为这项任务指出一个好的库,我将不胜感激。

For the implementation of a Windows based page-flip application I need to be able to convert a large number of PDF pages into good quality JPG, not just thumbnails.

The aim is to achieve the best quality / file size for that, similar to Photoshops Save for Web does that.

Currently Im using Datalogics Adobe PDF Library SDK, which does not seem to be able to fullfil that task. I am thus looking for an alternative commcerical C++ or Delphi library which provides a good qualtiy / size / speed.

After doing some search here, I noticed that most posts are about GS & Imagekick, which I have also tested, but I am not satisfied with the output and the speed.

The target is to import the PDFs with 300dpi and convert them with JPG quality 50, 1500px height and an ouput size of 300-500kb.

If anyone could point out a good library for that task, I would be most greatful.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

神仙妹妹 2025-01-13 21:38:08

Gnostice PDFtoolKit VCL 可能是一个候选者。转换为 JPEG 是选项之一。

The Gnostice PDFtoolKit VCL may be a candidate. Convert to JPEG is one of the options.

⒈起吃苦の倖褔 2025-01-13 21:38:08

我总是推荐 Graphics32 来满足您所有的图像处理需求;您有多个重采样器可供选择。但是,我不认为它可以将 PDF 文件作为图像读取。但如果您可以自己生成大图像,这可能是一个不错的选择。

I always recommend Graphics32 for all your image manipulation needs; you have several resamplers to choose. However, I don't think it can read PDF files as images. But if you can generate the big image yourself it may be a good choice.

無處可尋 2025-01-13 21:38:08

Atalasoft DotImage(带有 PDF 光栅器插件)可以做到这一点(我在那里研究 PDF 技术)。您将使用 C#(或其他 .NET)语言进行工作:

ConvertToJpegs(string outfileStem, Stream pdf)
{
    JpegEncoder encoder = new JpegEncoder();
    encoder.Quality = 50;

    int page = 1;
    PdfImageSource source = new PdfImageSource(pdf);
    source.Resolution = 300; // sets the rendering resolution to 200 dpi
    // larger numbers means better resolution in the image, but will cost in
    // terms of output file size - as resolution increases, memory used increases
    // as a function of the square of the resolution, whereas compression only
    // saves maybe a flat 30% of the total image size, depending on the Quality
    // setting on the encoder.

    while (source.HasMoreImages()) {
        AtalaImage image = source.AcquireNext();
        // this image will be in either 8 bit gray or 24 bit rgb depending
        // on the page contents.

        try {
            string path = String.Format("{0}{1}.jpg", outFileStem, page++);
            // if you need to resample the image, this is the place to do it
            image.Save(path, encoder, null);
        }
        finally {
            source.Release(image);
        }
    }
}

Atalasoft DotImage (with the PDF rasterizer add-on) will do that (I work on PDF technologies there). You'd be working in C# (or another .NET) language:

ConvertToJpegs(string outfileStem, Stream pdf)
{
    JpegEncoder encoder = new JpegEncoder();
    encoder.Quality = 50;

    int page = 1;
    PdfImageSource source = new PdfImageSource(pdf);
    source.Resolution = 300; // sets the rendering resolution to 200 dpi
    // larger numbers means better resolution in the image, but will cost in
    // terms of output file size - as resolution increases, memory used increases
    // as a function of the square of the resolution, whereas compression only
    // saves maybe a flat 30% of the total image size, depending on the Quality
    // setting on the encoder.

    while (source.HasMoreImages()) {
        AtalaImage image = source.AcquireNext();
        // this image will be in either 8 bit gray or 24 bit rgb depending
        // on the page contents.

        try {
            string path = String.Format("{0}{1}.jpg", outFileStem, page++);
            // if you need to resample the image, this is the place to do it
            image.Save(path, encoder, null);
        }
        finally {
            source.Release(image);
        }
    }
}
海螺姑娘 2025-01-13 21:38:08

看看 DynaPDF。我知道它相当昂贵,但你可以尝试一下入门包。

PS:购买产品之前,请确保它满足您的需求。

Have a look at DynaPDF. I know its pretty expensive but you can try the starter pack.

P.S.:before buying a product please make sure it meets your needs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文