derekblair / ilpdfkit Goto Github PK
View Code? Open in Web Editor NEWA simple toolkit for filling out PDF forms in iOS.
License: MIT License
A simple toolkit for filling out PDF forms in iOS.
License: MIT License
When I dropped ILPDFKit
folder in a swift project I was't able to build it. Turns out I need to import UIKit and CoreGraphics for some classes in ILPDFKit
.
I can prepare PR if you need that.
Hi ,
I have found below issue in latest updated ILPDFKit
While jump to page 10 from page 1 , interactive Elements are not showing.
Ex. while navigating to 10th page it shows the elements of 5th page.
Navigating single page works fine.
I would like to save the PDF document in such a way that the form elements are flattened, but interactive URLs remain clickable. Can you give any info as to how to modify flattenedData:
method to achieve that? I looked over the class reference and can't seem to see anything that relates to clickable links.
Values filled by the library does show in the app, but it doesn't show up in Adobe Reader, they only appear only when you focus on the field. Any idea?
Do we need something extra while saving the filled values ?
Please help.
Thanks.
After editing and saving a form pdf, it doesnt open in acrobat reader. However, it opens in the browser.
When tried to save a pdf form which is created using pdf 1.5 and above, it results in save error.
But I can't import it manually in my project (mainly swift but may not be related).
ILPDFKit folder
to my project (mainly swift project)ARC
UIKit
QuartzCore
CoreGraphic
(seen it in project template)I compare the template project and mine and don't see what is wrong.
The only difference is
VERSUS
=> I don't see the problem...
If someone had a try one day to import it manually in swift project, tell me (so that I will understand where I am wrong right now^^)
After filling in some forms, I see this error in Adobe Acrobat when opening the PDF files:
"There was an error opening this document. The root object is missing or invalid."
Here is a link to a PDF form from around the Internet that do not work with ILPDFKit that show the above error:
http://www.stuart-design.co.uk/docs/Sample%20Fillable%20PDF%20Form.pdf
Here is another form that after I save it, I can view it in Preview but NOT in Adobe Acrobat:
http://www.thewebjockeys.com/TheWebJockeys/Fillable_PDF_Sample_from_TheWebJockeys_vC5.pdf
These are the very first two files that I tried - and neither of them currently works. Any idea what the issue might be?
Thanks!
Pod spec
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
xcodeproj 'Test.xcodeproj'
pod 'ILPDFKit', '0.0.6'
If you open up the ILPDFKit folder while it's installing, you'll see the code downloading as it should but at the last phase it'll delete all the source files.
I have no idea why it'd do that.
Here's the terminal printout
dtmac:trunk dt$ pod install --verbose
Preparing
Analyzing dependencies
Updating spec repositories
$ /usr/bin/git rev-parse >/dev/null 2>&1
Updating spec repo master
$ /usr/bin/git pull --ff-only
Already up-to-date.
Inspecting targets to integrate
Using ARCHS
setting to build architectures of target Pods
: (``)
Resolving dependencies of Podfile
Resolving dependencies for target `Pods' (iOS 7.0)
Comparing resolved specification to the sandbox manifest
A ILPDFKit
Downloading dependencies
-> Installing ILPDFKit (0.0.6)
Git download
Git download
$ /usr/bin/git clone https://github.com/iwelabs/ILPDFKit.git /Users/dtan/Projects/BMS/trunk/Pods/ILPDFKit --single-branch --depth 1 --branch 0.0.6
Cloning into '/Users/dt/Projects/test/trunk/Pods/ILPDFKit'...
Note: checking out 'c2590b9db8d81c1c26887b0d126119428dd77f5d'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
Generating Pods project
Pods-ILPDFKit
iOS 7.0Pods
iOS 7.0Pods/Pods.xcodeproj
Podfile.lock
Pods/Manifest.lock
Integrating client project
Integrating target Pods
(test.xcodeproj
project)
Was wondering how would one program in a check for a checkbox?
I have tried:
[_pdfViewController.document.forms setValue:@"Yes" forFormWithName:@"Married"];
[_pdfViewController.document.forms setValue:@"YES" forFormWithName:@"Married"];
[_pdfViewController.document.forms setValue:@"1" forFormWithName:@"Married"];
[_pdfViewController.document.forms setValue:@"Y" forFormWithName:@"Married"];
But none of them added a check to the box. I have checked and double checked the form name thinking I may have typed it in wrong but it is correct.
Thanks
Hi,
If the form has the ILPDFAnnotationFlagHidden, ILPDFAnnotationFlagInvisible o ILPDFAnnotationFlagNoView, createWidgetAnnotationViewForPageView returns nil. Later, the method updateWidgetAnnotationViews tries to add this nil view and add it to an array. The app crashes. Found using a pdf with those flags.
Thanks
Guillem
Hi, is there a way to change the font (size etc.) within the single acroforms when setting the text programmatically? Thank you.
I'm evaluating ILPDFKit with its sample app. I added a form which contains text fields with two different font sizes: 34 for the "label_title" field, while 16 for the others.
However, after filling out the form with the following code, and save it as static PDF, the resulting font sizes look different from the original ones.
Is there any way to make it follows the original font sizes? Alternatively, is there any way to set the font size problematically when filling out the form?
My form filling code:
`
let document = ILPDFDocument(resource:"sample_form")
document.forms.setValue("SAMPLE FORM", forFormWithName: "label_title")
document.forms.setValue("From: ", forFormWithName: "label_from")
document.forms.setValue("John Doe", forFormWithName: "field_from")
document.forms.setValue("Subject: ", forFormWithName: "label_subject")
document.forms.setValue("My Subject...", forFormWithName: "field_subject")
document.forms.setValue("Message: ", forFormWithName: "label_body")
document.forms.setValue("My Body...", forFormWithName: "field_body")
`
sample_form.pdf
Expected_Filled_Form.pdf
Thanks!
How to manage Image or Signature ?
Currently we can update TextField and Checkboxes, but what about updating a placeholder for image or signature ?
I'm running your project on an iPad with iOS 7.1 and I can't save any of your pdf files. Everything works in the simulator.
I get the Object Stream error.
Not sure if this library is still being developed/supported but I just noticed that when you render a PDF form with text boxes on multiple pages the boxes seems to be offset. For example on the first page everything is 100% perfect. However the second page the boxes are all slightly offset, third page even more so, etc. My guess is that the way it calculates the y margin might be a bit off as you add more pages. just curious if anyone has run into this issue. I'm on IOS 8 so not sure if it was an issue with previous versions (iPad/iPad mini/iPhone same issue). I'm trying to narrow down problem and will post if I figure anything out
For the most cases I'm able to open PDF with forms, but for a special file the app is crashing because of
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKeyedSubscript:]: unrecognized selector sent to instance
If find out that the ILPDFFormContainer is the reason for that. Especially in the populateNameTreeNode: method you expect a NSMutableDictionary, but in my case here it is an array:
...
NSMutableDictionary *dict = node[base]; // here in the dict var there comes an array and not dictionary, the base is "1" as STRING
if (dict == nil) {
dict = [NSMutableDictionary dictionary];
node[base] = dict;
}
[self populateNameTreeNode:dict withComponents:[components subarrayWithRange:NSMakeRange(1, [components count]-1)] final:final];
My bad solution was it to check for the class, and in case that it is not a dictionary I don't populate:
NSMutableDictionary *dict = node[base];
if (dict == nil) {
dict = [NSMutableDictionary dictionary];
node[base] = dict;
}
if ([dict isKindOfClass:[NSMutableDictionary class]])
{
[self populateNameTreeNode:dict withComponents:[components subarrayWithRange:NSMakeRange(1, [components count]-1)] final:final];
}
I have a form in my project, and this form has some textfield. I modify the textfield using follow code and this works:
document.forms.setValue( "Name", forFormWithName: "LabourName")
However, i want to change the font size of the text field in the form , named "LabourName". I have tried to change the font size of the form to 16 in the PDF, but when i set the text field in the form using above code, the font size still remain unchanged. How can i modify the font size or other property like bold words in text field? Thanksss.
I'm using ILPDFKit to extract some text from some PDF files generated by another iOS app. Now I'm having some issues with the encoding of the text in certain files. I convert the Contents
stream of an ILPDFPage into a string, then look for BT / ET pairs to extract the text.
For instance, one file contains the following text stream:
BT 0.03260000 Tc 7 0 0 7 0 0 Tm /Tc1 1 Tf [ (Las) 4 (t Name) ] TJ ET
from which I can easily extract the string Last Name
In another file (which has the same general format of the previous file, and which renders correctly on screen), I see the following string instead:
BT 0.03260000 Tc 7 0 0 7 0 0 Tm /TT2 1 Tf [ (!\"#) 4 ($%&\"\'\\() ] TJ ET
Why do I see those weird characters instead of the text Last Name
? What am I doing wrong?
The only difference between the two files, apparently, is that one was created on iOS 9, the other was created on iOS 10.
Dear
I am trying to display the PDF to custom view using ILPDFKit , not full screen view controller.
Let me know how can I use the ILPDFKit to display the PDF into custom view
Is there a way to mark the output file as readonly?
Anyway this is great, thanks!
As the topic, is that possible to save some inputs to editable pdf?
Can you educate me on how to save the flatPDF file within iOS app. My objective is to save the faltPDF file within app so that user can send this file via e-mail or airprint from the app.
Any help or guidance would really be appreciated
Regards,
I have here some special kind of editable PDF which is editable in Preview app and other desktop apps (also on windows) but shown as read-only through this library.. can u suggest whats the issue?
itext.pdf
If you are viewing a PDF, close the app with the Home button, then re-open the app- the PDF will change to a split half-black half-white screen.
It appears the app reopen flow calls into ILPDFViewController
calls
Which I assume is causing the blank.
If I change the function to:
- (void)loadPDFView {
[_pdfView removeFromSuperview];
if (!_pdfView) {
_pdfView = [[ILPDFView alloc] initWithDocument:_document];
}
[self.view addSubview:_pdfView];
}
It works.
Is it my implementation causing an issue? Or is this a viable fix.
Thanks for your work.
while checking ILPDFKit framework/library with WKWebView instead of UIWebView will showing some textfields on diffrent page then expected page while fast scrolling through PDF.
Using the project on iOS 10.2 makes the project crash -
Getting a lot of these errors:
invalid AES padding.
invalid AES block size.
Finally get this
2016-12-17 23:17:03.155 ILPDFKitExample[60071:559333] -[__NSDictionaryM addObject:]: unrecognized selector sent to instance 0x608000640720
2016-12-17 23:17:03.164 ILPDFKitExample[60071:559333] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM addObject:]: unrecognized selector sent to instance 0x608000640720'
First of all great library. I am working on adding annotations on a PDF with forms.. I am adding annotation in a PDF, but when opened through ILPDFKit they doesn't show up, but actually they are there..
Is there anything that you can help me ?
Check the sample PDF I have added an annotation here https://db.tt/6sqgvrul
I have a multi-page PDF that loads the first page however as soon as I scroll up to the second page it crashes the app and logs "Collection <__NSArrayM: 0x16084c530> was mutated while being enumerated."
assuming form is a PDFFormTypeButton
on = [_pdfDocument.forms setValue:@"1" forFormWithName:form.name];??
off = [_pdfDocument.forms setValue:@"0" forFormWithName:form.name];??
seems do not work
Hi,
When I put in a multi page form with fields set in Adobe Acrobat DC, all the fields are on page 1 of 5 and there are no fields on pages 2-5. Any idea why this happens and how I can fix it?
Font sizes on savedpdf would render the fontsizes to a bigger size than it normally was set.
The scenario in this screenshot below is that we created a pdf then added forms using Adobe acrobat, the problem relies now on filling the form fields the output results in larger font than what was set in the PDF.
[ILPDFForm associatedWidget] returns nil
I have date select field in my PDF and ILPDFKit considers that field as PDFFormType.Text.
When I'm setting value "01/11/16" to the field in PDF, ILPDFKit converts the value and prints it out as
"2016-01-11 01:13:36 +0000". Is there a way to just input "01/11/16" instead of "2016-01-11 01:13:36 +0000" ?
Unfortunately app crashes with iOS8.
It would be wonderful to be able to set checkboxes.
I've experienced that with some PDF (created with Acrobat 9 PDF version 1.3) some forms are all placed in the first page instead of the correct page.
Investigating the PDF structure, I've noticed that in some Form Widgets the reference to the Parent object is not present.
Besides the Form Widget is referenced from the Page Annots: Catalogue -> Pages -> Annots
Adding ILPDFKit with pods give me
ld: warning: directory not found for option '-F/Users/Summit/Documents/ios/crm/ParseLibraryV1.9.1'
duplicate symbol _checkKeys in:
/Users/Summit/Library/Developer/Xcode/DerivedData/crm-gcuupqssjsfapsfcnxxkuzzgwwfr/Build/Intermediates/crm.build/Debug-iphonesimulator/crm.build/Objects-normal/i386/PDFDictionary.o
/Users/Summit/Library/Developer/Xcode/DerivedData/crm-gcuupqssjsfapsfcnxxkuzzgwwfr/Build/Products/Debug-iphonesimulator/ILPDFKit/libILPDFKit.a(ILPDFDictionary.o)
ld: 1 duplicate symbol for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is very cool software! Thanks for making it open source.
I have been evaluating it for only an hour. Is there keyboard management to avoid text fields on the bottom of the view controller from being covered by the keyboard?
Along the same lines, re-centering the view if a selected field is covered by the keyboard would also be a great enhancement.
I'll try to dig in further to see if these are enhancements I can code up and submit as pull requests.
Great work! I already love this project.
Whenever I want to add characters to a textfield field with content
It seems that for the form I am testing all form data from each page is being rendered simultaneously on all pages. Is this what happens with flattenedData? Is there a way to address this?
I have been trying to upload a form that I edited with ILPDF on the Parse server but all it uploads is a blank one paged pdf.
I used adobe acrobat pro to create a new form to test out in the example program and only the radio buttons are coming up as fillable. I'm wondering if you did anything special to make ALL the fields show up so that I can fill them in on a custom form. Thanks!
If I enter text like "1234.56" into a small text field so that the text fills up all of the available space, for the most part the size of the text auto-shrinks to fill the available space. However, that functionality breaks when I zoom in and out - at some zoom levels the font size is too large and the field value is truncated to something like "123...". At other zoom levels the text is not truncated. Any ideas for a fix?
I've added a PDFViewController to a child container view:
let pdfVC = PDFViewController(path: path)
addChildViewController(pdfVC)
pdfVC.view.frame = containerView.bounds
containerView.addSubview(pdfVC.view)
pdfVC.didMoveToParentViewController(self)
And on rotation in ios8, a crash with no debug information occurs.
It seems to happen on _pdfView = nil
in PDFViewController.m.
Hi, when trying to iterate through the form container I get:
Type 'ILPDFFormContainer?' does not conform to protocol 'Sequence'
Any thoughts?
am I the only one ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.