Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

PdfTextRedline

OfficeIMO.Pdf

Namespace
OfficeIMO.Pdf
Assembly
OfficeIMO.Pdf
Source revision
ba882f6b0d07 with working tree changes
Modifiers
static

Compares the text of two PDFs word by word and marks the differences on the new PDF with review annotations.

Inheritance

  • object
  • PdfTextRedline

Remarks

Words are read in reading order from every page, so edits are found across line and page breaks and reflowed text is not reported as changed. Insertions and replacements get highlights; deletions get a caret at the point where the text was removed. Replacements, deletions and moves carry the old text in their pop-up note. Page content is not changed. This compares extracted text only; use PdfVisualComparer for rendered appearance.

Methods

public static PdfTextRedlineResult Compare(byte[] oldPdf, byte[] newPdf, PdfTextRedlineOptions? options = null, CancellationToken cancellationToken = default) #

Compares two PDFs and returns the annotated new PDF and the change list.

Parameters

oldPdf byte[] required
Original PDF.
newPdf byte[] required
Revised PDF; the annotations are added to a copy of it.
options OfficeIMO.Pdf.PdfTextRedlineOptions? = null optional
Comparison and annotation settings.
cancellationToken System.Threading.CancellationToken = default optional
Cancels the comparison.

Exceptions

  • ArgumentException – A PDF has no extractable text, for example a scan without a text layer.
public static PdfTextRedlineResult CompareFiles(string oldPath, string newPath, PdfTextRedlineOptions? options = null, CancellationToken cancellationToken = default) #

Compares two PDF files and returns the annotated new PDF and the change list.

Parameters

oldPath string required
newPath string required
options OfficeIMO.Pdf.PdfTextRedlineOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional