Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Frequently Asked Question:

Return to FAQ Index

How to view a PDF in my Delphi application using DARenderPageToStream?

Question

How do I view a PDF in my Delphi application using the DARenderPageToStream function?

Answer

Yes, it's possible to view a PDF file in your Delphi application using the DARenderPageToStream function. I have included some Delphi code below which demonstrates how to do this.

var
  MS: TMemoryStream;
  fh, ph, SelectedPage, DPI: Integer;
begin
  with PDFLibrary do
  begin
    SelectedPage := 1;
    DPI := 72;
    fh := DAOpenFileReadOnly(OpenDialogPDF.FileName, '');
    ph := DAFindPage(fh, SelectedPage);
    MS := TMemoryStream.Create;
    DARenderPageToStream(fh, ph, 0, DPI, MS);
    MS.Seek(0, soFromBeginning);
    DAViewImage.Picture.Bitmap.LoadFromStream(MS);
    MS.Free;
    DACloseFile(fh);
  end;
end;

Please note: the DARenderPageToStream function can only be used with Delphi.


© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum