Click here to Skip to main content
11,922,641 members (57,790 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET PDF convert Word

I have a database(SQL Server) with thousands data items(each item is a trainee with all his informations), and a predefined word document as template, the requirement is - for each trainee- (Who's loggedon), fill corresponding data(trainee informations) into template fields, and generate a readonly PDF file as result.

Platform is ASP.NET(C#).

I found two solutions:

1. Change the word document into a PDF form, and use iTextSharp to fill the form fields. But create the PDF form with correct format (font, layout, etc.) is a difficult work, and it needs particular tool and new skill when system user wants to add new template (unless the PDF form is always created by developer).

2. Add text placeholder in the word file, and the program can read word file, replace text, and convert into PDF. but i don't know how to proceed.
Posted 9-May-13 6:30am
Edited 9-May-13 6:32am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Or, you could just do the entire thing in Word. What you're describing is called "Mail Merge" and you can print the entire document to a PDF "printer" without a single line of code.
omarbench 9-May-13 12:09pm
Thank you for your answer !

No it's not mail merge

for example i'm logged as a user so in the database there is all my informations, so when i want to get the document i just have to get the document with only my informations in it with also some informations that i filled in a form that's all
Dave Kreskowiak 9-May-13 12:11pm
Yeah, it's still a mail merge. The query you give to the mail merge is only going to return one record.

If you have a Word template, you're going to be doing the exact same thing. You tell Word to do a mail merge, give the query for the one record, and tell it to print to a PDF printer.
Omar Benchhiba 9-May-13 12:18pm
OK I'll give it a try right now thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151125.1 | Last Updated 3 Aug 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100