We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Merging Word documents and converting to PDF

Say we have 200 Word documents server side and need to wind up with one, compiled, PDF document? What is the easiest way to do this? Do we need to send you 200 documents, merge into one Word which you return to us, then we send it back to you for conversion to PDF or is there a simpler way?

Hi Harrison,

Thanks for your inquiry. You need to upload your documents to server to merge/join documents using appendDocument resource. Please read the following documentation link about appending a list of word document.

Following is the example of appendDocument resource.
http://api.aspose.com/v1.1/words/TestMainAppendTemplate.doc/appendDocument

In your case, you do not need to download the output Word document. Please use the TestMainAppendTemplate.doc (see above example link) as input document and save it into Pdf using the code shared in following documentation link.

Please check the following code example for your kind reference.

String inputFileName = "TestMainAppendTemplate.docx";

//Create the string array to hold document names

string[] appendDocs = { "TestAppendTemplate1.docx", "TestAppendTemplate2.docx" };

//Create the string array to hold import format modes

string[] importFormatsModes = { "KeepSourceFormatting", "UseDestinationStyles" };

//create Document object

Document document = new Document(inputFileName);

//append a list of documents

Boolean appendFlag = document.AppendDocument(appendDocs, importFormatsModes, FolderName);

if (appendFlag)

Console.WriteLine("Documents have been appended successfully");

//create Converter object

Aspose.Cloud.Words.Converter converter = new Aspose.Cloud.Words.Converter(inputFileName);

//save in the required format

converter.Convert(@"C:\temp\Out.pdf", Aspose.Cloud.Words.SaveFormat.Pdf);

Thanks. I’m relatively clear but have some things to confirm:


1) Is there any way to do this without storing the document on your servers? We have some pretty strong security standards with the client we are doing this for.
2) Assuming we go with the method of storing the documents on your server, we will send you one set of 200 documents to merge into a single Word document, is this right? Assuming a single page Word document for each of the 200, with no images or anything, can you tell us how long you expect that merge to take? Just a rough idea - obviously depends on many things but just looking for an idea, i.e., is it 10 seconds, 1 minute, 5 minutes, etc.?
3) Once the merged Word document exists on your side as a merge doc, we will convert it to PDF. Does it have to save on your side, or can we get it as an export?

Hi Harrison,

Thanks for your inquiry.

mcftech:

1) Is there any way to do this without storing the document on your servers? We have some pretty strong security standards with the client we are doing this for.
3) Once the merged Word document exists on your side as a merge doc, we will convert it to PDF. Does it have to save on your side, or can we get it as an export?

Your documents need to be uploaded to Cloud’s server for merging. However, I have logged a feature request as SAASWORDS-178 in our issue tracking system for merging document and convert the final output document to Pdf. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.
mcftech:

2) Assuming we go with the method of storing the documents on your server, we will send you one set of 200 documents to merge into a single Word document, is this right? Assuming a single page Word document for each of the 200, with no images or anything, can you tell us how long you expect that merge to take? Just a rough idea - obviously depends on many things but just looking for an idea, i.e., is it 10 seconds, 1 minute, 5 minutes, etc.?

Please note that performance of document processing depends on complexity and size of the documents you are generating. Our servers are really fast and processing speed is very high there but you need to send input documents and download output documents which obviously takes time. Hope this answers your query.

Please let us know if you have any more queries.

Hi - Thanks, this information is helpful, but I’m not quite sure answers all the questions. Just some follow-ups:


1) Can we simply delete the file afterwards?
3) After doing the PDF conversion, do we receive a document ID and then we go back and retrieve the document with a follow-up API call?

2) Can you give me ANY idea on performance? I’m not looking for anything specific. The reason I’m asking is that we can do this one of two ways: A) Generate Word docs on our side, send all to you, merge and convert to PDF OR. B) Generate the individual PDF using your PDF service (like we do already today) and then send you all 200 PDFs to merge. I’d just like some sort of guideline if you have a simple text Word document and need to convert to merge 200. I’m not looking to hold you guys to anything, just a guideline.

Thanks!

Hi Harrison,

Thanks for your inquiry.

mcftech:

  1. Can we simply delete the file afterwards?

Yes, you can delete the files after getting your final output Pdf file. Please read about deleting files from here:

mcftech:

  1. After doing the PDF conversion, do we receive a document ID and then we go back and retrieve the document with a follow-up API call?

Please check following resource URI example. The output document is saved with name ‘TestMainAppendTemplate.doc’. You do not need to download this file. You simply convert this file to Pdf and delete it.
http://api.aspose.com/v1.1/words/TestMainAppendTemplate.doc/appendDocument

The appendDocument resource appends a document or documents specified in the list to the original
resource document. The changes are saved in the original resource
document.

mcftech:

Can you give me ANY idea on performance? I’m not looking for anything specific. The reason I’m asking is that we can do this one of two ways: A) Generate Word docs on our side, send all to you, merge and convert to PDF OR. B) Generate the individual PDF using your PDF service (like we do already today) and then send you all 200 PDFs to merge. I’d just like some sort of guideline if you have a simple text Word document and need to convert to merge 200. I’m not looking to hold you guys to anything, just a guideline.

Please note that performance of document
processing depends on complexity and size of the documents you are
generating.

At backend, Aspose.Words for Cloud uses Aspose.Words for .NET as codebase. While rendering a document to fixed page formats (e.g. PDF), Aspose.Words needs to build two model in the memory – one for document and the other for rendered document.

Please note that the process of building layout model is not linear; it may take a minute to render one page and may take a few seconds to render 100 pages. Also, Aspose.Words has to create APS (Aspose Page Specification) model in memory and this may again eat some more time for some documents.

If your document have simple text and not huge in size, this will be opened and saved in fractions of a second. Note that this also includes the time of uploading and downloading file.

In your case, I suggest you please use the solution A. Please let us know if you have any more queries.

Thanks. Regarding question 3, if I don’t download the merged pdf, how will we obtain it? That is the final product

Hi Harrison,

Thanks for your inquiry. The appendDocument resource appends a document or documents specified in the list to the original
resource document
. The changes are saved in the original resource
document.

Please check following documentation link about converting Word document to Pdf.

Thanks. If we delete the document after use, will Aspose have a copy of it anywhere, i.e., backup files? Also, do you have any whitepapers on security?

Hi Harrison,

Thanks for your inquiry.

mcftech:

If we delete the document after use, will Aspose have a copy of it anywhere, i.e., backup files?

If you delete the file from Cloud’s server, it will be deleted permanently from server. There is no backup files after deletion.

mcftech:

Also, do you have any whitepapers on security?

Please check following link about security of Aspose products for Cloud.

Please let us know if you have any more queries.