Copied RSS Feed

Word

Merge Word Docs and Send to PDF

Ever need to convert multiple Word documents into one Pdf document?  Here is a quick and easy sample showing just that!

   // Creating a New document.
            WordDocument doc = New WordDocument();
            // Imports the first template document
            If ((String)textBox1.Tag != String.Empty)
                doc.ImportContent(New WordDocument((String)textBox1.Tag));
            Else
                MessageBox.Show("Browse a Word document To import", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            // Imports the second template document
            If ((String)textBox2.Tag != String.Empty)
                doc.ImportContent(New WordDocument((String)textBox2.Tag));
            Else
                MessageBox.Show("Browse a Word document To import", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            If ((String)textBox1.Tag != String.Empty && (String)textBox2.Tag != String.Empty)
            {
                DocToPDFConverter converter = New DocToPDFConverter();
                //Convert Imported word document into PDF document
                PdfDocument pdfDoc = converter.ConvertToPDF(doc);
                //Save the pdf file
                pdfDoc.Save((String)textBox1.Text + ".pdf");
                pdfDoc.Close(True);
            }

Sample Link

Multiple docs, doc to pdf

Meet the Author

Chad Church