# PdfTextRedline

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

Class 

`OfficeIMO.Pdf`

**Namespace**

`OfficeIMO.Pdf`

**Assembly**

`OfficeIMO.Pdf`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[PdfTextRedline.cs:24](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Pdf/Comparison/PdfTextRedline.cs#L24)

**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](/api/pdf/officeimo-pdf-pdfvisualcomparer/) for rendered appearance.

Filter members 

Show inherited

## Methods

`public static PdfTextRedlineResult Compare(byte[] oldPdf, byte[] newPdf, PdfTextRedlineOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-compare-byte-byte-officeimo-pdf-pdftextredlineoptions-threading-cancellationtoken)

[PdfTextRedline.cs:24](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Pdf/Comparison/PdfTextRedline.cs#L24)

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.

Returns

`PdfTextRedlineResult`

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)` [#](#method-comparefiles-string-string-officeimo-pdf-pdftextredlineoptions-threading-cancellationtoken)

[PdfTextRedline.cs:66](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Pdf/Comparison/PdfTextRedline.cs#L66)

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**

Returns

`PdfTextRedlineResult`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

<!-- PowerForge markdown artifact sha256:462847E56EB99C72418F0AB013EEBADBC14FAC3DB4D8FE64CA6C7412BFDCC562 -->
