|
Rank: Newbie Groups: Member
Joined: 4/16/2020 Posts: 3
|
Hi EO team, in the context of "Creating Interactive Form Elements" it would be very nice if the attributes of an element would be accessible. Specifically in this case the `type` is missing, because not everything is an AcmTextBox (think radio button etc.). But even if it were there it'd be great to have a getter for any other attribute, not just some very special ones. Thanks! (edit: some typos)
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, It is possible for you query such information BEFORE the conversion using a HtmlToPdfSession object: https://www.essentialobjects.com/doc/pdf/htmltopdf/session.aspxIn the sample code provided in the above link, you can add code before RenderAsPDF call that calls WebView.EvalScript to run any JavaScript to return any value possible through JavaScript. In order to do that you would need to access the underlying WebView object. See here for sample code: https://www.essentialobjects.com/doc/eo.pdf.htmltopdfsession.runwebviewcallback_overload_1.aspxInside the anonymous function called by RunWebViewCallback, you can add code such as:
Code: C#
string type = (string)webView.EvalScript("document.getElementById('id1').type");
Note that this code runs BEFORE the conversion. So you may need to write some additional code to match information you get here with other information you acquired through the HtmlToPdfResult object. Hope this helps. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 4/16/2020 Posts: 3
|
Hey,
yeah, thanks, I see, currently we're working around it by adding classes like "acm-textbox" to distinguish the pdf elements to be added since we're in full control of the input html :)
If you don't mind it would still be great for the attributes to be accessible from the EO.Pdf.HtmlElement directly so we don't have to combine the info from two different representations.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
The reason that we did not include all attributes is for performance reasons. A HTML element can potentially have numerous attributes, including "expando" attributes set through JavaScript. It will introduce a significant performance hit if we were to duplicate all those properties after the page has already been discarded. As such we have only included a few "important" properties.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 4/16/2020 Posts: 3
|
Oh well, sounds reasonable. Thanks for your time though and have a nice day :)
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
You are very welcome. Please feel free to let us know if you have any more questions.
|
|