Using PencilKit with PDFKit

I'm developing an app that allows you to view PDFs (music notes). I'm using PDFkit to display the pdf and need the pencilkit functionality while viewing the pdf (in the same way that you could mark up a book you are reading in iBooks when you click on the "Mark up" button). I am able to add a canvas on top of the pdf view however, I cannot save the canvas to be merged with the PDF. QuickLook offers a solution because the pencilkit looks to be built into it and works perfectly just the way I need it to, however, I don't need the other things that come with QuickLook. I desperately need your help with how I can get the pencilkit functionality on my custom PDF viewing app. At this point, I can't even find a solution for the "Mark up" button (pencil.tip.crop.circle) to be filled when tapped. Thank you in advance!

iOS 16 already has the support for overlays for every PDF page. WWDC22 had one video that explains how to implement this in 30 lines of code. I still could not manage it to work properly.

What's new in PDFKit - WWDC22 - Videos - Apple Developer

https://developer.apple.com › videos › play › wwdc2022

Hi ! I have q quick example here : <https://github.com/GuillaumeRossit/MyPencilKitOverPDFApp> It does not work in the correct document folder so save can't be done correctly, but if you transpose it to your own app, it should work.

Using PencilKit with PDFKit
 
 
Q