Print Page | Close Window

Problem with MergeFileListFast in Delphi

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=3309
Printed Date: 13 Jul 25 at 5:04PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problem with MergeFileListFast in Delphi
Posted By: WilburWright
Subject: Problem with MergeFileListFast in Delphi
Date Posted: 15 Apr 16 at 8:17PM
Having trouble implementing then
MergeFileListFast function to Merge all PDF files into a common PDF file ...

Here is my sample code in one function ...

Function TForm1.AddSections2CommonDoc(FileName : String; DeleteSource : Boolean) : Boolean;
Var
  FilePath : String;
  AddFileName : String;
  FileIndex : Integer;
  AddedFiles : Integer;
  CommonDocPDF: TDebenuPDFLibrary1212;
  SearchResult : TSearchRec;

Begin

  If FileExists(FileName) = True then
    Begin
      Result := False;
      ShowMessage('File Exists: [' + FileName + ']');
      Exit;
    End
  Else
    Begin
      CommonDocPDF := TDebenuPDFLibrary1212.Create();
    End;

  FilePath := IncludeTrailingBackSlash(ExtractFileDir(FileName));

  CommonDocPDF.SetTempPath('c:\temp\');
  CommonDocPDF.ClearFileList('myList');

  If FindFirst(FilePath + '*.pdf', faArchive, searchResult) = 0 then
    begin
      repeat
        AddedFiles := CommonDocPDF.AddToFileList('myList', FilePath+searchResult.Name);
      until FindNext(searchResult) <> 0;

      FindClose(searchResult);

    end;

  CommonDocPDF.MergeFileListFast('myList', Filename);
  FreeAndNil(CommonDocPDF);

End;

In case this helps, AddedFiles always returns 1, it is not incrementing with each file added.
Development environment is Delphi Seattle 10 with Quick PDF library 12.12

Thank you for your help ...




Replies:
Posted By: WilburWright
Date Posted: 15 Apr 16 at 8:42PM
Solved this myself,
Function works as described,
Just make sure to unlock the CommonDocPDF object before using it.

Not real happy with brain.


Posted By: Ingo
Date Posted: 15 Apr 16 at 9:41PM
Hi Wilbur,

... welcome here :)
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