uploadconvert 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/uploadconvert.rb +7 -4
- metadata +2 -2
data/lib/uploadconvert.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'docsplit'
|
3
3
|
require 'crack'
|
4
|
+
require 'pry'
|
4
5
|
|
5
6
|
class UploadConvert
|
6
7
|
|
@@ -35,7 +36,7 @@ class UploadConvert
|
|
35
36
|
# Extract and clean text
|
36
37
|
@text = detectPDFType
|
37
38
|
|
38
|
-
# Extract metadata and generate output
|
39
|
+
# Extract metadata and generate output
|
39
40
|
extractMetadataPDF
|
40
41
|
outhash = Hash.new
|
41
42
|
@metadata.each{|k, v| outhash[k] = v}
|
@@ -59,10 +60,11 @@ class UploadConvert
|
|
59
60
|
begin
|
60
61
|
Docsplit.extract_text(@input, :ocr => false, :output => "public/uploads")
|
61
62
|
outfile = @input.split(".pdf")
|
62
|
-
|
63
|
-
|
63
|
+
path = "public/uploads/" + outfile[0]
|
64
|
+
text = File.read(path+".txt")
|
65
|
+
|
64
66
|
# Clean up text and delete file
|
65
|
-
File.delete(
|
67
|
+
File.delete(path+".txt")
|
66
68
|
cleanPDF(text)
|
67
69
|
rescue
|
68
70
|
end
|
@@ -121,3 +123,4 @@ class UploadConvert
|
|
121
123
|
return @metadata
|
122
124
|
end
|
123
125
|
end
|
126
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uploadconvert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-23 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Converts documents to the appropriate format for Transparency Toolkit.
|
15
15
|
email: shidash@shidash.com
|