Inserting pdf documents into a master pdf document

I am looking at using Aspose.Total to automate the following tasks:

  • convert master document (Word) and other documents (Excel, images, text, etc) to pdf
  • insert the other documents into the master document in various places to create a single pdf document.

Converting the different documents to pdf with Aspose appears to be rather straight forwards. I am looking for advice on 1) what type of markers should I use in the original master word document (i.e. bookmark, merge field, something else) so that I will be able to programatically find the insertion points in the master document after it has been converted to pdf. 2) What Aspose classes/methods should I use to find the insertion points in the master document (as pdf) and to insert other pdf documents?

thanks,
Ken

kgebiconsulting:


I am looking for advice on

1) what type of markers should I use in the original master word document (i.e. bookmark, merge field, something else) so that I will be able to programatically find the insertion points in the master document after it has been converted to pdf.

2) What Aspose classes/methods should I use to find the insertion points in the master document (as pdf) and to insert other pdf documents?


Hi Ken,

I would like to share with you that you can insert PDF documents/pages in another PDF file using Insert method of PdfFileEditor class. You can insert pages on the specified page number (location) in the original PDF file. So, in order to fulfill your requirement, you'll have to keep track of the location (page number) where you have to insert the new pages or files.

I hope this helps. If you have any more questions or need any further assistance, please do let us know.
Regards,

Hi Shahzad Latif,

Thanks for the response. I still have the issue of how to find the insertion points in my master document. The Insert method of the PdfFileEditor class has the insertLocation parameter, which presumably indicates the desired insertion point. If I have a bookmark one third of the way down on the seventh page of the master document which indicates where I want to insert another document, how do I set the insertLocation parameter?

thanks,
Ken

Hi Ken,

The Insert method allows you to insert the new file at the particular location; this location only represents a page number.

Please note the description of the parameters below:

public bool Insert(
string inputFile , //the input PDF file
int insertLocation , //the page number at which you want to insert the new file
string portFile , //the file to be inserted
int startPage , //the starting page number to be inserted
int endPage , //the ending page number to be inserted
string outputFile //final output file
);

Now, for example if you have an input PDF file with 3 pages (F1-1,F1-2,F1-3) and a port file with 2 pages (F2-1,F2-2) and you want to insert all the pages of the second file at the second location of the input file then the situation will be as under:

F1-1, F2-1, F2-2, F1-2, F1-3.

I’m afraid, currently there is no way to insert the pages based on some existing mark/point in the input file. If you could share the sample file, we’ll look into this in detail at our end and try to provide some resolution in our future versions.

We’re sorry for the inconvenience and looking forward to help you out.
Regards,