Questions tagged [apple-pdfkit]

Questions related to the Apple PDFKit framework.

Questions related to the Apple PDFKit framework (https://developer.apple.com/documentation/pdfkit).

57 questions
1
vote
0 answers

PDFViewPageChanged not reliable in PDFKit

I have a view with different pdf documents and I'd like to be able to detect when each document reaches the last page. My approach is to observe PDFViewPageChanged notifications documentId = ... obs = NotificationCenter.default.addObserver(forName:…
onthemoon
  • 3,302
  • 3
  • 17
  • 24
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

How to highlight selected text in pdf using PDFKit?

I have set up a PDFViewer and would like to add a highlight functionality so that when a user selects text, they could highlight it. When you highlight text in notes, iMessages etc. you have the option to select all, copy, paste etc. How would you…
1
vote
1 answer

Swift PDF render any UIView or UIViewController PDFKit

I made some research, I found that I can draw Image, Strings, Shapes with the PDFKit library. Is there any easy way to draw a UIView or the view of a UIViewController inside the PDF document? I prefer a Swift answer, but I will accept Objective-C…
4bottiglie
  • 523
  • 7
  • 22
1
vote
1 answer

How to set the PDFPage Label and redraw the thumbnail?

I'm trying to create a multipage PDF file from NSImages in swift on macOS. How do i set the PDFPage label and how do i trigger the generation of the preview thumbnails. PDFPage has a variable for the…
Julian Hi
  • 11
  • 4
0
votes
0 answers

Memory Leak when processing PDFDocument in ShareExtension

I’m trying to import PDF documents to my app with the share extension. To avoid memory leaks, my plan is to import every page separately. I’ve removed many parts of my code to isolate the bug. But even without any CoreData context I’m still…
Lars
  • 1
  • 2
  • 1
0
votes
0 answers

Swift - Restriction of accessing user's documents

I have table view and a plus button, when button tapped it present a document picker, I select files then return to main screen. I store files by their urls, and present them via pdfkit framework. The problem is, after a while document selected, i…
0
votes
1 answer

How can I scale an image while retaining quality when creating a PDF in Swift on macOS?

I have a command-line Swift script that takes a series of images of close to the same pixel dimensions and creates a PDF from them. Part of what this script does is normalize the images so that each image is added as a page of the same height and…
Jerry Stratton
  • 3,287
  • 1
  • 22
  • 30
0
votes
0 answers

PDFKit Page Overlay not accepting user input

I'm trying to display a page overlay over a PDF using PDFKit's Page Overlay feature. My actual use case is to allow drawing input as per this WWDC tutorial, but for the sake of simplicity here, my example just displays a button as a test of user…
0
votes
1 answer

Swift PDFKit handle annotation widget change?

Is it possible to handle on change in swift pdf annotations? I would like to highlight the fields that need to be filled and then unhighlight when they have been filled. pdfView.document = PDFDocument(url: url!) for index in…
micah
  • 838
  • 7
  • 21
0
votes
2 answers

Update and Pass published variable value to view after click of Button

Summary: I have a list loaded from an API. Each list item have a button. On click of button, a unique ID associated with the list item is sent to server which in response provides a pdf directly there is no other response just a pdf file, the api is…
0
votes
0 answers

Using PDFKit to Open PDF in App Automatically after Downloading

Missing some connection which I am unable to figure out (also googled a lot still no success) in how to open PDF file in app. I am using PDFKit. This is the PDFKitView struct in which URL should be passed: struct PDFKitView: View { @State…
tintin
  • 335
  • 2
  • 8
0
votes
1 answer

How to annotate rounded, aspect-fill image in PDFView (swift PDFKit)

I am working on annotate an image to an existing PDFView. This is my current state: And below is my desired state: In one sentence, I want to achieve: a rounded corder of my image annotation image should also maintain the original aspect ratio I…
Jack Stark
  • 57
  • 7
0
votes
1 answer

How to prevent rendering artifacts in PDFKit/NSImage?

I'm trying to create a tool to rasterise vector images—stored in PDF files—on macOS, but the resulting images contain artifacts around the edges of some shapes. Preview.app, on the other hand, always renders the PDF flawlessly, as shown in this…
Robert
  • 5,735
  • 3
  • 40
  • 53
0
votes
1 answer

Possible encoding issues with PDFDocument

I am using PDFKit in a Mac app (Xcode 11.7, 10.15 deployment target) to view pdfs. Users are able to highlight selections and either copy the text, or create quotes. With some pdfs, I cannot get the correct string contents for the highlight. Take…
Giles
  • 1,428
  • 11
  • 21