Itextsharp siging xfa form field is not found - itext

I have an xfa form created with adobe lifecycle designer. I can successfully fill the form, however it has signature fields I am unable to sign. When signing the field the code errors saying field is not found (I have the correct field name), however if i use adobe reader and sign the form, I can then resign it using the exact same code. I am using the example from Digital Signatures for PDF Documents by Bruno Lowagie -Sequential Signatures. Do I need to activate the signature field? Thanks for any help anyone can give.

Signing XFA forms is described in PAdES-5 and although you forgot to share any code, you are probably adding a signature as described in PAdES-2 or PAdES-3. In the past, we have implemented PAdES-5, but we never promoted that functionality because as far as I know, Adobe itself didn't follow the PAdES-5 standard. In other words: our code followed the standard, but it was useless because no one else implemented the standard. With ISO-32000-2, XFA has been deprecated which means that all further investment in XFA is money thrown away. It is surprising that you are still using XFA because the deprecation of XFA has been communicated many years ago.
Allow me to disect your question:
When you search for the signature field with iText, that field is not found. That is normal: the form is a pure XFA form. There is no AcroForm field to be found; the field is expressed in XML. iText only looks at AcroForm signature fields.
You can sign the document using Adobe Reader. Indeed, Adobe has implemented a way to sign XFA forms that is somewhat different than PAdES-5. During the signature process, an AcroForm signature field is created.
After you have signed the document using Adobe Reader, iText can see the field. Indeed, since Adobe Reader added an AcroForm signature field, iText can now detect it.
What are your options? If you can abandon XFA, do so. For instance: you could create forms based on the AcroForm technology instead of XFA forms. If that's not an option, you could flatten the form before signing it. That way, you will have an ordinary PDF to which you can add AcroForm signature fields.
If none of the above options work for you, your only option is to stick with Adobe software. That means buying licenses for Adobe LiveCycle ES. Be aware however that XFA is legacy software. If I were your CTO, I would not approve the use of XFA.

Related

Embed Marketo Web to PDF

