Form XObject Reuse Example

Product: Python Apryse SDK

Product Version: apryse-sdk==10.3.0

Please give a brief summary of your issue:
How to use a form XObject across many pages in a PDF

Please describe your issue and provide steps to reproduce it:
Do you have an example of how to build form XObjects that are used across multiple pages? I’m currently building text elements into a footer on a 200+ page PDF. The footer is exactly the same, but I’m seeing that it’s adding to the file size. Would using a single form XObject for this be possible and reduce the file size?

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

Thank you for posting your question to our forum. We will provide you with an update as soon as possible.

Have you tried our Stamper that will take care of everything for you.

https://docs.apryse.com/api/PDFTronSDK/dotnetcore/pdftron.PDF.Stamper.html

There’s an embedded hyperlink in my footer. I’d tried the stamper before, but I couldn’t get it to support a link and extra styling (like underlines). Is that possible?

Otherwise, do you have an XObject example?

Hi @Ryan do you have any examples that I could use? Thanks!

Hi @Ryan trying again. Please see above for why we can’t use the Stamper. Do you have an example of how we can create our own XObject?

Sorry for the delay in a response.

If your footer is identical for every page, then you will want to use Stamper.StampPage where your source Page would have your hyperlink, with whatever formatting.

To create the formatted footer you could use our ElementBuilder sample as a starting point, or do HTML to PDF, see this post.

Note though, that if you just add text in a normal URL fashion, then most PDF readers will automatically detect that URL text and make in interactive.

If the above does not answer your question please provide screenshots/PDF showing what you want to get.

Okay thanks @Ryan. Stamp page worked! One question though- I’ve noticed if I stamp many pages ~300+ the file size still sometimes increases as if I’d not be using XObjects. Is there a limit under the hood to these?

If you are calling Stamper.StampPage once, then there would be one single XObject.

To investigate further, you could provide the output PDF and the code to generate it.