Print Page | Close Window

Help with batch printing

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=756
Printed Date: 22 Nov 24 at 7:30PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Help with batch printing
Posted By: mac32bit
Subject: Help with batch printing
Date Posted: 05 Jul 07 at 11:13AM
Hi all
 
I have written the following code to batch print all PDFs in a folder.
 
Do I have to wait somehow for QP.PrintDocument to finish before printing the next document?
 
Many thanks in advance.
 
Mac
 
 
 
procedure TForm1.BitBtn2Click(Sender: TObject);
var
Done:integer;
SearchRec:TSearchRec;
begin

    try
      Done := Findfirst(IncludeTrailingPathDelimiter(BatchEditPath.Text)  + '*.pdf', faAnyFile, SearchRec);
      while Done = 0 do
        begin
          if ((SearchRec.Attr and faDirectory) = 0) and
              (SearchRec.Name <> '.') and
              (SearchRec.Name <> '..') then
          begin
              PrintPdf(IncludeTrailingPathDelimiter(BatchEditPath.Text) + SearchRec.Name);
          end;
          Done := FindNext(SearchRec);
        end;
    finally
        FindClose(SearchRec);
    end;

end;


procedure TForm1.PrintPdf(MyFileName: string);
var
QP : TiSEDQuickPDF;
MyPageCount, MyOptions: integer;
MyPrinter :string;

begin

  QP := TiSEDQuickPDF.Create;
  try

    if QP.UnlockKey('EvaluationKeyHere') <> 1 then
        raise Exception.Create('Invalid license key');

    if QP.LoadFromFile(MyFileName) <> 1 then
        raise Exception.Create('Cannot load PDF file: ' + MyFileName);

    If QP.Encrypted > 0 Then
        QP.Unencrypt;

    MyPageCount := QP.PageCount;

    MyPrinter := QP.NewCustomPrinter(PrintersComboBox.Text); 

    // 2=shrink large pages, 1=rotate to fit and centre on page 
    MyOptions := QP.PrintOptions(2, 1, MyFileName);

    case PaperGroup.ItemIndex of
      0: QP.SetupCustomPrinter(MyPrinter,1,DMPAPER_A3);
      1: QP.SetupCustomPrinter(MyPrinter,1,DMPAPER_A4);
    end;

    if QP.PrintDocument(MyPrinter, 1, MyPageCount, MyOptions) = 0 then
      raise Exception.Create('Cannot print file: ' + MyFileName);

  finally
    QP.Free;
  end;

end;




Replies:
Posted By: marian_pascalau
Date Posted: 05 Jul 07 at 1:56PM
Hi there,
as much as I know it is ok this way (program I have not checked).
 
Best regards, Marian


Posted By: mLipok
Date Posted: 12 Feb 15 at 5:02PM
I use QuickPDF library
My clients (all together) print more then 5000 pdfs each day.
And they are very happy.

Why you revive this so old thread.



-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600


Posted By: Ingo
Date Posted: 12 Feb 15 at 10:03PM
Hi mLipok,

i've removed the message you've answered to.
Looked like spam ;-)

Cheers, Ingo


-------------
Cheers,
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk