[Printpreview] How to add a saved preview-file

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

[Printpreview] How to add a saved preview-file

Postby Jens01 » December 10th, 2010, 1:26 pm

Hi,
I want to add pages of a saved printpreview-file. When I load a printpreview-file first the the current pages in the preview will be cleared and then the new pages be added. But the new pages should be added to the current pages.
Can someobody help me for a solution? What can I do or where must the source changed?

Jens
Jens01
Active Member
Active Member
 
Posts: 19
Joined: December 10th, 2010, 12:10 pm

Re: [Printpreview] How to add a saved preview-file

Postby Kambiz » December 10th, 2010, 1:46 pm

Hello Jens,

I will add a function to the next version of PrintPreview for appending pages from another file.
For the moment, you can use the following function to add pages from the file specified by the FileName parameter to the PrintPreview control specified by the Preview parameter.

Code: Select all
procedure AppendPagesFromFile(Preview: TPrintPreview; const FileName: String);
var
  PageNo: Integer;
begin
  with TPrintPreview.Create(nil) do
    try
      LoadFromFile(FileName);
      for PageNo := 1 to TotalPages do
      begin
        Preview.BeginInsert(MaxInt);
        Preview.Canvas.StretchDraw(Preview.PageBounds, Pages[PageNo]);
        Preview.EndInsert;
      end;
    finally
      Free;
    end;
end;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Re: [Printpreview] How to add a saved preview-file

Postby Jens01 » December 10th, 2010, 2:06 pm

Thank you for your prompt answer!
Jens
Jens01
Active Member
Active Member
 
Posts: 19
Joined: December 10th, 2010, 12:10 pm


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 1 guest

cron