Python copy page to new PDF and preserve tags for pdf/UA

Product: PDFNetPython3

Product Version: 9.5.0.post1

Please give a brief summary of your issue:
(Think of this as an email subject)
Need ability to extract pages from source PDF and copy to new PDF while preserving tag for pdf/ua

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
Here is sample code:

import sys
from PDFNetPython3 import PDFNet
from PDFNetPython3 import PDFDoc

def main():
    PDFNet.Initialize(license)

    in_doc = PDFDoc("./test.pdf")
    in_doc.InitSecurityHandler()

    new_doc = PDFDoc()

    page = in_doc.GetPage(1)
    pg = new_doc.GetPageIterator(1)
    new_doc.PageInsert(pg, page)
    pg = new_doc.GetPageIterator(1)
    new_doc.PageInsert(pg, page)


    new_doc.Save("out.pdf", 0)
    in_doc.Close()
    new_doc.Close()

main()

If I run the out.pdf file through a tag inspector, no tags are present

Please provide a link to a minimal sample where the issue is reproducible:

Thank you for contacting us about this. Just to get a better understanding of the issue, can you please provide us with an example file with the tags present?

Here’s a sample PDF: https://allyant.com/wp-content/uploads/2022/12/accessible-pdf-example.pdf
The sample contains tags to support PDF/UA. The code above reads the PDF (renamed to test.pdf), extracts a page, and then saves the PDF. The saved PDF no longer contains the tags.

You can check tags (and PDF/UA compliance) using: Your PDF Accessibility Checker

Any updates on the PDF/UA tagging support on copy? thx!

Thank you for your patience with this. At this time, the PageInsert method does not yet support preserving tags for PDF/UA. We will look into potentially supporting this in a future release.

However, for now, you can use the SDK to extract tagging information and edit a document to add tagging features for PDF/UA such as alternate text: