Storing PDF edits

WebViewer Version:

Do you have an issue with a specific file(s)?
Can you reproduce using one of our samples or online demos?
Are you using the WebViewer server?
Does the issue only happen on certain browsers?
Is your issue related to a front-end framework?
Is your issue related to annotations?

Please give a brief summary of your issue:
(Think of this as an email subject)
Storing PDF Edits

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
Was wondering if you guys have best practices for storing PDF edits in SQL and rendering them on a page on load. My current idea was to store, original and changed text, but this doesnt account for font, highlight changes etc. On the BE was thinking of using content replacer to edit the text stream of the file originally stored in S3. Wondering if you guys have a full stack best practice. We use React FE and Python Fast API BE

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

1 Like

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.


Storing PDF edits efficiently involves capturing all changes, including text, annotations, and formatting. Using Apryse’s WebViewer, you can handle this through XFDF files for annotations and content replacement for text changes. Storing the original and edited content alone might not suffice for comprehensive changes like formatting or annotations.

Some things you can try:

  • Use Apryse’s XFDF format to store annotations separately. This can capture highlights, notes, and other annotation data.

  • For text changes, consider using the ContentReplacer API to apply text updates directly to the PDF content stream.

  • Store the original PDF in S3 and maintain a separate database record for each edit operation, linking them through identifiers.

  • On the backend, process the stored changes using Python and apply them to the PDF when it is loaded.

  • On the frontend, use React to fetch and render the PDF along with its stored edits using the WebViewer API.



Here are some resources that might help you:


Hopefully, this helps you solve your problem while you wait for a human to get back to you.

1 Like

Hi Neel,

Can you clarify what you mean by PDF edits?

Are you changing the text of the PDF through content replacer and wanting to store the text? A description in your use case would help us provide a answer.

1 Like

Yes I want to essentially store PDF edits whether that be actual text changes, or stylistic changes(font, font style etc, box resizing) Struggling to think of a extendable SQL schema to store all the possible edits a user can make. So was just wondering if there was an example or SOP for how to store these edits. Storing annotations was easy with XFDF data, but I don’t want to render those annotations over the text on doc load just have the pdf be edited

1 Like

Sorry, I’m a little confused what you mean by storing edits. Do you have any screenshots of examples of what you are trying to do?

What is the goal of storing the edits? Is it to be able to revert to a previous version of the PDF?

1 Like

When you enter the edit text toolbar group and you make text edit changes on the PDF(JavaScript Library to Edit Text on PDF Pages | Apryse documentation) I want to know how I can store those changes in a DB so I can apply them on load

1 Like

For Annotations I stored some metadata , the apryse annotation id, and the xfdf data. I want to know how/ or should I design a table to store edits and be able to either load them server side or apply them on client side

1 Like

Just wanted to bump this thread, the basic question is how to persist edits across refreshes?

1 Like

Going to bump one more time!

1 Like

Hello neel,

After looking into it, I didn’t find an obvious solution.

I will discuss this subject internally and come back to you when I have more information regarding this!

Best regards,
Mickaël.

1 Like

Hello neel,

Keeping and storing every change made to the document would be somewhat complex right now.

You could try to capture:

  • positioning changes using the event “annotationChanged”
  • text content changes using the event “textContentUpdated”

Currently, we don’t see events allowing you to capture the style updates, but even if you could make it, you would have to harmonize all of these sources, which would be tricky.

Pulling the sources from a DB query, you would likely need to associate them with a certain set of actions (move, scale, edit, style, etc) and have some of our API’s wrapped in functions to re-execute changes. This could create a lot of issues in corner cases since most of these actions are async by nature.

A previous solution to keep changes even in case of refresh was to extract and store PDF pages that have been edited, keeping a reference of the page number, and essentially maintaining a Stack of changes per user.

Best Regards,
Mickaël.

2 Likes