We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Cl开发者_开发百科osed 2 years ago.
Improve this questionIs there any way to merge word, excel documents into a PDF? I looked into iTextSharp but im not sure if it can do that. I have a requirement where user will upload word, excel document and i have merge them into a PDF document.
Step 1) Convert your files to PDF.
Step 2) Merge the PDFs with PdfCopy.
Most Office formats can be converted to PDF (for free) via OpenOffice.org calls. There are probably some service sites out there that can do the same, and various commercial software packages. Vichle's link in his comment will probably do the trick.
Vichle's link also demonstrates that you probably didn't search SO first before asking your question. Naughty naughty.
Merging PDFs is fairly trivial:
Document doc = new Document();
PdfCopy copy = new PdfCopy(doc, outputStream);
doc.open();
String paths[] = getPaths();
for (int i = 0; i < paths.length; ++i) {
PdfReader reader = new PdfReader(paths[i]);
/**** The first page is ONE, not zero ****/
for (int j = 1; j <= reader.getNumberOfPages(); ++j) {
PdfImportedPage curPg = copy.getImportedPage(reader, j);
copy.addPage(curPg);
}
}
doc.close();
That's Java, but to convert to C# you really just need to switch the function names to upper case, and tweak a couple class names. It's trivial.
And supporting evidence that C# is just MS's pet Java.
I would like to share with you that you can merge multiple PDF files into a single PDF file using Aspose.Pdf.Kit for .NET.
If you also want to convert other office documents to PDF files, in your C# application, you can try Aspose.Total for .NET product suite. Aspose.Total for .NET allows you to convert Word, Excel, Powerpoint, Text, HTML and Image files to PDF format.
I hope this helps.
Disclosure: I work as Developer Evangelist at Aspose.
Also, you can use PDFCombineProX at https://www.coolutils.com/PDFCombineProXNET
string src="C:\\test\\test1.docx".Chr(13)."C:\\test\\test2.xlsx";
string dest="C:\\test\\DestCombine.PDF";
PDFCombineProX Cnv = new PDFCombineProX();
Cnv.Convert(src, dest, "-c PDF -log c:\\Combine.log");
MessageBox.Show("Combine complete!");
using dev express RichEditDocumentServer class you can merge multiple document in some easy step
enter image description here
精彩评论