Sander
Sander

Reputation: 13421

how should i export data to office documents and pdf in asp.net mvc 3

i'm looking for the best way to tackle this issue and in what order we do it best.

we have an application where users can enter certain personal details, afterwards they can download the word document (.docx) or get a pdf (.pdf) of their personal data.

what we already did is everything separate: with a *.docx template, we fill the parameterized fields and then save it as docx to the user

and with a certain library called BioPdf we can convert the rendered word document into a pdf

we are looking to avoid having office installed (or any other office tool) on the server, so the current library needs to go, we know of iTextSharp as a library to create pdfs, but that would mean that every time the template changes, we need to update our *.docx template for the word files, and at the same time update the iTextSharp code that renders our pdf.

are we looking at this the wrong way? in what order should we generate these files, in order to - minimize the work when a template gets changed - have no office programs installed on the server

best regards Sander Houttekier

Upvotes: 1

Views: 1536

Answers (3)

Sander
Sander

Reputation: 13421

as we still have not found a free library that does exactly what we need, we are seriously thinking of buying a license on Aspose.Words which does what we need with ease.

at least that is what the evaluation shows us ...

many of the suggested libraries can to some point generate the pdf with the data we need, but not in the style we want, we needed a system where we have template pdf files, to be filled some parameters, 1 of those parameters beeing a list of products each in its own table with a few rows of data on the product, and none of the above libraries gave sufficient support for that, either every table was on its own page, or the style of the tables needed to be created via the source code generating the pdf, while we had different templates this would have been hell to create code for each different style of each template.

so the quest for a free alternative of aspose continues, but for now i will close this one as we found a library that does what we want. (and if i look at the prices of aspose.words, i can only assume they know they are about the only providing these features :P)

Upvotes: 1

Romias
Romias

Reputation: 14133

You could have a try with PDFSharp y MigraDoc

It seems as the very same code can draw in a PDF, Printer or Screen.. and MigraDoc can render to RTF.

I had this scheduled to integrate with my projects but didn't try it myself, perhaps it fits your project.

Upvotes: 0

Stewart Ritchie
Stewart Ritchie

Reputation: 926

I would start by using the OpenXml SDK, which will allow you to create and manipulate office documents programatically.

It does not require you to have Microsoft Office installed or licensed on your server, just a single DLL that can be bin-deployed along with the rest of your application if you want.

I haven't played around with dynamic PDF generation (apart from good old GhostScript), so I can't offer any advice there.

Upvotes: 0

Related Questions