ZingPDF logo

Guide

How to rewrite a PDF without incremental history in C#

Call RemoveHistoryAsync() before SaveAsync(...) when you want the output written without the older incremental revision chain.

This matters when you want the saved file to contain the current document state without carrying forward the previous incremental history.

Rewrite the file before saving

If you want a clean output without the previous incremental revision chain, call RemoveHistoryAsync() and then save.

using ZingPDF;

using var pdf = Pdf.Load(File.OpenRead("input.pdf"));

await pdf.RemoveHistoryAsync();
await pdf.SaveAsync(File.Create("rewritten.pdf"));

Use it when the output should only reflect the current document state

A normal save path can preserve incremental history. That is fine in many workflows, but not all of them.

If the output is meant for downstream distribution, archival handoff, or a clean export after edits, rewriting the file can be the better choice.

It changes how the file is written, not what you changed

RemoveHistoryAsync() does not replace your other document updates. It changes how the final PDF is written so the older incremental chain is not carried into the saved output.

That makes it a useful last step after edits such as metadata updates, form filling, decryption, or other document changes.

Using this after decryption?

If your workflow starts with an encrypted input and ends with a plain output, this is the companion step to the decryption path.

Read How to remove a password from a PDF in C# without leaving old encrypted revisions behind.

Open save docs View pricing