PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Bug when setting AcroForm AcroField TextField https://forum.pdfsharp.net/viewtopic.php?f=3&t=3783 |
Page 1 of 1 |
Author: | iksde [ Fri May 04, 2018 6:10 am ] |
Post subject: | Bug when setting AcroForm AcroField TextField |
I found a bug, its throwing NUllPointerException on setting the value of textfield to something else. I've prepared a project with example pdf file which you have to put into C:\PDF\example.pdf Thanks for pdfsharp its too big for forum size so here it is: https://www31.zippyshare.com/v/1tmx55Hu/file.html |
Author: | Oldtimer [ Tue Jan 28, 2020 12:26 pm ] |
Post subject: | Re: Bug when setting AcroForm AcroField TextField |
There is a bug in PdfTextField.RenderAppearance(). The lines marked with '+' need to be added. PdfFormXObject xobj = form.PdfForm; + if (xobj.Stream == null) + { + xobj.CreateStream(Encoding.ASCII.GetBytes(text)); + } string s = xobj.Stream.ToString(); |
Author: | Oldtimer [ Thu Jan 30, 2020 9:51 am ] |
Post subject: | Re: Bug when setting AcroForm AcroField TextField |
My mistake - my brain was working with several things at once. The problem in PdfTextField.RenderAppearance() is that XGraphics gfx = XGraphics.FromForm(form) needs to be wrapped in a using statement. The needed stream is created in XGraphics.Dispose (actually in XGraphics.Close, but that is called from Dispose). |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |