Hello,
I have the following code, which is used to fill in the fields in PDF document and then to give the flattened PDF for download:
if (Session["person_surname"] != null)
PDF.Form.Fields["Surname"].Value = Session["person_surname"].ToString().ToUpper();
if (Session["person_sex"] != null)
PDF.Form.Fields["Sex_" + Session["person_sex"].ToString()].Value = "Yes";
...
PDF.FormFlattening = FormFlatteningOptions.Default;
try { PDF.DrawToWeb("Test.pdf", true); }
catch (Exception Ex) { }
Everything works fine, when both Session values are null (then the empty PDF is provided) or Session["person_sex"] is not null (then the corresponding check box is marked in resulting PDF). But if Session["person_surname"] has some value, which should be placed in normal text field with Arial font of size 9, then I get the following exception:
Input string was not in a correct format.
at System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.Single.Parse(String s)
at ceTe.DynamicPDF.Merger.Forms.PdfFormField.a()
at ceTe.DynamicPDF.Merger.Forms.PdfFormField.get_Font()
at ceTe.DynamicPDF.Merger.Forms.PdfTextField.get_Font()
at zz93.c8.a()
at zz93.c8.d()
at zz93.db.a(PageWriter A_0)
at zz93.db.b(PageWriter A_0)
at ceTe.DynamicPDF.Merger.AppendedPage.a(DocumentWriter A_0, Int32 A_1, Int32 A_2)
at ceTe.DynamicPDF.Merger.AppendedPage.DrawEntries(DocumentWriter writer, Int32 pageNumber, Int32 sectionPageNumber)
at ceTe.DynamicPDF.Page.a(DocumentWriter A_0, Int32 A_1, Int32 A_2, Int32 A_3)
at zz93.o2.d(Int32 A_0)
at zz93.o2.s()
at ceTe.DynamicPDF.Document.Draw(Stream stream)
at ceTe.DynamicPDF.Document.a(HttpRequest A_0, HttpResponse A_1, Boolean A_2, String A_3, Boolean A_4)
at ceTe.DynamicPDF.Document.DrawToWeb(Boolean allowBrowserCaching, String downloadAsFileName, Boolean forceDownload)
What could be the reason?
DrawToWeb throws "input string was not in a correct format"
Re: DrawToWeb throws "input string was not in a correct format"
Support · Jul 13, 2012Hello,
Please make sure that the session variable is returning the correct value and you are correctly parsing it to string before setting it to TextField using Value property.
If you continue getting the error then please send over the following details to our support team at: [^a|mailto:support@cete.com|opennewwindow|support@cete.com^] so that we can look into it further.
1.Input PDF document.
2.Sample code which you are using.
3.Sample value which your session variable is returning.
Thanks,
ceTe Software Support Team.
Re: DrawToWeb throws "input string was not in a correct format"
Support · Jul 17, 2012Hello,
This issue has been fixed and fix is available with the latest v7.0.1.21252 build dll files. Please contact our support team at: [^a|mailto:support@cete.com|opennewwindow|support@cete.com^] to get the latest version 7 dll files. Once you get the dll files remove reference for the old dll file and reference the latest dll file in your application. This will work for you.
Thanks,
ceTe Software Support Team.