How to pre-fill a document to send to the User from the web?

joker77

Freshman
Joined
Sep 16, 2005
Messages
38
Location
Dublin
Hi there

I'm in the process of building a web application, one part of which I will have to send a prefilled document to the User for them to print. It will have stuff like the name and address etc, so that they can just print it off and stick it in an envelope.

What are the best options to achieve this?

I've looked into iTextSharp, which looks fine for generating PDF files. But I'll need a 'master' PDF with fields in it that I can search + replace, and I'm not sure at the moment how to do this.

If there's an alternative to a PDF that is cross-platform and easy to create, let me know, thanks
 
Not sure exactly what you want to do; however, you could possibly use a template HTML file (designed for 8.5/11, or whatever you need).

Code:
<html>
    <div>
        {FirstName} {MiddleInit} {LastName}
        <br />
        {StreetAddress}
        <br />
        {City} {StateCode}, {ZipCode}
    </div>
</html>

Then do a find/replace for all the values... maybe not the best option, but it allows the user to use their browsers print functionallity, print to PDF, printer, or Microsoft XPS document, etc.

C#:
    String.Replace("{FirstName}",YourFirstNameVariable);
    String.Replace("{LastName}",YourLastNameVariable);
 
Back
Top