Create PDF Forms in ios applications using Xamarin PDF library by Apitron. Written by Apitron Documentation Team

Similar documents
Create and load PDF Forms in Universal Applications using Windows Store and Windows Phone PDF library. Written by Apitron Documentation Team

Create PDF invoice in Windows Forms application. Written by Apitron Documentation Team

Access the TCNJ Palo Alto Networks VPN using the GlobalProtect VPN client

EBMS Secure . February 11, 2016 Instructions. Version 2

Ansur Test Executive. Users Manual

Viewing LogicalCHOICE ebook/epub Files

Workshare imanage Integration File Sharing & DMS Mobility. Getting Started Guide

Throughout this document, you will be instructed to log in as user Ann, or as user Julia. Log in using the user name assigned to you.

Submitting UITests at the Command Line

Printing Patterns to PDF. by Lisa Shanley, Ph.D.

Dawsonera v5 Online Reader User Guide (June 2015) Table of Contents

Sample Blog Articles!

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

You can access OneDrive through your Office 365 account at

Document OwnCloud Collaboration Server (DOCS) User Manual. How to Access Document Storage

Site Configuration Mobile Entrée 4

ASUS WebStorage Client-based for Windows [Advanced] User Manual

How to deploy fonts using Configuration Manager 2012 R2

Guide to PDF Publishing

Making Mobile a Reality

RDM+ Remote Desktop for Android. Getting Started Guide

ios Development Tutorial Nikhil Yadav CSE 40816/60816: Pervasive Health 09/09/2011

Using Adobe Dreamweaver CS4 (10.0)

Yammer Training Guide Facilitator s Notes

ESC Mobile App Guide

How to configure your Acrobat Signature Appearance

Mobile App Design and Development

What is OneDrive for Business at University of Greenwich? Accessing OneDrive from Office 365

Installing and viewing your ebooks

DroboAccess User Manual

2013 Honeywell Users Group Americas Symposium. Mobile App Guide

ESC Mobile App Guide

NAS 242 Using AiMaster on Your Mobile Devices

Mobile Print/Scan Guide for Brother iprint&scan

To Download Library Books Onto Your NOOK E-READER

Homework 9 Android App for Weather Forecast

FREQUENTLY ASKED QUESTIONS

Distributing forms and compiling forms data

How to install and use the File Sharing Outlook Plugin

End User Guide. July 22, 2015

Store & Share Quick Start

Checklist: 5 Essential BaaS Features Every Mobile App Needs

OneDrive for Business. (formerly SkyDrive Pro) An Introductory Briefing

DESIGNING MOBILE FRIENDLY S

Ricoh HotSpot. Printing App. User s Guide. HotSpot Printing App supports:

How to File the FBAR Electronically. The following steps describe the process of filing an FBAR electronically with our system.

CHAPTER 6: SEARCHING AN ONLINE DATABASE

Word 2010 to Office 365 for business

