gettalong / hexapdf

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

ArgumentError of "utc_offset out of range" #224

Closed earthlingworks closed 1 year ago

earthlingworks commented 1 year ago

Hey Thomas, we're seeing an ArgumentError on a PDF when optimize: true and the message is "utc_offset out of range".

Script to reproduce:


require 'down'
file = File.open(ARGV[0])
output_pdf = HexaPDF::Document.new(io: file)
​
output_pdf.write('outpt.pdf', validate: false) ```

I'll send the PDF through email to keep its contents private. Thanks!
gettalong commented 1 year ago

Thanks for the file! It contains timestamps like the following which are invalid:

D:20221215215639-76'00'
D:20221215215642-76'128'

Those timestamps are invalid 1) because of the trailing apostrophe and 2) because the time zone offset values for hours and minutes are not within 0-23 and 0-59 respectively.

The first error is already handled but not the second, so I will implement a work-around.

earthlingworks commented 1 year ago

Great. Thanks for the update!

gettalong commented 1 year ago

Fix is already implemented, will be in the next released.