Saving Processing Time with Smart PDF Forms
Are forms an integral part of how you do business? Is it your aim to change from paper to digital forms and documents? Are you looking for a way to create forms that allow your users to complete and submit them electronically? Do your forms need functionality that includes field validation, database calls, interactive elements, conditional logic and more? Then you have landed on the right page to learn all about these elements, when to use them and how to create Smart PDF Forms with all these elements in one handy SDK!
Contents
What are Smart Forms?
Smart forms are fillable forms that include elements such as electronic completion and submission, dynamic fields, conditional logic, database calls and more. These forms bring documents that were once 50-100% paper to 100% electronic documents. These forms allow you to capture data in a paperless fashion through digital means like, computers, mobile devices, handhelds, etc.
What are the different elements of smart forms?
- Fillable form fields – creating a form is one thing but making it fillable is another thing completely. By converting your form to PDF, a PDF reader, like Phantom, can easily analyse it and add form fields automatically making the document 100% digitally fillable. These form fields are assigned ID’s, so information can be pulled from them once submitted.
- Intelligent Fields and Conditional Logic – These are fields that change based on user input. Anticipate a user’s needs by adding field validation and logic to your smart forms. This could be to do basic math, executing custom JavaScript, unwanted boxes disappearing once another field has been selected, show/hide fields or much more. Intelligent fields and conditional logic are very important to protect the user experience of a form.
- Interactivity – Create forms that users can interact with elements such as time and date field to add their date of birth or a map to pin their home address. Make smart forms smarter for users so that they can give you the most concise information possible.
- Database calls – Connect your database with your smart forms so that you can pre-populate information or update database entries without needing to manually change things. Make workflow simple and easy to update!
- Attachments – Allow users to include attachments so they can give you the most up-to-date information you require to serve the users need.
- Digital Signatures – Allow the user to digitally sign the form to agree to terms and conditions and to acknowledge that all the information is correct. Reduce the number of touch points needed to get the job done through making the forms as comprehensive as possible.
How can PDF forms help your business?
- Healthcare: Hospitals, GPs, Dentists and other healthcare organizations can use forms to collect important information about patients before they are seen. JavaScript within form fields can control input data, including validation, and disable/enable fields for display. Once the patient submits the information it can be updated in the database for their doctor to review and study.
- Banking and Insurance – When applying for a loan or insurance cover, a lot of questions need to be asked, some mandatory and others only if users answer questions in one way. Create dynamics fields that follow a certain logic to quicken the application process while still asking all the important questions. Forms can then be signed by the applicant, so you don’t need to add an extra step to the already sometimes stressful process.
- Engineering – Engineering projects can be quite lengthy with a lot of information needed from many different departments. Tailor forms so that conditional logic can display questions respective of the personnel who is filling it in to make sure that all information is gathered, including blueprints and compliance documentation as attachments. This will greatly improve processes and decrease the amount of time taken to collect data for project updates.
The Benefits of Intelligent Forms
There are many benefits to creating intelligent forms for any industry. Below are just a few of these benefits.
- Celebrate being paperless – PDF forms allow you to capture data whenever, wherever, without needing to carry unnecessary paper and clipboards.
- Lower cost for processing submitted forms – you no longer must manually transfer data from a form to your database as you can link both together.
- Fewer data entry errors – By no longer relying on manual data entry and using integration to ensure smooth communication between forms and your database errors are significantly reduced
- Digital Signatures – Allow people to sign as part of the form reduces the time needed to process and enact contracts, etc.
- Save offline – Smart forms do not have to be filled in immediately so there is no pressure to fill in anything in one sitting
- Files can be attached to the form – attaching files can help back up answers to questions and can help you understand the users answers better
- Submitted forms can be linked to databases using XML data – As mentioned before your forms and database can communicate with each other so there is less work to be done manually
How to create Smart PDF forms?
Originally forms intended for online consumption were created in a Microsoft Word document, converted to a PDF and then through a PDF reader fields were assigned classes and conditional logic was added. This was then published online where users could download the PDF form, fill it out, save it and send it back to the company. This is in no way smart and is time consuming for those creating the forms. If you need to add a new field, you need to go back to Microsoft Word to make the change and start again.
Introducing Foxit’s smart PDF Form library which can programmatically show/hide fields, add conditional logic, create interactive elements and much more with a few lines of code. We even offer the ability to plug our forms into your database, so forms can be automatically pre-populated, or databases automatically updated once a form is submitted. Our technology is years ahead of the game when it comes to our competitors.
Not only that but, using our PDF SDK for Web you can host your forms online for users to fill out and submit, without needing users to download the form. Everything can be done in their browser leading to safer and secure form submissions every time. These forms can be viewed on a desktop or mobile device giving users more freedom to chose when to fill them in.
Creating a Smart PDF Form with Foxit PDF SDK
To create Smart Forms using PDF SDK, the first step is to create a PDF document, form object and page object to add the form fields in:
PDFDoc doc = new PDFDoc(); Form form = new Form(doc); // Create a blank new page and add some form fields. PDFPage page = doc.insertPage(0, PDFPage.e_SizeLetter); Once everything is prepared to add the form fields, you need to start by adding the submit button, the default appearance and the submit button action. // Add push button field. Control btn_submit = null; try { btn_submit = form.addControl(page, "Push Button Submit", Field.e_TypePushButton, new RectF(50, 750, 150, 780)); } catch (PDFException e) { e.printStackTrace(); } // Set default Appearance DefaultAppearance default_ap = new DefaultAppearance(); default_ap.setFlags(DefaultAppearance.e_FlagFont | DefaultAppearance.e_FlagFontSize | DefaultAppearance.e_FlagTextColor); try { default_ap.setFont(new Font(Font.e_StdIDHelveticaB)); } catch (PDFException e) { e.printStackTrace(); } default_ap.setText_size(12f); default_ap.setText_color(0x000000); // Set default appearance for form. try { form.setDefaultAppearance(default_ap); } catch (PDFException e) { e.printStackTrace(); } // Set Push Button appearance. Widget widget = null; try { widget = btn_submit.getWidget(); widget.setHighlightingMode(Annot.e_HighlightingPush); widget.setMKBorderColor(0xFF0000); widget.setMKBackgroundColor(0xF0F0F0); widget.setMKNormalCaption("Submit"); widget.resetAppearanceStream(); } catch (PDFException e) { e.printStackTrace(); } // Set submit form action. try { SubmitFormAction submit_action = new SubmitFormAction(Action.create(form.getDocument(), Action.e_TypeSubmitForm)); int count = form.getFieldCount(null); WStringArray name_array = new WStringArray(); for (int i = 0; i < count; i++) { name_array.add(form.getField(i, null).getName()); } submit_action.setFieldNames(name_array); submit_action.setURL("http://www.foxit.com"); widget.setAction(submit_action); } catch (PDFException e) { e.printStackTrace(); } System.out.println("Add button field.");
Now, add form fields to your form
// First, a very simple form field: Control control = form.addControl(page, "Text Field0", Field.e_TypeTextField, new RectF(50, 600, 90, 640)); control.getField().setValue("3"); // Update text field's appearance. control.getWidget().resetAppearanceStream(); // And now a form field with a Javascript action embedded to it to get the SUM of both text fields value: Control control2 = form.addControl(page, "Text Field2", Field.e_TypeTextField, new RectF(150, 600, 190, 640)); Field field2 = control2.getField(); //Javascript Action JavaScriptAction javascipt_action = new JavaScriptAction( Action.create(form.getDocument(), Action.e_TypeJavaScript)); javascipt_action .setScript("AFSimple_Calculate(\"SUM\", new Array (\"Text Field0\", \"Text Field1\"));"); AdditionalAction aa = new AdditionalAction(field2); aa.setAction(AdditionalAction.e_TriggerFieldRecalculateValue, javascipt_action); // Update text field's appearance. control2.getWidget().resetAppearanceStream();
You may refer to the PDF SDK download package for a demo on how to add other form fields such as combo boxes, radio buttons and to the API reference to other actions.