# Compare PDF or other file types

**URL:** <https://forums.eggplantsoftware.com/t/compare-pdf-or-other-file-types/7734>\
**Category:** Eggplant Functional\
**Tags:** eggplant-functional\
**Created:** [January 18, 2022, 10:16am UTC](https://forums.eggplantsoftware.com/t/compare-pdf-or-other-file-types/7734 "2022-01-18T10:16:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tester](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/t/e274bd/32.png) [@tester](https://forums.eggplantsoftware.com/u/tester)\
**Post date:** [January 18, 2022, 10:16am UTC](https://forums.eggplantsoftware.com/t/compare-pdf-or-other-file-types/7734/1 "2022-01-18T10:16:38Z")

</div>

Hi,

I am new in Eggplant.  
Is it possible to compare two PDFs (or two XMLs)?

-Can i use therefore Compare Screen as it is described here: [Using Compare Screen for UI Testing](https://docs.eggplantsoftware.com/ePF/using/epf-compare-screen-ui-testing.htm) ?

-If so, is it necessary that the pdf (or xml) file is visible/opened or is it enough when the file is just saved?

-And if the PDF(Xml) containes more pages(lines), or the pages (lines) do not fit to the screen, is that a problem für Eggplant Functional? How does it work? Does it scrolls automatically?

Please share your experience with those use cases 🙂

Thanks in advance for your help!  
Best regards

---

<div class="post-metadata">

**Author:** ![LoganC](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/loganc/32/123_2.png) [@LoganC](https://forums.eggplantsoftware.com/u/LoganC)\
**Post date:** [January 19, 2022, 12:37am UTC](https://forums.eggplantsoftware.com/t/compare-pdf-or-other-file-types/7734/2 "2022-01-19T00:37:38Z")

</div>

In my experience it is far better to compare parts of the xml or pdf that matter to you (you can compare a lot of parts in series). I usually do this by simply trying to find baseline captures within the new (under test) page, but Compare Screen does work well and you can define a rectangle when using it.  
The problem with Compare Screen is that we usually don’t care about minor differences that tend to crop up everywhere. Though you can define areas to ignore.  
Its also relatively easy to grab chunks (or all) of text and compare that, so if you don’t care too much about formatting I highly recommend  
typetext controlkey, “a” //or triple-click / double-click / mousedown moveto mouseup  
typetext controlkey, “c”  
put the remoteclipboard into MyTestText  
put “Baseline text” into MyBaselineText  
Assert that MyTestText = MyBaselineText with error

It does not scroll automatically. You can increase your resolution, but that is not a reasonable solution for multiple pages of data.

I knew a guy once who used Eggplant to fire up a file comparison tool on the SUT and just look to it for an indication of pass/fail and then took a capturescreen if it was no good. Kinda funny, but it worked for him.

I suggest trying to pin down what’s really important in your files and just compare them if you can. And use a combination of tools.

Hope that helps.

---

<div class="post-metadata">

**Author:** ![DaveHester](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/davehester/32/104_2.png) [@DaveHester](https://forums.eggplantsoftware.com/u/DaveHester)\
**Post date:** [January 25, 2022, 12:04pm UTC](https://forums.eggplantsoftware.com/t/compare-pdf-or-other-file-types/7734/3 "2022-01-25T12:04:28Z")

</div>

If you are content to compare XML files, you can use the following:

```auto
set myFileName1 to "xml1.xml"

set myFileName2 to "xml2.xml"

open file ResourcePath(myFileName1) for reading

open file ResourcePath(myFileName2) for reading

read from file ResourcePath(myFileName1) into myFileContents1

read from file ResourcePath(myFileName2) into myFileContents2

If myFileContents1 equals myFileContents2 then
	LogSuccess "The files match."
Else
	LogWarning "The files do not match."
End If

close file ResourcePath(myFileName1)

close file ResourcePath(myFileName2)

```

---

<div class="post-metadata">

**Author:** ![DamianVane](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@DamianVane](https://forums.eggplantsoftware.com/u/DamianVane)\
**Post date:** [November 4, 2026, 6:11am UTC](https://forums.eggplantsoftware.com/t/compare-pdf-or-other-file-types/7734/7 "2026-11-04T06:11:33Z")

</div>

When you evaluate changed documents, you need to compare changes in text, formatting, graphics, and page layout in PDFs or other file types. If you work with PDF files, a desktop PDF solution like **PDFChamp Compare PDF** is worth considering for organizing and evaluating documents offline. Its offline mode in Windows is handy for working with secret business data and you don’t need to install Adobe Acrobat for ordinary PDF chores. Just remember, scanned PDFs and large layout changes can make it tougher to see the variations in text. Having the original and changed files separate makes the review process more organized and decreases the danger of missing crucial changes.
