2

I would like to know how to edit a pdf using apples new Pencilkit API. You could put a pdf underneath the PKCanvasView but this would not really change the PDF itself only my pkcanvasView. Any ideas or examples?

byaruhaf
  • 4,128
  • 2
  • 32
  • 50
Tupular
  • 21
  • 5

2 Answers2

1

Alternatively, you can integrate the QuickLook Framework. The iOS 13 SDK provides an editing mode in QuickLook. It embeds the PencilKit framework for PDF annotation. You can then save the edited PDF.

Here's a sample project demonstrating that: https://github.com/anupamchugh/iowncode/tree/master/iOS13QuickLook

AnupamChugh
  • 1,779
  • 1
  • 25
  • 36
0

You could generate an UIImage from the canvas with this:

let newImage = pkcanvasView.drawing.image(from: _, scale: _)

and add it to the pdf. You can get the drawing area with pkcanvasView.drawing.bounds.

Zouhair Sassi
  • 1,403
  • 1
  • 13
  • 30
kprater
  • 439
  • 4
  • 4