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.
Closed 6 years ago.
开发者_运维百科 Improve this questionIs there any (easy) way to convert a doc or docx to pdf, server side? Any good/free libraries that can do it?
Thanks in advance
Edit:
I tried with the office interop. But my server does not have word or office running and I don't want to be dependent of it.
We use http://www.aspose.com/categories/.net-components/aspose.words-for-.net/default.aspx
It's not free and it doesn't handle floated elements very well, but it does the job.
It's pretty simple to use:
Document document = new Document(Path.Combine(filePath, fileName));
using (MemoryStream ms = new MemoryStream())
{
// convert to PDF
document.Save(ms, SaveFormat.Pdf);
// Do stuff
}
I found another way to do what I needed. I used OpenOffice service and combined it with a python command, python script, and an auto generated batch script. did the job perfectly and surprisingly quickly
As an alternative, you could install this free print driver: http://www.dopdf.com/
When you print to it, the output is a pdf file.
精彩评论