iOS/iPadOS 17.2 Bug in PDFKit duplicates content of filled PDF form fields

The following situation is given:

In your code you have a PDFDocument object. This contains a PDF file with form fields that are filled with text.

If you call the dataRepresentation() method on this PDFDocument object, you get back a data object:

let myDocumentData: Data = pdfDocument.dataRepresentation()!

If you now want to initialize a new PDFDocument object with this data object, the contents of the form fields are duplicated within the PDF.

let newPDF: PDFDocument = PDFDocument(data: myDocumentData)

If you now want to print the newPDF PDFDocument object by creating a new print job, you will get the following result:

What you actually expect to see:

You only see this behavior when you want to print or share the PDF. You won't see this behaviour inside a PDF View in your application.

This behaviour only appears since iOS/iPadOS 17.2

Steps to reproduce:

  1. Get a PDF file with form fields, especially text fields
  2. fill out these text fields with text
  3. create a PDFDocument object with this PDF file
  4. call the dataRepresentation() method on this PDFDocument object and store the result in a new variable
  5. create a new PDFDocument object with the data object created in the previous step:PDFDocument(data: <data>)
  6. Print the new created PDFDocument within iOS/iPadOS 17.2 or share it for example via email

I hope Apple will fix this bug soon!

Post not yet marked as solved Up vote post of Johnny44 Down vote post of Johnny44
817 views

Replies

Any luck finding some workaround that?

Were you able to solve this problem?

Were you able to find the solutions. We are also getting the same issue.

I have the same issue on IOS 17.2.1

@Johnny44 Did you find any solution for this?