A client has asked for our design team to embed a Marketo form into a Interactive PDF.
I've advised against it as:
I don't know it's possible ( They've claimed it is )
It's a bit pointless added forms to pdf's when they have a website and app both with forms...
So anyway, even being advised against it, they are detemined that want this form embedding in the PDF.
Does anyone have any ideas? The embed code ( Client sent me - Claims this is to work in PDF's )
<script src="//pages.name.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_00000"></form>
<script>MktoForms2.loadForm("//pages.name.com", "000-XMS-000", 00000);</script>
Any help would be appreciated
It's not possible... at least not embedded in a PDF. The JavaScript interpreter in Acrobat and other JavaScript-capable viewers do not use the HTML object model. It uses the JavaScript core and an object model specific to PDF. However, see my comment for another option.

How to check when a form was rendered in Laravel

Upon a form a submission, I wish to determine the time that a Laravel form (built using the Laravel Collective HTML package) was rendered to the user.
I need to check this date upon submission for a variety of reasons.
I have a large existing project and am considering the best way to get this date. I was reading the CSRF middleware (since this token is already included in all forms) to see if it can be extracted from that, perhaps in another middleware adding something like form_generated_date to the request.
It looks like a bit of a stretch, if possible at all. So now I am looking at adding a custom field to every form.
I would like this to be included in all forms, just as the Form::open() method will add the CSRF token. I found information on adding my own macros, but not about extending this method.
Does anyone know if it's possible to get the date from a CSRF token? Or how (or where the documentation is) to extend the Form::open() method.
The Form::open() method looks to be in the FormBuilder.php file (https://github.com/LaravelCollective/html/blob/2f6dc39ab3655724a615fe8a652d8b7f04fc9ac6/src/FormBuilder.php).
This file can be found in /vendor/laravelcollective/html/src/FormBuilder.php
You should be able to add a new hidden form field to the open method, bearing in mind that this will be overwritten in any updates. Not really recommended, but will achieve what you are looking for.

Any wordpress form building plugin for my requirements?

I'm looking for a WP plugin which can allow me to create different forms and embed them on pages and following are the requirements:
Only a single textbox required in each of those forms
The submit button will only be shown if a custom entry/answer is inputted into the textbox. (basically a client-side validation)
The submitted answer should be stored in the back-end with the usermeta (or just the username of the user logged in) so that I can export the entries in a format like csv, etc.
Any thoughts?
P.S. I have found one but not sure if the PRO version of this allows me to have a validation for a custom text. This is the plugin: http://wordpress.org/extend/plugins/visual-form-builder/
Gravity Forms is the most robust form builder plugin for WordPress. You can, with the right knowledge and skills, make it do pretty much anything you'd like. You can find it here: Gravity Forms.
Very well, I've found this. There are actually good plugins however, you will have to purchase it. I'm looking for a free one. http://www.webdesignboom.com/2013/formcraft-wordpress-form-builder/

dealing with itextsharp XMLWorkerHelper.ParseXHTML strict behavior

While trying to use XMLWorkerHelper.GetInstance().ParseXHTML() i find that it is really strict. Any wrong order of tags or unclosed tags will cause it to throw exception.
I am converting HTML that I have no control over.
Are there any flags to make it less strict? An input callback interface to handle funny markup? Anything in the itextsharp.tools.xml.html? Or an entirely new library compatible with itextsharp.text.IElement?
The name of the class and that method pretty much sums it up - you can't. The entire pipeline is based on the assumption that a valid XML document will be passed in, everything else will throw an exception. You can customize the pipeline and add your own handlers for things like link resolution, custom CSS properties and new HTML tags, but the core document processor still needs valid HTML.
I would recommend looking into running your HTML through a library that can convert it to XHTML.
EDIT
Also check out wkhtmltopdf. It uses webkit to render HTML and does (apparently) a pretty good job.
How to use wkhtmltopdf.exe in ASP.net
wkhtmltopdf.exe System.Security.SecurityException on cloud web server. How can i override server security policy
C# html to pdf converter using wkhtmltopdf or any other free tools

Is it safe to use only HTML editor instead of Textarea?

I am thinking of converting my forum input textarea exclusively to TinyMCE HTML editor. I already have both options but it is a pain maintaining both and inserting images in textarea needs preview etc...
This is more of a general question. Do you think it is safe to include HTML editor (with all the safety measures like paste only text, filter for html not allowed etc...) as the only kind of editor on a forum? It's 2011 and machines are generally fast, connection are better.
What are the downsides of using HTMl editor instead of text field? I can not imagine a blog CMS to have "normal" textarea for input.
But for some reason on forums I do not see many html editors... Even the TinyMCE site has a textarea for their editor. So is there really something to watch out for and a no go...?
I know it is more of a phylosophical question, but I guess you have experience with forums, blogs, etc...
My site is about cooking and beeing able to insert pictures (and upload them) the easy way seems to be a big plus for our home cooks ;-)
If you don't consider security (you'll need to filter the HTML input on the server side so it won't contain anything dangerous), there's only the user experience left for consideration. On a forum you write text most of the time. There's seldom any use for more functionality than bold, italics and images. The solution used here on Stack Overflow addresses this by having a very limited set of functions, and applying it in the textarea with a sane markup language.
Other forums either use old software or didn't think the improved user experience was worth the effort. The textarea-only solution fits most forums well enough since most of the input is text-only anyway.
I do think you would benefit from HTML input. Make sure that only allowed HTML can be sent though, since the user can circumvent everything on the client side.
TinyMCE uses Javascript to add functionality to an existing textarea. If Javascript is disabled, then the user will be presented with a normal textarea anyway.
I would say it's relatively safe, as long as all input from the user is validated on the server before it's used for anything.