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

Losing formatting/data when valuing a form field
https://forum.pdfsharp.net/viewtopic.php?f=2&t=95
Page 1 of 1

Author:  ibbly [ Tue Mar 06, 2007 9:50 pm ]
Post subject:  Losing formatting/data when valuing a form field

I am having the following problem:

All text is converted to 'plain text' when I try to value
my PDF form field. I want the formatting to remain.

Here is the code:
// Open the file
PdfDocument document = PdfReader.Open(Filename,
PdfDocumentOpenMode.Modify);

// Get the root object of all interactive form fields
PdfAcroForm form = document.AcroForm;


// Get all form fields of the whole document
PdfTextField.PdfAcroFieldCollection fields =
form.Fields;

// Value the fields.

PdfTextField t = (PdfTextField)fields
[Field_MMDDYYYY];
t.Text = ClinicDate;

I lose formatting and/or the text does not show up. Can you help?

Author:  ibbly [ Thu Mar 08, 2007 12:53 pm ]
Post subject:  Workaround

As a workaround, I found that I can 'empty' the default text from the form fields, then use XTextFormatter to format up the new text...not as easy as just valuing the fields, but it works great! :)

Let me know if a solution is found to the original problem.

Thanks

Author:  Iwan [ Mon Mar 29, 2010 1:43 pm ]
Post subject:  Re: Losing formatting/data when valuing a form field

Hi,
I have been looking high and low for a solution to the same problem. Values that are assigned to fields are viewable (Either in Highlight fields mode or when editing the individual fields) when the document is saved and opened with adobe reader.
But wne printed fields are all blank.

I can see that you have found a workaround by
ibbly wrote:
'empty' the default text from the form fields, then use XTextFormatter to format up the new text


Could you be a bit more speciffic, code please :D

Thanks!

Author:  jlo [ Wed Jun 05, 2013 2:15 am ]
Post subject:  Re: Losing formatting/data when valuing a form field

you can see the value of the fields in acrobat

I suppose it's too much to ask for some documentation?

what are the properties etc of PdfCheckBoxField?

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