Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add page_size to InfoExtractor #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/docsplit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Docsplit
ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
ESCAPED_ROOT = ESCAPE[ROOT]

METADATA_KEYS = [:author, :date, :creator, :keywords, :producer, :subject, :title, :length]
METADATA_KEYS = [:author, :date, :creator, :keywords, :page_size, :producer, :subject, :title, :length]

GM_FORMATS = ["image/gif", "image/jpeg", "image/png", "image/x-ms-bmp", "image/svg+xml", "image/tiff", "image/x-portable-bitmap", "application/postscript", "image/x-portable-pixmap"]

Expand Down
1 change: 1 addition & 0 deletions lib/docsplit/info_extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class InfoExtractor
:date => /^CreationDate:\s+([^\n]+)/,
:creator => /^Creator:\s+([^\n]+)/,
:keywords => /^Keywords:\s+([^\n]+)/,
:page_size=> /^Page size:\s+([^\n]+)/,
:producer => /^Producer:\s+([^\n]+)/,
:subject => /^Subject:\s+([^\n]+)/,
:title => /^Title:\s+([^\n]+)/,
Expand Down
7 changes: 6 additions & 1 deletion test/unit/test_extract_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ def test_length
assert 2 == Docsplit.extract_length('test/fixtures/obama_arts.pdf')
end

def test_page_size
assert "612 x 792 pts (letter)" == Docsplit.extract_page_size('test/fixtures/encrypted.pdf')
end

def test_producer
assert "Mac OS X 10.6.2 Quartz PDFContext" == Docsplit.extract_producer('test/fixtures/encrypted.pdf')
end
Expand All @@ -46,10 +50,11 @@ def test_extract_all
assert metadata[:author] == "mkommareddi"
assert metadata[:date] == "Thu Nov 29 14:54:46 2007"
assert metadata[:creator] == "PScript5.dll Version 5.2"
assert metadata[:page_size] == "612 x 792 pts (letter)"
assert metadata[:producer] == "Acrobat Distiller 8.1.0 (Windows)"
assert metadata[:title] == "Microsoft Word - Fact Sheet Arts 112907 FINAL.doc"
assert metadata[:length] == 2
assert metadata.length == 6
assert metadata.length == 7
end

end