How To Create A Bada App On Android (Mainfest) On Android And Get A Download Of Bada (For Android) On A Microsoft Gosu 2.5 (For Black

ebooks: From Adobe InDesign to the Kindle Store

Icons: 1024x1024, 512x512, 180x180, 120x120, 114x114, 80x80, 60x60, 58x58, 57x57, 40x40, 29x29

Appendix A: Encrypting a File and / or Message

3M Cloud Library Reading Apps

Send from your App Part 1

Using e-books on mobile devices

Getting Started with the Naviance Student Mobile App

Create a PDF File. Tip. In this lesson, you will learn how to:

Reference Guide TEAM. Pogoplug Team. Reference Guide Cloud Engines Inc., All Rights Reserved.

Adobe Summit 2015 Lab 718: Managing Mobile Apps: A PhoneGap Enterprise Introduction for Marketers

Google Apps to Office 365 for business

AvePoint Timeline Pro for Microsoft Dynamics CRM. Installation and Configuration Guide

With a single download, the ADT Bundle includes everything you need to begin developing apps:

Sizmek Formats. IAB Mobile Pull. Build Guide

System Requirements and Technical Prerequisites for SAP SuccessFactors HCM Suite

Axis 360 Guides Table of Contents. Axis 360 & Blio ebooks with Android Devices (1/30/14)

Mobile: Getting Started with Workday for ipad

Read&Write 9 Home Version Download Instructions for Windows XP, Vista and 7

Microsoft Office for Mobile Devices (iphone, Windows Phone, Android Phone or ipad)

Soonr Workplace Enterprise Plan Overview

Wave 4.5. Wave ViewPoint Mobile 2.0. User Guide

New Features in XE8. Marco Cantù RAD Studio Product Manager

Generate Android App

Blue Touch Online FAQs for Software Downloads

MEAP Edition Manning Early Access Program Hello! ios Development version 14

Axis 360 ebooks & the Blio

IONU PRO Product Overview

Migrating Trend Micro Mobile Security for Enterprise (TMMS) 8.0 to TMMS 9.0 Patch 1

About Kobo Desktop Downloading and installing Kobo Desktop Installing Kobo Desktop for Windows... 5 Installing Kobo Desktop for Mac...

Editing and creating new pages and posts with the WordPress ios app

Information Rights Management in SharePoint. by André Vala

IONU BETA USER MANUAL IONU Security, Inc.

Centrify Mobile Authentication Services

ios Team Administration Guide (Legacy)

How To Develop An App For Ios (Windows)

Install MS Office 365 on your Android mobile device

Filemaker Go 12/13 pre-installed (available free of charge from the App Store)

Microsoft Office 2013

Building Mobile Applications Creating ios applications with jquery Mobile, PhoneGap, and Drupal 7

Xerox Mobile Link 2.0 Frequently Asked Questions (FAQ) - Android

Cloud Storage Service

Secure Mail Message Retrieval Instructions

LexisNexis Law School ebooks / etextbooks FAQs LexisNexis Store Purchases

Transcription:

Create PDF Forms in ios applications using Xamarin PDF library by Apitron Written by Apitron Documentation Team

Introduction In addition to Xamarin Android application that was recently highlighted in one of our articles, we created a similar sample for ios. It uses Apitron PDF Kit for pdf form generation and its PDF related code and data model are the same as used for Android app. The UI part is, of course, different but it could be generalized using Xamarin.Forms if needed. The complete sample can be found in Samples\Xamarin.iOS folder inside the download package available on our website. It s called CreateQuestionnaireFormSample. Note: this application has been tested using Apitron PDF Kit for.net(xamarin build) version 1.0.6 and iphone ios simulator device with ios 7.1 and ios 8.2 installed.

Solution overview Our single-view storyboard-based application starts with the launchscreen defined in launchscreen.xib and then transits to the main storyboard. Pic. 1 PDF form generation, ios app demo, launch screen

The demo ios application UI is implemented using the single storyboard containing several UITextField objects linked to corresponding outlets. These fields are being used for capturing the data and creation of the PDF form as well as for displaying loaded form data. By touching Clear one may reset the form. See the device screenshot below: Pic. 2 PDF form generation, ios app demo, main screen

When the user clicks Save form it starts pdf form generation. UIAlertView notifies whether the operation was completed successfully and offers to open the default preview if needed. For some reason ios QLPreviewController on simulator doesn t correctly show the created PDF form (it displays empty fields) while the regular OS X preview app does. Adobe Acrobat Reader opens this file without any problems. See the device screenshot below: Pic. 3 PDF form generation, ios app demo, generation completed

Resulting PDF file downloaded from the iphone simulator device is shown below: Pic. 4 Resulting PDF form generated by CreateQuestionnaireSampleForm ios application Form fields are made read-only so they can t be changed in reader app after generation. These fields store the information entered by user and can be used to retrieve the information back. This is how Load form works. Resulting file is being written to directory returned by the Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) call.

