使用DebenuPDFLibrary导出微信中的照片

1、下载DebenuPDFLibrary1114源码版,

2、无需安装,直接打开sample样例,再options中添加libraries path,“D:\riocomponents\Debenu Quick.PDF Library 11.14 XE10.3 Full Source\DebenuPDFLib”路径。

3、打开微信公众号微官网,打印到pdf文件。参见博客https://blog.csdn.net/winniezhang/article/details/85540689

4、利用PDFLibrary的pdf导出image功能,导出pdf中的照片,代码如下。

uses
  DebenuPDFLibrary1114;

  public
    { Public declarations }
    QP: TQuickPDF;
    UnlockResult: Integer;


procedure TForm2.btnConvertClick(Sender: TObject);
var
SaveResult: Integer;
sFileName, newName ,LICENSE : AnsiString;
iNumpages : integer;
begin
if ListBox1.Items.Count < 1 then
begin
  ShowMessage('There are no images to convert. Please add one or more images to the list and try again.');
end;
  QP := TQuickPDF.Create;
try
  LICENSE := QP.LicenseInfo;
  UnlockResult := QP.UnlockKey(LICENSE);
  if UnlockResult = 0 then //判断是否有key,此例中使用的是源码版的PDFlibrary
  begin
    ShowMessage('Quick PDF Library could not be unlocked, please check your license key and try again.');
  end else
  begin
    for sFileName in ListBox1.Items do
    begin
        QP.LoadFromFile(sFileName , LICENSE);
        inumpages := QP.PageCount;
        SaveResult := QP.RenderDocumentToFile(72, 1,iNumPages,0,txtOutputLocation.Text + '\' + newName + '.jpg' );
    end;
  end;
finally
  QP.Free;
end;

3、结果。

发布了319 篇原创文章 · 获赞 64 · 访问量 22万+

猜你喜欢

转载自blog.csdn.net/winniezhang/article/details/104849183