Populating PDF fields in .NET without a API, such as iTextSharp

Posted by Kristjan Oddsson on Stack Overflow See other posts from Stack Overflow or by Kristjan Oddsson
Published on 2010-06-14T16:30:41Z Indexed on 2010/06/14 16:32 UTC
Read the original article Hit count: 454

Filed under:
|
|
|
|
class mineTest
    {
        string pdfTemplate = @"c:\us.pdf";
        public mineTest(Customer c, string output)
        {
            StreamReader sr = new StreamReader(pdfTemplate);
            StreamWriter sw = new StreamWriter(output);
            string content = sr.ReadToEnd();

            content.Replace("(Customer name)/DA(/Verdana 10 Tf 0 g)/FT/Tx/Type/Annot/MK<<>>/V()/AP<</N 13 0 R>>>>", "(Customer name)/DA(/Verdana 10 Tf 0 g)/FT/Tx/Type/Annot/MK<<>>/V(John Johnson)/AP<</N 13 0 R>>>>");
            sw.Write(content);
            sw.Close();
            sr.Close();
        }
    }

Why does the above code fail at producing a valid PDF?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET