Hi there,

I was trying to create a pdf file by iTextSharp. Now I have a very strange problem. Basically what I want to do is to read data from database, and fill out a new pdf with these data. Please see my code below.

private String createRegForm(JobSeeker jseeker)
{
String file = Server.MapPath("~/uploads/Form.pdf");
String newfilename = "~/uploads/registration/" + a.LastName + "_" + a.FirstName+".pdf";
String newFile = HttpContext.Current.Server.MapPath(newfilename);

PdfReader reader = new PdfReader(Server.MapPath(file));

PdfStamper stamper = new PdfStamper(reader, new FileStream(newFile, FileMode.Create));
AcroFields fields = stamper.AcroFields;

MemoryStream m = new MemoryStream();
fields.SetField("InDate", a.DateOfArrival.ToShortDateString());
fields.SetField("FSType_HRLE", "On");
fields.SetField("FSType_HRDC", "On");
fields.SetField("FinancialOther", jseeker.FinancialSupportOther);

stamper.FormFlattening = true;
stamper.Close();
return newfilename;
}

I tried to debug the code line by line, and I found the problem appears to be the pdfreader. After calling the pdfreader, I got a screen of gibberish. Have no clue what the problem is. Actually the same code works fine in my local machine, but not on the hosted system. Could anyone give some hints? Please!!!!

Thanks so much!

Cheers!

Shelly
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to