Browse files

Upgrading to JODConverter 3.0 beta 3. Adding PNG, GIF, JPG, TIF, and …

…BMP to the list of supported input formats.
  • Loading branch information...
1 parent 18363f9 commit 9afc0e9dc274dc9df67cab1ffe5380dbfe90f080 @jashkenas jashkenas committed Aug 23, 2010
View
3 lib/docsplit.rb
@@ -54,7 +54,8 @@ def self.extract_images(pdfs, opts={})
def self.extract_pdf(docs, opts={})
[docs].flatten.each do |doc|
basename = File.basename(doc, File.extname(doc))
- run "-jar #{ROOT}/vendor/jodconverter/jodconverter-cli-2.2.2.jar #{doc} #{opts[:output] || '.'}/#{basename}.pdf", [], {}
+ options = "-jar #{ROOT}/vendor/jodconverter/jodconverter-core-3.0-beta-3.jar -r #{ROOT}/vendor/conf/document-formats.js"
+ run "#{options} \"#{doc}\" \"#{opts[:output] || '.'}/#{basename}.pdf\"", [], {}
end
end
View
BIN test/fixtures/image.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
5 test/unit/test_convert_to_pdf.rb
@@ -12,6 +12,11 @@ def test_rtf_conversion
assert Dir["#{OUTPUT}/*.pdf"] == ["#{OUTPUT}/obama_hopes.pdf"]
end
+ def test_png_conversion
+ Docsplit.extract_pdf('test/fixtures/image.png', :output => OUTPUT)
+ assert Dir["#{OUTPUT}/*.pdf"] == ["#{OUTPUT}/image.pdf"]
+ end
+
def test_conversion_then_page_extraction
Docsplit.extract_pdf('test/fixtures/obama_veterans.doc', :output => OUTPUT)
Docsplit.extract_pages("#{OUTPUT}/obama_veterans.pdf", :output => OUTPUT)
View
236 vendor/conf/document-formats.js
@@ -0,0 +1,236 @@
+//
+// JODConverter Document Formats Configuration
+//
+[
+ {
+ "name": "Portable Document Format",
+ "extension": "pdf",
+ "mediaType": "application/pdf",
+ "storePropertiesByFamily": {
+ "DRAWING": {"FilterName": "draw_pdf_Export"},
+ "SPREADSHEET": {"FilterName": "calc_pdf_Export"},
+ "PRESENTATION": {"FilterName": "impress_pdf_Export"},
+ "TEXT": {"FilterName": "writer_pdf_Export"}
+ }
+ },
+ {
+ "name": "Macromedia Flash",
+ "extension": "swf",
+ "mediaType": "application/x-shockwave-flash",
+ "storePropertiesByFamily": {
+ "DRAWING": {"FilterName": "draw_flash_Export"},
+ "PRESENTATION": {"FilterName": "impress_flash_Export"}
+ }
+ },
+ {
+ "name": "HTML",
+ "extension": "html",
+ "mediaType": "text/html",
+ "inputFamily": "TEXT",
+ "storePropertiesByFamily": {
+ "SPREADSHEET": {"FilterName": "HTML (StarCalc)"},
+ "PRESENTATION": {"FilterName": "impress_html_Export"},
+ "TEXT": {"FilterName": "HTML (StarWriter)"}
+ }
+ },
+ {
+ "name": "OpenDocument Text",
+ "extension": "odt",
+ "mediaType": "application/vnd.oasis.opendocument.text",
+ "inputFamily": "TEXT",
+ "storePropertiesByFamily": {"TEXT": {"FilterName": "writer8"}}
+ },
+ {
+ "name": "OpenOffice.org 1.0 Text Document",
+ "extension": "sxw",
+ "mediaType": "application/vnd.sun.xml.writer",
+ "inputFamily": "TEXT",
+ "storePropertiesByFamily": {"TEXT": {"FilterName": "StarOffice XML (Writer)"}}
+ },
+ {
+ "name": "Microsoft Word",
+ "extension": "doc",
+ "mediaType": "application/msword",
+ "inputFamily": "TEXT",
+ "storePropertiesByFamily": {"TEXT": {"FilterName": "MS Word 97"}}
+ },
+ {
+ "name": "Microsoft Word 2007 XML",
+ "extension": "docx",
+ "mediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ "inputFamily": "TEXT"
+ },
+ {
+ "name": "Rich Text Format",
+ "extension": "rtf",
+ "mediaType": "text/rtf",
+ "inputFamily": "TEXT",
+ "storePropertiesByFamily": {"TEXT": {"FilterName": "Rich Text Format"}}
+ },
+ {
+ "name": "WordPerfect",
+ "extension": "wpd",
+ "mediaType": "application/wordperfect",
+ "inputFamily": "TEXT"
+ },
+ {
+ "name": "Plain Text",
+ "extension": "txt",
+ "mediaType": "text/plain",
+ "inputFamily": "TEXT",
+ "loadProperties": {
+ "FilterName": "Text (encoded)",
+ "FilterOptions": "utf8"
+ },
+ "storePropertiesByFamily": {"TEXT": {
+ "FilterName": "Text (encoded)",
+ "FilterOptions": "utf8"
+ }}
+ },
+ {
+ "name": "MediaWiki wikitext",
+ "extension": "wiki",
+ "mediaType": "text/x-wiki",
+ "storePropertiesByFamily": {"TEXT": {"FilterName": "MediaWiki"}}
+ },
+ {
+ "name": "OpenDocument Spreadsheet",
+ "extension": "ods",
+ "mediaType": "application/vnd.oasis.opendocument.spreadsheet",
+ "inputFamily": "SPREADSHEET",
+ "storePropertiesByFamily": {"SPREADSHEET": {"FilterName": "calc8"}}
+ },
+ {
+ "name": "OpenOffice.org 1.0 Spreadsheet",
+ "extension": "sxc",
+ "mediaType": "application/vnd.sun.xml.calc",
+ "inputFamily": "SPREADSHEET",
+ "storePropertiesByFamily": {"SPREADSHEET": {"FilterName": "StarOffice XML (Calc)"}}
+ },
+ {
+ "name": "Microsoft Excel",
+ "extension": "xls",
+ "mediaType": "application/vnd.ms-excel",
+ "inputFamily": "SPREADSHEET",
+ "storePropertiesByFamily": {"SPREADSHEET": {"FilterName": "MS Excel 97"}}
+ },
+ {
+ "name": "Microsoft Excel 2007 XML",
+ "extension": "xlsx",
+ "mediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ "inputFamily": "SPREADSHEET"
+ },
+ {
+ "name": "Comma Separated Values",
+ "extension": "csv",
+ "mediaType": "text/csv",
+ "inputFamily": "SPREADSHEET",
+ "loadProperties": {
+ "FilterName": "Text - txt - csv (StarCalc)",
+ "FilterOptions": "44,34,0"
+ },
+ "storePropertiesByFamily": {"SPREADSHEET": {
+ "FilterName": "Text - txt - csv (StarCalc)",
+ "FilterOptions": "44,34,0"
+ }}
+ },
+ {
+ "name": "Tab Separated Values",
+ "extension": "tsv",
+ "mediaType": "text/tab-separated-values",
+ "inputFamily": "SPREADSHEET",
+ "loadProperties": {
+ "FilterName": "Text - txt - csv (StarCalc)",
+ "FilterOptions": "9,34,0"
+ },
+ "storePropertiesByFamily": {"SPREADSHEET": {
+ "FilterName": "Text - txt - csv (StarCalc)",
+ "FilterOptions": "9,34,0"
+ }}
+ },
+ {
+ "name": "OpenDocument Presentation",
+ "extension": "odp",
+ "mediaType": "application/vnd.oasis.opendocument.presentation",
+ "inputFamily": "PRESENTATION",
+ "storePropertiesByFamily": {"PRESENTATION": {"FilterName": "impress8"}}
+ },
+ {
+ "name": "OpenOffice.org 1.0 Presentation",
+ "extension": "sxi",
+ "mediaType": "application/vnd.sun.xml.impress",
+ "inputFamily": "PRESENTATION",
+ "storePropertiesByFamily": {"PRESENTATION": {"FilterName": "StarOffice XML (Impress)"}}
+ },
+ {
+ "name": "Microsoft PowerPoint",
+ "extension": "ppt",
+ "mediaType": "application/vnd.ms-powerpoint",
+ "inputFamily": "PRESENTATION",
+ "storePropertiesByFamily": {"PRESENTATION": {"FilterName": "MS PowerPoint 97"}}
+ },
+ {
+ "name": "Microsoft PowerPoint 2007 XML",
+ "extension": "pptx",
+ "mediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
+ "inputFamily": "PRESENTATION"
+ },
+ {
+ "name": "OpenDocument Drawing",
+ "extension": "odg",
+ "mediaType": "application/vnd.oasis.opendocument.graphics",
+ "inputFamily": "DRAWING",
+ "storePropertiesByFamily": {"DRAWING": {"FilterName": "draw8"}}
+ },
+ {
+ "name": "Scalable Vector Graphics",
+ "extension": "svg",
+ "mediaType": "image/svg+xml",
+ "storePropertiesByFamily": {"DRAWING": {"FilterName": "draw_svg_Export"}}
+ },
+ {
+ "name": "Portable Network Graphic",
+ "extension": "png",
+ "mediaType": "image/png",
+ "storePropertiesByFamily": {
+ "DRAWING": {"FilterName": "draw_png_Export"},
+ "PRESENTATION": {"FilterName": "impress_png_Export"}
+ }
+ },
+ {
+ "name": "Graphics Interchange Format",
+ "extension": "gif",
+ "mediaType": "image/gif",
+ "storePropertiesByFamily": {
+ "DRAWING": {"FilterName": "draw_gif_Export"},
+ "PRESENTATION": {"FilterName": "impress_gif_Export"}
+ }
+ },
+ {
+ "name": "Joint Photographic Experts Group",
+ "extension": "jpg",
+ "mediaType": "image/jpeg",
+ "storePropertiesByFamily": {
+ "DRAWING": {"FilterName": "draw_jpg_Export"},
+ "PRESENTATION": {"FilterName": "impress_jpg_Export"}
+ }
+ },
+ {
+ "name": "Windows Bitmap",
+ "extension": "bmp",
+ "mediaType": "image/bmp",
+ "storePropertiesByFamily": {
+ "DRAWING": {"FilterName": "draw_bmp_Export"},
+ "PRESENTATION": {"FilterName": "impress_bmp_Export"}
+ }
+ },
+ {
+ "name": "Tagged Image File Format",
+ "extension": "tif",
+ "mediaType": "image/tiff",
+ "storePropertiesByFamily": {
+ "DRAWING": {"FilterName": "draw_tif_Export"},
+ "PRESENTATION": {"FilterName": "impress_tif_Export"}
+ }
+ }
+]
View
BIN vendor/jodconverter/commons-cli-1.1.jar
Binary file not shown.
View
BIN vendor/jodconverter/commons-cli-1.2.jar
Binary file not shown.
View
0 vendor/jodconverter/commons-io-1.4.jar 100755 → 100644
File mode changed.
View
BIN vendor/jodconverter/jodconverter-2.2.2.jar
Binary file not shown.
View
BIN vendor/jodconverter/jodconverter-cli-2.2.2.jar
Binary file not shown.
View
BIN vendor/jodconverter/jodconverter-core-3.0-beta-3.jar
Binary file not shown.
View
BIN vendor/jodconverter/json-20080701.jar
Binary file not shown.
View
BIN vendor/jodconverter/juh-3.0.1.jar → vendor/jodconverter/juh-3.1.0.jar 100755 → 100644
Binary file not shown.
View
BIN vendor/jodconverter/jurt-3.0.1.jar → vendor/jodconverter/jurt-3.1.0.jar 100755 → 100644
Binary file not shown.
View
BIN vendor/jodconverter/ridl-3.0.1.jar
Binary file not shown.
View
BIN vendor/jodconverter/ridl-3.1.0.jar
Binary file not shown.
View
BIN vendor/jodconverter/slf4j-api-1.5.6.jar
Binary file not shown.
View
BIN vendor/jodconverter/slf4j-jdk14-1.5.6.jar
Binary file not shown.
View
BIN vendor/jodconverter/unoil-3.0.1.jar
Binary file not shown.
View
BIN vendor/jodconverter/unoil-3.1.0.jar
Binary file not shown.

0 comments on commit 9afc0e9

Please sign in to comment.