Print Page | Close Window

Stream merging of PDF files using Delphi

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: Sample Code
Forum Description: Share Debenu Quick PDF Library sample code with other forum members
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1818
Printed Date: 27 Apr 24 at 5:40PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Stream merging of PDF files using Delphi
Posted By: Rowan
Subject: Stream merging of PDF files using Delphi
Date Posted: 26 Apr 11 at 9:10PM
Here is some Delphi code for merging two PDFs in a stream. Alternatively the MergeStreams function can be used.

  function MergeStreamsViaMergeDocument(FirstStream, SecondStream,
    OutputStream: TMemoryStream): Integer;
  var
    doc1, doc2: Integer;
  begin
    with TQuickPDF.Create do
    try
      FirstStream.Seek(0, soFromBeginning);
      LoadFromStream(FirstStream);
      doc1 := SelectedDocument;
      SecondStream.Seek(0, soFromBeginning);
      LoadFromStream(SecondStream);
      doc2 := SelectedDocument;
      SelectDocument(doc1);
      MergeDocument(doc2);
      OutputStream.Seek(0, soFromBeginning);
      SaveToStream(OutputStream);
    finally
      Free;
    end;
  end;



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