Learn R Programming

gdiff (version 0.2-5)

samePDF: Compare Two PDF Files

Description

Check whether two PDF files have the same content, ignoring some details like creation time and modification time.

Usage

samePDF(file1, file2)

Value

A logical value.

Arguments

file1, file2

Names of PDF files to compare.

Author

Paul Murrell

Details

This function will compare any two files, byte by byte, but if a file is a PDF file that was generated by R, it will discard the file header, which may contain differences that do not matter, such as the creation date.

Examples

Run this code
f1 <- tempfile(fileext=".pdf")
f2 <- tempfile(fileext=".pdf")
pdf(f1)
plot(1)
dev.off()
pdf(f2)
plot(2)
dev.off()
samePDF(f1, f1)
samePDF(f1, f2)

Run the code above in your browser using DataLab