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
3
votes
1 answer

Swift PDFKit: Inconsistent behaviour with PDFView.currentDestination and PDFView.go(to destination: PDFDestination)

Note: The question remains unsolved for now; the marked answer provides a good workaround - it works while the application is still open. Answers are still welcomed! Background I'm currently developing an app that consists of a full-screen PDFView,…
Lincoln Yan
  • 337
  • 1
  • 10
3
votes
1 answer

VNDocumentCameraScan to searchable PDF

I am currently trying to create a searchable PDFDocument after I have obtained a VNDocumentCameraScan with the help of the VNDocumentCameraViewController. Currently I only take the images of the scan and put them into a PDFDocument instance. func…
grahan
  • 2,148
  • 5
  • 29
  • 43
3
votes
3 answers

Swift PDFKit change background color

I'd like to change the background color of a pdf with apples PDFKit framework in Swift, but it doesn't work. It's not a problem to create some controls like a text or image and then use it but I want to change the color of the document itself. Does…
Niels
  • 375
  • 5
  • 15
3
votes
0 answers

PDF Reader night mode

I am working on a pdf reader but I am facing problem in creating night mode for a PDF Document. I have successfully created the new PDF Document with Black background and white foreground. but can not do for an already created document I am doing…
Awais Mobeen
  • 733
  • 11
  • 19
3
votes
2 answers

How to specify a filename when saving pdf document to iOS Files App?

Using the PDFKit I have created a pdf document within my app. I can successfully show it in a preview and from the preview controller I use the following code to present the user the share actions: @objc func shareAction(_ sender:…
Michael Konz
  • 503
  • 1
  • 3
  • 20
3
votes
1 answer

Unable to draw Image Annotation on iOS 13 and iPhones 11, XR etc by PDFKit

I have been assigned a task in which I was supposed to draw some images and some straight lines in between those images. I did it successfully by using this method, class PDFImageAnnotation: PDFAnnotation { var image: UIImage? …
Najam
  • 1,129
  • 11
  • 32
3
votes
1 answer

PDFKit: How to move current page in PDFView to a specific offset

Assuming there is only one page in the PDF. What I am trying to achieve: Save Zoom and offset of a PDFPage currently being viewed and show the page at exact same offset and zoom level when user comes back to that page. What I have achieved:…
Muhammad Irfan
  • 280
  • 3
  • 17
3
votes
1 answer

PDFKit bug, need to disable UIMenuItems

I am trying to disable UIMenuItems in PDFKit. I have implemented override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { return false } But MenuItems Copy and Select All are still active. The main reason I want…
hidden-username
  • 2,610
  • 3
  • 14
  • 19
3
votes
0 answers

PDFDestination is not giving me the right information (Apple PDFKit)

I've got a PDF file of a technical drawing that contains one page with bookmarks linking to specific areas of the document. When I click those bookmarks in Adobe Reader or Foxit Reader, it zooms to this specified area. But in Apple's Preview.app or…
heyfrank
  • 5,291
  • 3
  • 32
  • 46
3
votes
2 answers

How to search a PDF using PDFkit in Swift

My goal is to search for a string and then go to it. I have these three lines of code needed to implement it. I just know my thought process for getting there is missing something. I am not sure how to use .findstring. I read that it returns an…
mrwadepro
  • 229
  • 1
  • 6
  • 16
2
votes
0 answers

PDFDocument.write in Swift causes content corruption

I'm trying to save and load a PDF document using Swift's PDFDocument.write method, but encountered an issue where the textual content of the saved document was consistently corrupted compared to the original. For instance, "*" gets changed to "ú"…
Nguyễn Khắc Hào
  • 1,980
  • 2
  • 15
  • 25
2
votes
1 answer

Generating PDF from array of SwiftUI views

I'm building an identity app which is stored all locally within the app on device. Part of the app is the creation of IdentityCard for each user - with the standard things, name, image, position. The size of the card is a standard credit card size:…
markb
  • 1,100
  • 1
  • 15
  • 40
2
votes
1 answer

PDFKit - PDFPageOverlayViewProvider with PKCanvasView is not forwarding Touch events - WWDC22 Session 10089

I am trying to utilize the PDFPageOverlayViewProvider protocol of the PDFView class in the PDFKit framework introduced with iOS 16 in order to display a PencilKit PKCanvasView on top of a PDF document so that the user can draw stuff on the PDF. What…
larsschwegmann
  • 725
  • 1
  • 6
  • 14
2
votes
0 answers

How to draw upright annotation on a rotated PDFKit.PDFPage in iOS

1. Summarize the problem: I'm trying to draw annotations on PdfPage in iOS from a sample JSON data like this: "annotations": [ { "id": "1024", "start_x": 1.60162, "start_y": 565.139, "end_x": 131.333, …
Hung X. Tran
  • 43
  • 1
  • 6
2
votes
0 answers

Swift PDFKit how to scroll to specific point programmatically

I have vertical scrolling pdfView: var pdfView = PDFView() pdfView.displayDirection = .vertical pdfView.usePageViewController(false) pdfView.pageBreakMargins = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) …
cyj89317
  • 45
  • 4
1
2
3
8 9