Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7737517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:01:13+00:00 2026-06-01T08:01:13+00:00

I am writing a library to generate PDF reports using prawn reports. One of

  • 0

I am writing a library to generate PDF reports using prawn reports.

One of the features I wish to my gem is the ability to provide means of testing the generation of reports.

The problem is that two visually equal PDFs can have different files.

Is there a way to make sure that 2 visually equal PDF have the same bits in the file? Something like XML canonicalization.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:01:14+00:00Added an answer on June 1, 2026 at 8:01 am

    ‘Visual equality’ (or visual similarity’: where only a small percentage of pixels is different for each page) of 2 different PDFs can occur even if the internal structure of PDF objects is very different. (Think of a page of ‘text’, which may use real fonts or which may use ‘outline’ vector graphics for each glyph’s shape…)

    That means this equality can only be determined by rendering the two files at the same resolution to page images and then comparing both image sets pixel by pixel. The result of the comparison could be another pixel image that shows all differing pixels as red, or, at your preference, just the number of pixels which do not agree.

    A scriptable way to do this with the help of ghostscript, pdftk and ImageMagick I’ve described in this answer:

    • How to unit test a Python function that draws PDF graphics?

    Alternatively, you may have a look at

    • diffpdf

    (which is available for Linux, Unix, Mac OS X and Windows): it also can compare two PDF files visually.


    [ Your literal question was this: “Is there a way to make sure that 2 visually equal PDF have the same bits in the file?” — However, I’m not sure if you really meant it that way — hence my above answer. Otherwise I’d have to say: If two PDF files are visually equal, just generate their respective MD5sum to determine if they have the same bits in each file… ]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been writing a library for my project (for now I am using
I am writing a library that will provide a collection of public types to
I'm writing a web applicaion in Eclipse, and I'm using the XStream Serialization Library
I'm writing a java app that creates a pdf from scratch using the pdfbox
Using the java.util.concurrent.locks.ReentrantLock library as follows: Two threads generate a random number and use
I'm writing a library that gathers various functions that I'll be using in different
I am writing a library which uses a few functions from the windows user32.dll
Ok I am writing a library that will be shard between unix and windows.
I'm writing a library for mobile devices. This library notifies the users when certain
I am writing a library that creates multiple elements inside a wrapper element, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.