Delphi中的PDF缩略图 [英] PDF thumbnails in Delphi

查看:137
本文介绍了Delphi中的PDF缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在Delphi中是否容易生成PDF文件的缩略图。基本上,我想将PDF的第一页渲染成一个小的位图(比如100x100或类似的)。

我看到两个选项1使用PDF组件,2以某种方式利用资源管理器如何生成预览/缩略图。

I was wondering if there was an easy of generating thumbnails of PDF files in Delphi. Basically I want to render the first page of a PDF to a small bitmap (say 100x100 or similar).
I see two options 1 use a PDF component, 2 somehow tap into how explorer generates previews/thumbnails.

推荐答案

使用像QuickPDF或Gnostice这样的库真的是最简单的选择。我确信浏览器中的PDF缩略图实际上是由Adobe安装的任何PDF软件生成的。除非您能保证在每个工作站上安装正确的PDF阅读器,否则使用缩略图的想法可能无效。

Using a library like QuickPDF or Gnostice is really the easiest option. I'm fairly sure that the PDF thumbnails in explorer are actually generated by whatever PDF software is installed such as Adobe. Unless you can guarantee that a proper PDF reader is installed on every workstation the idea of using thumbnails might not be valid.

编辑:这是一个完整的应用程序,使用QuickPDF渲染给定PDF文件的第一页到BMP文件。在10 DPI,我的输出BMP文件是85像素宽,高110像素。

Here's a complete application using QuickPDF to render the first page of a given PDF file into a BMP file. At 10 DPI my output BMP file is 85 pixels wide by 110 pixels high.

program PDFToBMP;
{$APPTYPE CONSOLE}
uses
  SysUtils, QuickPDF;
var
  Q : TQuickPDF;
begin
  Q := TQuickPDF.Create;
  try
    Q.LoadFromFile(ParamStr(1), '');
    Q.RenderPageToFile(10 {DPI}, 1 {PageNumber}, 0 {0=BMP}, ChangeFileExt(ParamStr(1),'.bmp'));
  finally
    Q.Free;
  end;
end.

这篇关于Delphi中的PDF缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