Save/export PDF file changes page numbers

Hi everyone

I have an iOS16 app that is using PDFKit to add annotations to PDFs, and I'm trying to track down an issue with some files getting corrupted when I save the annotations.

As part of this testing I am looking at the original PDFs in Preview. These documents are supplied by a third-party, so are not created by us.

It turns out, I have a problem simply exporting those PDFs from Preview in Monterey (12.6).

When I open a PDF document in Preview and Export it using the Reduce file size Quartz filter, the page numbers are messed up and the table of contents links become incorrect (out by 1 page).

The document originally had Roman numerals, I, II, III, IV, 1, 2 pages, and after exporting these page labels changed to 1, 2, 3, 4, 5, 6

This is what I am seeing in my app as well. What can I do to track down the cause, and hopefully find a solution or workaround?

Well I upgraded to Ventura to see if that would help, but now Preview just crashes when I try the above steps. Doh!

I might stop this line of investigation and try and focus on the code, and why PDFKit does not honour the page labels in this PDF.

If anyone has any suggestions in that area, I would appreciate any help.

thanks!

Save/export PDF file changes page numbers
 
 
Q