The code Complete Xamarin ios app code can be found in download package while here only the PDF generation part is being shown. It returns FlowDocument object which can later be saved. // Creates FlowDocument that represents PDF form. private FlowDocument CreatePDFDocument() // create documen with margin FlowDocument document = new FlowDocument()Margin = new Apitron.PDF.Kit.Styles.Thickness(10); // add form fields and set text values based on form data document.fields.add(new TextField("SelectedProduct", SelectedProduct)IsReadOnly = true); document.fields.add(new TextField("UsagePeriod", UsagePeriod) IsReadOnly = true ); document.fields.add(new TextField("SatisfactionLevel",SatisfactionLevel)IsReadOnly = true ); document.fields.add(new TextField("UserCompanyName", UserCompanyName) IsReadOnly = true ); document.fields.add(new TextField("Feedback",Feedback)IsReadOnly = true,ismultiline = true); // register styles defining controls appearance document.stylemanager.registerstyle(".formheader",new Apitron.PDF.Kit.Styles.Style()Display = Display.Block, Font = new Font(StandardFonts.HelveticaBold, 20)); // set style for textblock and textbox content elements using type selectors document.stylemanager.registerstyle("textblock, TextBox", new Apitron.PDF.Kit.Styles.Style() Font = new Font(StandardFonts.Helvetica, 14)); // set style for textbox followed by a textblock using adjacent element selector document.stylemanager.registerstyle("textblock + TextBox", new Apitron.PDF.Kit.Styles.Style() BorderColor=RgbColors.Black,Border=new Border(1),Height = 20,Background = RgbColors.LightGray); // set br style using type selector document.stylemanager.registerstyle("br", new Apitron.PDF.Kit.Styles.Style() Height = 10); // add form header document.add(new TextBlock("Product questionnaire form")class = "formheader"); document.add(new TextBlock("Generated on " + DateTime.Now.ToString("dd/MM/yyyy HH:mm"))); document.add(new Hr()Height = 2, Margin = new Thickness(0,5,0,5)); // add product info content document.add(new TextBlock("Selected product:")); document.add(new TextBox("SelectedProduct")); document.add(new Br()); // add usage info content document.add(new TextBlock("Usage period:")); document.add(new TextBox("UsagePeriod")); document.add(new Br()); // add satisfaction level content document.add(new TextBlock("SatisfactionLevel:")); document.add(new TextBox("SatisfactionLevel")); document.add(new Br()); // add company name content document.add(new TextBlock("User company name:")); document.add(new TextBox("UserCompanyName")); document.add(new Br()); // add feedback content document.add(new TextBlock("Feedback:")); document.add(new TextBox("Feedback")Height = 100); return document;

Load pdf form back from pdf file: /// <summary> /// Load form data from PDF file using given filename. /// </summary> public static ProductQuestionnaireForm Load(string filepath) try using (Stream inputstream = File.OpenRead(filePath)) // use fixed document for reading form data FixedDocument pdfdocument = new FixedDocument(inputStream); // create and initialize form object instance ProductQuestionnaireForm form = new ApitronProductQuestionnaireForm(); form.selectedproduct = ((TextField)pdfDocument.AcroForm["SelectedProduct"]).Text; form.usageperiod = ((TextField)pdfDocument.AcroForm[ "UsagePeriod"]).Text; form.satisfactionlevel = ((TextField)pdfDocument.AcroForm["SatisfactionLevel"]).Text; form.usercompanyname = ((TextField)pdfDocument.AcroForm["UserCompanyName"]).Text; form.feedback = ((TextField)pdfDocument.AcroForm[ "Feedback"]).Text; return form; catch (Exception e) Debug.WriteLine(e.Message); return null;

Conclusion If you need an easy to maintain and cost-effective PDF processing solution for targeting many platforms at once, Apitron PDF Kit is a good choice. It allows you to create applications and services for all modern desktop, cloud and mobile platforms. You can download the evaluation version with lots of C# samples demonstrating the API from our website (link). We ve also written a free book for you describing the API and containing ready to use code snippets. It covers most parts of the PDF specification with detailed explanations and provides real life usage examples. Contact us if you are interested or have any feedback.