PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Help with error: The size of the XPdfForm is to small
https://forum.pdfsharp.net/viewtopic.php?f=2&t=11
Page 1 of 1

Author:  tertiumquid [ Sun Oct 29, 2006 2:32 pm ]
Post subject:  Help with error: The size of the XPdfForm is to small

Greetings. I am receiving an error when trying to fill in an existing PDF's form fields, but I'm not sure what it means. I was wondering if anyone here could shed some light on the error message.

The error message reads: "The size of the XPdfForm is to small. Parameter Name: size."

The offending code is found in the if statement of the following code block, where "fields" is a PdfAcroFieldCollection and "FFELPForm" is an ASP Wizard control.

Code:
PdfAcroField fNonLoanCode = fields["NonLoanCode" + i.ToString()];

if ((txtField = fNonLoanCode as PdfTextField) != null) { txtField.Text = ((DropDownList)FFELPForm.FindControl( "NonLoanCode" + i.ToString() )).SelectedValue; }


I'm not sure what property of the PDF document the error refers to; is it the actual pixel width of field? Is it the allowed characters of the field? Etc. At the point the error is thrown, the "SelectedValue" that I'm trying to fill the field with is only two characters long.

Any ideas?

Author:  Stefan Lange [ Mon Oct 30, 2006 12:13 am ]
Post subject: 

Hello

>>Any ideas?

Yes, I wrote in the FillFormFields Sample (which is not in the Samples solution anymore):

Code:
Note: AcroForms are still under construction in this version. Filling form fields is more obscure than I expected. The implementation is partially undone.


This simply means the AcroForm stuff is incomplete and untested. We currently don’t need AcroForms in our own projects. I have not removed the source code from PDFsharp because it may be useful for somebody.

Sorry
Stefan Lange

Author:  garrinmf [ Wed Nov 29, 2006 7:13 pm ]
Post subject: 

I ran into the same issue and found that the issue arose when there were multiple fields with the exact same name. So tertiumquid could get around it by adjusting names slightly.

I'm using PdfSharp to auto fill forms and I made it so the form could have any number it wanted at the end and I only looked at the text so "address" filled in the same as "address12312" or "address32".

But thats just a work around. I poked around a bit inside the pdf and I know what it's doing now I think. I poked around the code a bit and it just didn't pop out at me as to how it works (the parsing and reading of all the tags and where they're stored and such) but if I could get an overview and a start I'd work on fixing it myself.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/