Questions tagged [ios-pdfkit]

This tag should only be used for questions related to PDFKit which is available for iOS as of iOS 11.0 and macOS as of 10.4.

PDFKit is a framework for iOS and macOS. Display and manipulate PDF documents in your applications.

131 questions
1
vote
1 answer

How can I properly pass an array in iOS PDFKit

I'm trying to in an [string] array for a PDF. Below is what I have so far. I am guess I need to do a foreach somewhere, but I'm not entirely sure. I thought something like this might work, but it does not. for entry in body { let…
Robert
  • 809
  • 3
  • 10
  • 19
1
vote
0 answers

PDFKit how to erase Ink annotation

I have followed some examples on the internet and I was able to draw Ink annotation using PDFKit . the problem now is that if I toggle button and choose eraser, how can I erase the annotation that I draw . I searched on the internet and tried some…
Sam
  • 67
  • 1
  • 6
1
vote
1 answer

Why am I not able to load valid PDF file with WKWebView?

I am trying to load PDF from URL using WKWebiew using following code and I have also added necessary delegate methods of WKWebiew. func loadPDFDocument() { if let url = URL(string: self.contentURL) { print("URL: \(url)") …
NSPratik
  • 4,714
  • 7
  • 51
  • 81
1
vote
0 answers

iOS PDFKit memory peak on device when zooming

I have a PDFView in a container view which has a pinch gesture recognizer. When I zoom on a real device memory gradually peaks up to 2-3 gb and crashes. On simulator memory won't even go above 20mb on a 100 pages sample pdf. What seems to be the…
x670
  • 75
  • 6
1
vote
2 answers

How to detect the orientation of a PDF page in Swift with PDFKit IOS

I'm trying to get the orientation property of a PDF document. The purpose is, I would like to add a button widget in a location that depends on the orientation of the PDF document. For example: func openPDFDocument() { if let…
Rami Ammoun
  • 855
  • 2
  • 10
  • 25
1
vote
0 answers

How to reduce the memory spike while zooming pdf PDFKIT?

I'm working on pdf ink annotation using apples PDFKit, when I do good amount of annotations and start zooming the pdf page, I notice spike in memory usage and as a result the pdf page hangs while zooming. I checked several answers and yet no…
Raj Kiran
  • 152
  • 1
  • 9
1
vote
1 answer

How to draw a line/stroke with custom pattern/image using core graphics?

Im working on a pdf annotation app, as of now i'm able to draw a line using image in "PDFAnnotationSubtype.stamp". Image: using below code: public class ImageAnnotation: PDFAnnotation{ init(with image: UIImage!, forBounds bounds: CGRect,…
Raj Kiran
  • 152
  • 1
  • 9
1
vote
1 answer

Is it possible to detect PDFView notifications with Coordinator in UIViewRepresentable?

I'm having great difficulty working out how to implement a PDFView using UIViewRepresentable. I understand that I can get variables from SwiftUI -> UIKit via a simple Binding. I understand that I need to use a Coordinator to detect PDFView…
swift--help
  • 637
  • 5
  • 15
1
vote
1 answer

How I can move/drag multiple views on pdf view?

What I am doing is that, I took pdf view, it contains one sample pdf. On top of that, I am adding more than 1 signatories(custom view) views, when user click on add button from navigation bar. Scene 1: When add first Signatory view (customview) on…
Nikita Patil
  • 674
  • 1
  • 7
  • 17
1
vote
0 answers

How do I password Protect a PDF / Encrypt a PDF in swift

I am trying to export a PDF with a password protection. Currently, My app directly exports the PDF File to the iOS Files app... How do I password protect it before exporting it? Here's my current code, Please do let me know what I have to change to…
user12808336
1
vote
0 answers

How do I use background fetch in iOS 13 to update pdfs?

I watched many videos and read many articles about the new background fetch in iOS 13, but I am still in the dark. I am making a dining app. Amongst other things I am presenting the menu for "today", which is changing every day. So far I use the…
1
vote
0 answers

How to cache a PDFDocument?

I am trying to cache a PDFDocument downloaded from Firebase but it is not working. I am using PDFKit to display the pdf. Here is the code I have: let cache = NSCache() func downloadPDF() { var thePdf =…
Noah-1
  • 396
  • 1
  • 5
  • 20
1
vote
0 answers

Is there a way to write into a CGPDFDictionaryRef (PDFKit)?

I can see a lot of methods to get values, I can even nicely map out the entire PDF into a dictionary (see this thread). But I could not find a way to write back into those dictionaries. I really just want to turn off a layer visibility. Just set a…
Geri Borbás
  • 15,810
  • 18
  • 109
  • 172
1
vote
1 answer

PDFPage's "setBounds" not crop the annotations applied to pdfpage

I am setting bounds of pdfpage to crop the page. it crop the page but not the annotations applied to it. page.setBounds(rect, for: .cropBox) by this code annotation applied to page will show over the cropped page as in image
Spanix Dev
  • 101
  • 6
1
vote
1 answer

Rotate PDF page with usePageViewController

I am working on PDFKit and try to rotate the page. It is rotating good but without using usePageViewController. With usePageViewController it won't update the frame of the page. // At defining PDFVIEW object pdfView.displayMode =…
Spanix Dev
  • 101
  • 6
1 2 3
8 9