Print2eDoc SDK
SDK for document conversion to PDF, PNG, JPEG, TIFF...
Compatibility
VB VB.NET VC++ C# Delphi

Converting/Merging Documents from Multiple Applications to a Single PDF

Learn how to append and insert pages to an existing PDF document.
By Avinash Shrigani
Important

This product has been discontinued. Please check our old products page for more information.

Print2eDoc SDK offers you several options to deal with the situation where you convert a file to PDF and a file with specified output file name already exists.

Specifically, you can choose to:

  1. replace the existing file
  2. apply an incrementing numerical suffix to the file name
  3. insert pages
    1. at the beginning of the existing document
    2. at the end of the existing document
    3. after a specified page in the existing document

Using this feature, you can convert multiple input documents (in any combination of file types) and merge them to a single output PDF document.

Suppose that you have converted a .doc file* and saved the output PDF document with pathname c:\converted_word_doc.pdf. If you then convert a .txt file* and specify the same pathname for the output file (i.e., c:\converted_word_doc.pdf), all of the above-mentioned options become available to you.

In the code snippets (in VB and C#) shown below, one of these options has been implemented.

Visual Basic C#
'Create a new Print2eDoc printer object
Dim PrinterObj As New gtPrint2eDoc

PrinterObj.ActivateLicense("")
PrinterObj.ShowSaveDialog = False
PrinterObj.ShowSettingsDialog = False
PrinterObj.ShowPreview = False

'Choose PDF as output format
PrinterObj.OutputDocumentFormat = PDF

'Choose to provide a file name for output document
'Prevent automatic file name generation
PrinterObj.UseCustomDocumentName = True

'Specify pathname of an existing PDF document
PrinterObj.DefaultOutputDirectory = "C:\"
PrinterObj.OutputDocumentName = "converted_word_doc.pdf"

'Choose to insert pages if output 
'document already exists
PrinterObj.FileExistsOption = feInsertAfterPage
'Specify page number in the existing document
'after which pages should be inserted
PrinterObj.FileExistsOptionInserAfterPage = 3  
    
'Convert the document
PrinterObj.PrintDocument ("C:\Sample.txt")
  

* - It is assumed that the .doc file type is registered with application Microsoft® Word™ and .txt file type is registered with Notepad.

Privacy | Legal | Feedback | Newsletter © 2002-2010 Gnostice Information Technologies Private Limited. All rights reserved.

This site is best viewed on a screen with minimum resolution of 1152 x 864 pixels. Windows users are advised to use Microsoft ClearType Tuning for optimal experience. Linux and other users can enable font smoothing, as supported by their OS. Also, please use the latest version of a standards-compliant browser such as Opera, FireFox, Chrome or Safari.