PdfDocument.DocumentsAreEqual Method (Stream, Stream, PdfDecryptionHandler, PdfConfigurationOptions)

Docotic.Pdf library help > BitMiracle.Docotic.Pdf > PdfDocument Class > PdfDocument Methods > DocumentsAreEqual Method > DocumentsAreEqual Method (Stream, Stream, PdfDecryptionHandler, PdfConfigurationOptions)
Compares the data and structure of two PDF documents.

Namespace:  BitMiracle.Docotic.Pdf
Assembly:  BitMiracle.Docotic.Pdf (in BitMiracle.Docotic.Pdf.dll)


public static bool DocumentsAreEqual(
	Stream firstDocument,
	Stream secondDocument,
	PdfDecryptionHandler handler,
	PdfConfigurationOptions options
Public Shared Function DocumentsAreEqual ( 
	firstDocument As Stream,
	secondDocument As Stream,
	handler As PdfDecryptionHandler,
	options As PdfConfigurationOptions
) As Boolean


Type: System.IO.Stream
The stream that contains the data for the first PDF document.
Type: System.IO.Stream
The stream that contains the data for the second PDF document.
Type: BitMiracle.Docotic.Pdf.PdfDecryptionHandler
The decryption handler to use to decrypt both streams.
Type: BitMiracle.Docotic.Pdf.PdfConfigurationOptions
The configuration options.

Return Value

Type: Boolean
true if documents are equal; otherwise false.


This method is useful for regression tests when you compare two versions of the same document.

The firstDocument and the secondDocument must be streams that allow reading and seeking. Otherwise, the method throws an exception of PdfException type.

The method uses decryption handler specified by the handler parameter for both files. It's assumed that both files encrypted using the same encryption handler or both files are not encrypted at all.

This method ignores time-dependent document properties like CreationDate and ModifiedDate. Document metadata, trailer IDs and some other auto-generated properties are also get ignored.

See Also