1) When a file works fine locally, but not on some remote system, chances are
Very Good that the problem isn't with iText.
What exactly is this gibberish? I suspect it looks something like:
%PDF-1.6
%âãÏÓ
206 0 obj
<</Filter/FlateDecode/First 385/Length 924/N 46/Type/ObjStm>>stream
hÞ¬—ooÓ0ƿʽ„WÍù$4 Úu
šîBU¶™"&U’öí9×FÚ[
iÍ%®ïçÇg?q‡Ê�3
µÅ€qŠÏ4(\#П´�É
hjÏ
‚Ês0œÒ£(æLˆ"—3@&PrAÑ�
î:�...@’¹¨žh ÔõG’¢
=!A
I'm guessing you're not setting the correct mime type.
--Mark Storer
Senior Software Engineer
Cardiff.com
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
________________________________
From: [email protected] [mailto:[email protected]]
Sent: Sunday, August 15, 2010 3:44 AM
To: [email protected]
Subject: [iText-questions] after calling pdfreader function,I got a
screen with gibberish
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
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.851 / Virus Database: 271.1.1/3068 - Release Date:
08/15/10 23:35:00
------------------------------------------------------------------------------
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/