Page 1 of 1

[Printpreview] How to add a saved preview-file

PostPosted: December 10th, 2010, 1:26 pm
by Jens01
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

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

PostPosted: December 10th, 2010, 1:46 pm
by Kambiz
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;

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

PostPosted: December 10th, 2010, 2:06 pm
by Jens01
Thank you for your prompt answer!
Jens