uxmstudio / uxmpdfkit Goto Github PK
View Code? Open in Web Editor NEWAn iOS PDF viewer and annotator written in Swift that can be embedded into any application.
License: MIT License
An iOS PDF viewer and annotator written in Swift that can be embedded into any application.
License: MIT License
The memory keeps on increasing when there is a bigger pdf file and we highlight the text it eventually crashes the application.
Hi,
I'm trying to launch a single page PDF, and the POD crash in the PDFSinglePageViewer in cellForItemAtIndexPath
at line 102.
All works fine in 0.2.4 and start failing in 0.2.5.
ERROR:
In let cell:PDFSinglePageCell = self.dequeueReusableCellWithReuseIdentifier("ContentCell", forIndexPath: indexPath) as! PDFSinglePageCell
Thanks by advance :)
Thanks for taking your time to make this. I have a question i would like to ask.
I am using the single page collectionview to display a PDF, and i can zoom in on the content with pinching. Is it possible to zoom in with simply doubletapping on the collectionview?
If not, is it possible to add this function manually? Im new to programming and i've been trying to google this, without results.
Thanks in advance!
It would be great if this library could support reading INC annotations.
Uploading 6697225c-2d55-4792-b338-1761ee5283ac.pdf…
Seems the there is some weirdness with undoing annotations.
Using the example program built to an iPad Air 2:
Add annotation 1 (Text)
Add annotation 2 (Line)
Add annotation 3 (Highlight)
Click undo (both annotations 2 and 3 are undone)
Click "Back"
Click "Show Full PDF Viewer" (annotations 1 and 3 are visible?)
Can someone look into this...
I found there is huge memory leak in this library, When i tried to profile the issue the almost all (78 percent of memory id used by library and the leak tool points to following line as suspect . please Have a look once. Hope will be in good condition soon, waiting for issue be closed .
let thumbRender = PDFSnapshotRenderer(snapshot: thumbnail)
thumbRender.completionBlock = {
self.rendersInProgress.removeValue(forKey: guid)
DispatchQueue.main.async {
self.progressBlock?(thumbRender.snapshot)
completion?(thumbRender.snapshot)
}
There are some PDFs on which it's only possible to write on parts of the PDF and not the whole page. There are only some PDFs where this behaviour appears.
Hello, Thanks for this great library !
I have a question about colours, is it possible to change it (pen or/and text) ?
I would like doing a "undo" programmatically as well (I have a custom view to choose between different actions).
I don't want to change your code to keep this repository up-to-date in my project.
Thanks !
let pdf = PDFViewController(document: document)
pdf.showsScrubber = false
self.navigationController?.pushViewController(pdf, animated: true)
You will notice that the very first page has an empty placeholder for the scrubble.
Scroll a few pages forward and go back to the first page, and you will notice it will look normal as expected.
<!— Provide a general summary of the issue in the Title above —>
Want to load pdf from remote url rather than from local.
Please help.
func isModal() this is returning true because self.presentingViewController isn't nil.
im presenting like in the example
self.navigationController?.pushViewController(pdf, animated: true)
I am trying to use the example to extend the protocol and render onto a pdf but it isn't working.
When I use the following code
let renderer = PDFRenderController(document: self.document, controllers: [
self.annotationController,
self.formController
])
let pdf = renderer.renderOntoPDF()
I get an error that the PDFRenderController initializer is inaccessible due to the internal protection level.
Hi,
I am seeing this when the device is in landscape or portrait
The behavior of the UICollectionViewFlowLayout is not defined because:
the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x101544c00>, and it is attached to <UXMPDFKit.PDFSinglePageViewer: 0x10208d000; baseClass = UICollectionView; frame = (0 0; 1024 704); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x170054550>; layer = <CALayer: 0x17002d5a0>; contentOffset: {0, 0}; contentSize: {2048, 768}> collection view layout: <UICollectionViewFlowLayout: 0x101544c00>.
Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
Just wondering what could possibly be causing this?
Hi,
I've the following error building from Carthage:
Dependency "UXMPDFKit" has no shared framework schemes for any of the platforms: iOS
Thank you in advance,
Omar.
When I embed UXMPDFKit into my project, even without importing the framework in a particulat file, PDFDocument
object inside library cause Xcode fails to import new PDFKit.PDFDocument
and mark it as unavailable. I suggest renaming it to UXMPDFDocument
to avoid ambiguity.
Hi,
I am trying to extend the annotations with one of my own. However, to do this i need to subclass pdfviewcontroller and annotationcontroller and point to the new annotationcontroller in the new pdfviewcontroller. This is not possible because of access levels:
lazy var annotationController: PDFAnnotationController = PDFAnnotationController(document: self.document, delegate: self)
both document and annotationController have access level internal. Do i need to find a new route or am i doing something wrong here? It's my first time coding for ios, so it could well be :)
Thanks for your time
Anything in your code to start from?
"Add PDF level highlighting (instead of using a pen tool, select and highlight PDF text) ".
Is this distant to an early implementation? Is that it seems extremely important to be able to generate annotations more personalized I have been working on your pod and I find it difficult to continue without this I have taken a look at your code but I am not so expert yet, in the language.
The behavior of the UICollectionViewFlowLayout is not defined because:
the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
The relevant UICollectionViewFlowLayout instance is UICollectionViewFlowLayout:, and it is attached to <UXMPDFKit.PDFSinglePageViewer:;
Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
Any idea if its somthing on my end?
It is a very much required feature
Save filled in form values into original PDF
generating static PDF which is no longer editable
I am using your library in one of my projects. I am unable to render all the annotations onto the pdf. Lets say I first selected pen annotation and I drew my signatures. If I then call renderOntoPDF() method, the psd won't be saved with my signatures.
Now lets say I first selected pen annotation and drew my signatures. Now I again selected text annotation and wrote some text on to the pdf. This time only signatures would be rendered on calling renderOntoPDF() method. Both the annotations won't be saved. As an extract, last annotation is not saved. This also happens with the demo project on github. Can you please help me out with this issue. I am about to launch my application. I am only left with this issue.
Here is the video:
demo.zip
It might be nice to add the ability to set a custom action to trigger when the share form bar button is tapped, instead of always bringing up the UIActivityViewController
.
This might be accomplished by defining an action style enum on PDFViewController
, something to the effect of:
/// Action button style
public enum ActionStyle {
/// Brings up an activity sheet to share or open PDF in another app
case activitySheet
/// Performs a custom action
case customAction((Void) -> ())
}
At the moment the only initialization possible with the PDFDocument is from an URL string.
I was wondering me if there's any plan to implement a version to support initialization from NSData.
Do you plan to add a color picker? Right now this works with hardcoded colors.
is the undo button supposed to work with the pen annotation? If not is this a planned feature and could it be implemented sometime soon?
Hi,
This is a really nice project, it would be great if you please include examples for adding Signature and Annotations.
Thanks
Couple suggestions for the checkboxes. Currently the checkboxes are invisible when not checked and even when checked they don't really look like checkboxes.
What I suggest is to configure the buttons as toggle buttons. You'll need two images, one for the checked appearance and the other for the unchecked appearance. Set the checked image for the selected state and the unchecked image for the normal state. Add an action method for touchupinside and button.selected = !button.selected. When the selected state is set the checkmark image will appear.
If you felt like it you can easily make a UIButton subclass with that behavior built in and just use that when you're building the checkmark button. This is probably best.
When rotating in horizontal paged mode PDF's become incorrect size. Depending on zoom level when rotating PDF might either become too small for page, or too large and not be able to be zoomed out.
Can you please release the support for swift 4?
Any updates on when this library will get support for swift 4
I noticed that didFinishLaunchingWithOptions is never called in the app delegate in the Example app. The prototype has changed. App Path never appears. This is with Xcode 8.1
This line in PDFFormField.swift always fails with the Sample2.pdf file.
if let flagsObj = dict["Ff"] as? UInt {
The type of the "Ff" field is some kind of pointer that doesn't cast to UInt. Consequently radio buttons are never detected.
UXMPDFKit is not rendering the all the Graphics involved in the pdf file, attached the sample pdf file which I was using to test different size and graphics in it.
It should render all contents including the graphics like images
is not rendering the all the Graphics involved in the pdf file
Attached screenshot and original pdf which was used for testing
<!— Provide a general summary of the issue in the Title above —>
I want to restrict the highlight and text annotations inside the PDFViewController while allowing the pen annotation.
Add boolean values to controller the buttons for each annotation inside PDFViewController. i.e. instead of having a catch-all allowsAnnotations
, have
allowHighlighterAnnotation
allowPenAnnotation
allowTextAnnotation
These booleans would be used inside the function fileprivate func rightBarButtons()
so that the buttons would not be appended in the navigation.
A single boolean value for allowsAnnotations
for the PDFViewController
Hi and first of all thanks for the work!
I encountered an issue while using the library : when I tried to create a PDFDocument instance for a file without a password, my first attempt was to call PDFDocument(filePath: path, password: nil)
, which caused my app to crash with mysterious error messages.
I managed to fixed it by calling PDFDocument(filePath: path, password: "")
.
This should be either stated clearly in the docs (maybe I've missed it?) or fixed in the code.
Cheers!
Previously, I used this piece of code to open a document and ask a password if the PDF appears to be password protected:
func openDocument() {
do {
document = try PDFDocument(filePath: pdfFilePath, password: password)
} catch let err {
switch err as? CGPDFDocumentError {
case .some(.passwordRequired):
askPassword(firstTime: true)
case .some(.couldNotUnlock):
askPassword(firstTime: false)
default:
break
}
return
}
DispatchQueue.main.async {
self.document?.currentPage = self.page
self.openViewer()
}
}
However, this doesn't work anymore as the exception thrown in CGPDFDocument.swift
isn't forwarded. Right now I have implemented this workaround just below the catch
above, but if feels dirty:
if document?.documentRef == nil {
askPassword(firstTime: true)
return
}
What would be the proper way to check if a PDF is password-protected?
Thanks,
Rutger
I'm a newbie in Swift and I don't know how to save the pdf file.
I use pod try UXMPDFKit to see how to save the pdf but can't see where is the code to save the pdf file.
When scrolling from page to page, the currentPage property does not get updated.
currentPage is updated to the current page
currentPage is always equal to 1, if the scrubber is not used
<!— Provide a set of steps to reproduce this bug. Include code if relevant —>
<!— Include as many relevant details about the environment you experienced the bug in —>
FYI, this line in PDFPageScrubber.swift isn't correct. The range for white is 0...1.0
var thumbBackgroundColor = UIColor(white: 255, alpha: 0.7)
I get this in the console when that line is executed.
2016-11-10 12:13:17.082533 UXMPDFKit_Example[76788:10357771] [Graphics] UIColor created with component values far outside the expected range. Set a breakpoint on UIColorBreakForOutOfRangeColorComponents to debug. This message will only be logged once.
Hi,
I just wondering if I can disable the PDF sharing. Is there an option or other ?
Thanks you by the advance.
Hi Chris,
First of all: great work! Thanks for this great PDF viewer.
If I set the PDFDocument to a specific page before initializing the PDFViewController with it, the page scrubber is shown at the correct page, but the document viewer isn't:
let document = PDFDocument(filePath: pdfFilePath)
document.currentPage = 33
let pdfVc = PDFViewController(document: document)
Is this an easy fix?
Best regards,
Rutger
I receive PDF from my local gas billing company. It renders fine when I open with the Mail client pdf viewer. But when I open with UXM based custom app, one that I wrote, it shows only the image, not the text.
I cannot upload the PDF to this issue since it has my contact details on it. But if you want it to be shared in private, let me know.
Any plans on integrating vertical scroll? Would love it. Swiping is imo not as convinient as scrolling.
Basically the app we are working on has to be able to edit multiple page documents, and currently the library allows us to do this perfectly fine however after we scroll more than one page away from the first page it resets, and the filled out text boxes reset themselves. The pen annotations stay, but we need the editable elements native to the PDF to stay intact as well. Is there any parameter we can change to increase the memory so the edited page stays? Thanks in advance
I'm trying to put PDFViewController in my custom view "not PUSH VIEW"
to can add custom toolBar buttons on it.
So can you advise me how can I put this controller in my custom view?
<!— Include as many relevant details about the environment you experienced the bug in —>
Hi, I have a pdf text, how to copy text?
Hi! I've just build and run your Example Program with Xcode 8.0. It's OK for the first time after I click 'Show Full PDF Viewer', but the program crashed in a second when I back to ExampleViewController and click it again. The problem wasn't gone until I deleted the program in Simulator. And the problem comes again after I run the Example and click 'Show Full PDF Viewer'. Can you help to have a look please?
Very thanks!
'annotations = aDecoder.decodeObject(forKey: "annotations") as! [PDFAnnotation]' in PDFAnnotationStore
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.