We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

CreateStyle

Thread ID:

Created:

Updated:

Platform:

Replies:

44813 Jun 4,2006 09:17 PM Jun 12,2006 02:59 PM ASP.NET Web Forms (Classic) 5
loading
Tags: PDF
Matt Ellison
Asked On June 4, 2006 09:17 PM

Hi, I am evaluating the EssentialPDF for purchase. Can someone explain to me how to user the IPDFForm.CreateStyle() method? Here''s what I''m trying to do: I have a PDF form with two fields. I need to programmatically discover the field names, set the value of the fields, and set their font and color properties as well. I have successfully set the values, but the font and colors are not working for me. Most likely I am simply leaving out some necessary code. I have tried this: // set field value - this works great doc.form.Fields["field1"].Value = "new value"; // set BackColor - this doesn''t work IPDFFieldStyle myStyle = doc.CreateStyle(); myStyle.BackColor = new PDFColor(Color.Red); doc.form.Fields["field1"].Style = myStyle; If I try to set doc.form.Fields["field1"].Style.BackColor property directly, I get an error that it''s not set to an instance of an object. Any help would be greatly appreciated. Thanks.

Ajish [Syncfusion]
Replied On June 5, 2006 02:10 AM

Hi Matt, Thank you for your interest in Essential PDF. The coding that you use to craete a style and set to the form field are perfect. But currently we do not have any support for setting style of a loaded document it works only with the generation of new form fields. Currently it is only possible to get/set values, name and type of the form fields of the loaded document. However we are working on this issue and it should be available very soon and I will send you an update as soon as it is available. Here is code to set/ get the form field type and name. foreach( IPDFField field in ldoc.Form.Fields ) { IPDFLoadedField lfield = field as IPDFLoadedField; MessageBox.Show("Field Name: " +lfield.Name + "\nField Type: "+lfield.Type.ToString()); if( lfield != null && lfield.Type == PDFFieldTypeEnum.TextField ) { lfield.Value = "Hello"; } } and here is a sample for your reference: FillForm.zip Please let me know if you have any other questions. Thanks, Ajish.

Matt Ellison
Replied On June 5, 2006 01:02 PM

Hi Ajish, Thanks for the prompt reply. Do you have a timeframe for when this functionality would be available? My project is time-sensitive but I like your product and would like to use it if this will be added soon. In the meantime, as a workaround, please let me know if this would work: (1) load the existing PDF form (2) iterate through the existing form fields (3) for each field, create a new field matching the exact size and location (bounds) of the existing field. (4) set the value, font, and color properties of the newly created field (5) delete/remove the original existing form field (6) add the newly created field to the existing PDF, thereby replacing the original form field If this sounds like a valid workaround please let me know and if possible what the code should be to do this. Thanks for your help, Matt

Ajish [Syncfusion]
Replied On June 6, 2006 10:40 AM

Hi Matt, Sorry for the delay in getting back to you. Currently it is only possible to get/set Value, Name and get the type of form field. But it is not possible to change the properties or remove field from form field collection. However I send you an update regarding the timeframe as soon as possible. Thanks, Ajish.

Matt Ellison
Replied On June 7, 2006 06:45 PM

OK, thanks for the update. Please let me know the timeframe for the next release as soon as possible. Thanks, Matt >Hi Matt, > >Sorry for the delay in getting back to you. Currently it is only possible to get/set Value, Name and get the type of form field. But it is not possible to change the properties or remove field from form field collection. However I send you an update regarding the timeframe as soon as possible. > >Thanks, >Ajish.

Administrator [Syncfusion]
Replied On June 12, 2006 02:59 PM

Hi Matt, After investigating this issue, the development team has informed me that it would not be possible to implement this functionality since the form''s fields appearance is stored in the PDF file as graphics primitives and we currently do not parse the graphics primitives when we read an existing PDF file. Currently the only possible solution is to get the bounds of the field and draw on top of it. Here is a sample FillForm_2003_6c712252.zip Issues with the sample -------------------------- 1) Currently it is not possible to get the page associated with a form field but this functionality can be added easily. 2) This approach does not permit modifying the font or color of text. Sorry for the confusion. Please let me know if you have any questions. Best regards, Stephen.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;