gettalong / hexapdf

Versatile PDF creation and manipulation for Ruby
https://hexapdf.gettalong.org
Other
1.22k stars 69 forks source link

Argument error on PDFs #167

Closed earthlingworks closed 2 years ago

earthlingworks commented 2 years ago

Hey Thomas! I have two different PDFs getting the same error:

ArgumentError ("+HH:MM", "-HH:MM", "UTC" or "A".."I","K".."Z" expected for utc_offset)

Code to reproduce:

require 'hexapdf'
​
document = HexaPDF::Document.open(ARGV[0])
document.write('/tmp/test.pdf', validate: false, optimize: true)

I'll send the PDFs through email. Thanks!

gettalong commented 2 years ago

Thanks for the files!

I have looked at the first one and it seems that it used invalid timestamps, ie. D:01211016165909+00'64'. I will probably just ignore such timestamps and return null values for them.

gettalong commented 2 years ago

@earthlingworks Just a quick update: The regular expression for matching valid dates was a bit too relaxed for the invalid timestamps in this file. I have modified it to be a bit more strict (while still allowing for the various [invalid] variations found in the wild).

It seems the timestamps in those files weren't properly converted to the needed format because the example I have given above would refer to the year 121...

I will push a fix release later today.

gettalong commented 2 years ago

@earthlingworks Just released the new version with the fix.

earthlingworks commented 2 years ago

Great, thank you!

Ruben

Founder, http://www.bidsketch.com Twitter: http://twitter.com/bidsketch

On Wed, Nov 24 2021 at 1:37 PM, Thomas Leitner < @.*** > wrote:

@earthlingworks ( https://github.com/earthlingworks ) Just released the new version with the fix.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub ( https://github.com/gettalong/hexapdf/issues/167#issuecomment-978262847 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AAJKPSSIPBZKBFJALZDAZTDUNVLH5ANCNFSM5IUU2NXA ). Triage notifications on the go with GitHub Mobile for iOS ( https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 ) or Android ( https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub ).