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

  • SEARCH
  • Home
  • 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 7525715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:37:44+00:00 2026-05-30T03:37:44+00:00

I am in the process of writing a Ruby script/app that helps me compiling

  • 0

I am in the process of writing a Ruby script/app that helps me compiling LaTeX to (at least) PDF. One feature I want it to have is that it should run pdflatex iteratively until the PDF converges (as it should, I guess).

The idea is to compare the PDF generated in one iteration against the one from the former iteration using their fingerprints. In particular, I currently use Digest::MD5.file(.).

The problem now is that this never converges. A (The, hopefully) culprit is the PDF’s timestamp that is set to the seconds at least by pdflatex. Since runs of pdflatex take typically longer than one second, the result keeps changing. That is, I expect the PDF’s to be equal up to the timestamp(s) after some point. This assumption might be wrong; hints appreciated.

What can I do about this? My basic ideas so far:

  • Use a library capable of doing the job
  • Strip meta data away and only hash PDF content
  • Overwrite timestamps by a fixed value before comparing

Do you have more ideas or even solutions? Solutions should only use free software that runs on Linux. Such that only use Ruby are preferred, but using external software is perfectly acceptable.

By the way, I do not exactly know how PDF is encoded but I suspect that merely comparing the contained text won’t work for me since only graphics or links might change in later iterations.

Possibly related:

  • How to compare two PDF files? (Messy, text-based or proprietary solutions)
  • Functional PDF Testing (Uses a Java library; not clear wether it is up to the job)
  • 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-05-30T03:37:45+00:00Added an answer on May 30, 2026 at 3:37 am

    This is probably not the most bullet-proof solution, but it works for me:

    grep -av -e '^/CreationDate' -e '^/ModDate' -e '^/ID' file.pdf | md5sum
    

    or from Ruby

    `grep -av -e '^/CreationDate' -e '^/ModDate' -e '^/ID' file.pdf | md5sum`.chop!
    

    This computes the PDF’s hash after dropping the lines that cause supposedly identical PDFs to differ.

    YMMV, depending on your PDF creator. To find out what other lines you need to drop, use

    diff -a file-1.pdf file-2.pdf | less
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a small app that needs to have a super easy install process.
I'm in the process of writing a python script, and I want to find
I am currently writing a quick script in Ruby that goes through all the
Im in the process of writing a python script to act as a glue
I am in the process of writing a Bluetooth scanner that locates and identifies
I am in the process of writing a menubar icon for an app i'm
I am the process of writing an update script, which pulls the latest version
I'm in the process of writing a bash script (just learning it) which needs
I am in the process of writing a class that will probably end up
I'm in the process of writing a scripting language and I want to copy

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.