Created
January 24, 2020 19:40
-
-
Save akiellor/1987bb1688ea2e85dbc27cc4c6361db1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reader = PDF::Reader.new('some.pdf') | |
filename = "transactions.csv" # obtain this from the XFA in the pdf | |
page = reader.pages.first | |
attachment_name_reference = page.objects.find do |k, v| | |
page.objects.obj_type(k) == :Hash && v[:Type] == :Filespec && v[:UF] == filename }.first | |
end | |
attachment_content_reference = page.objects[attachment_name_reference][:EF][:F] | |
attachment_content = page.objects[attachment_content_reference].unfiltered_data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment