pdfshaver 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/LICENSE +21 -0
- data/Readme.md +21 -28
- data/bench/extract_doc.rb +3 -0
- data/bench/setup.rb +10 -3
- data/ext/pdfium_ruby/document.cpp +12 -5
- data/ext/pdfium_ruby/document.h +1 -3
- data/ext/pdfium_ruby/extconf.rb +36 -27
- data/ext/pdfium_ruby/page.cpp +31 -10
- data/ext/pdfium_ruby/page.h +15 -7
- data/ext/pdfium_ruby/pdfium_ruby.cpp +1 -1
- data/lib/pdfshaver/page.rb +5 -0
- data/lib/pdfshaver/version.rb +1 -1
- data/test/page_spec.rb +2 -0
- metadata +5 -4
- data/Gemfile.lock +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8f76428237b693ba33bc3c3f73482fa769ac19e
|
4
|
+
data.tar.gz: 948f9868b24deee695115999875b2bccddc915be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc2545b699bb2f8b16e4372434eb2a2c7c0a71c99eceb94353c09726b8a9e8bda8ed02f608f29775ec668cfc877e8190bfdde6907de62bb78819a8146e8bbe8d
|
7
|
+
data.tar.gz: da77e75e8435285efaef20bafcbb7fdcf2247560ef753727084d7e09f1472396080ab14f0e49c3af896bee8f378a070a09ef6a3b8318ff1e773431db505dd289
|
data/.gitignore
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Ted Han, Nathan Stitt, DocumentCloud, Investigative Reporters & Editors
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/Readme.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# N.B. THIS IS A WORK IN PROGRESS
|
4
4
|
|
5
|
-
Shave pages off of PDFs as images
|
5
|
+
Shave pages off of PDFs as images.
|
6
6
|
|
7
7
|
### Examples
|
8
8
|
|
@@ -17,51 +17,44 @@ copyright 2015 Ted Han, Nathan Stitt & DocumentCloud
|
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
20
|
-
PDFShaver is distributed as a Ruby gem. Once you have
|
20
|
+
PDFShaver is distributed as a Ruby gem. Once you have its dependencies installed, all you have to do is type `gem install pdfshaver` (although in some cases you'll need to stick a `sudo` before the command).
|
21
21
|
|
22
|
-
PDFShaver depends on [Google Chrome's `PDFium` library][pdfium], and for now, installing `PDFium` takes a little bit of doing.
|
22
|
+
PDFShaver depends on [Google Chrome's `PDFium` library][pdfium], and, for now, installing `PDFium` takes a little bit of doing.
|
23
23
|
|
24
24
|
[pdfium]: https://code.google.com/p/pdfium/
|
25
25
|
|
26
|
-
|
26
|
+
### Getting PDFium and FreeImage
|
27
27
|
|
28
|
-
|
28
|
+
#### On Ubuntu/Debian
|
29
29
|
|
30
|
+
We've built a .deb that you can download by running: `wget 'http://assets.documentcloud.org/pdfium/libpdfium-dev_20151024.163326_amd64.deb'`
|
30
31
|
|
31
|
-
|
32
|
-
Check whether you have the xcode command line tools installed by typing `xcode-select -p`. If this command returns something like `/Applications/Xcode.app/Contents/Developer` then you have the command line tools installed already.
|
32
|
+
Once you have downloaded the file, you can install it like this:
|
33
33
|
|
34
|
-
|
34
|
+
`sudo dpkg -i libpdfium-dev_20151024.163326_amd64.deb` (where `libpdfium-dev_20151024.163326_amd64.deb` is the name of the file you just downloaded)
|
35
35
|
|
36
|
-
|
36
|
+
And install FreeImage and FreeType:
|
37
37
|
|
38
|
-
|
38
|
+
`sudo apt-get install libfreeimage-dev libfreetype6-dev`
|
39
39
|
|
40
|
-
####
|
40
|
+
#### On OSX
|
41
41
|
|
42
|
-
|
42
|
+
You can use homebrew to install pdfium's current code using our Homebrew formula:
|
43
43
|
|
44
|
-
|
44
|
+
`brew install --HEAD https://raw.githubusercontent.com/knowtheory/homebrew/45606ddde3fdd657655208be0fb1a065e142a4f1/Library/Formula/pdfium.rb`
|
45
45
|
|
46
|
-
|
46
|
+
Then install FreeImage:
|
47
47
|
|
48
|
-
|
48
|
+
`brew install freeimage`
|
49
49
|
|
50
|
-
####
|
51
|
-
`sudo apt-get install build-essential`
|
52
|
-
#### `git`
|
53
|
-
`sudo apt-get install git`
|
54
|
-
#### FreeImage
|
55
|
-
`sudo apt-get install libfreeimage-dev`
|
50
|
+
#### On Windows
|
56
51
|
|
57
|
-
|
52
|
+
Unfortunately, we don't have a Windows package yet.
|
58
53
|
|
59
|
-
|
54
|
+
#### On other Linux/Unix systems
|
60
55
|
|
56
|
+
Sorry we don't have a release for your OS but we'd be happy to talk to you about how we packaged PDFium for OSX and Ubuntu if you'd like to help package PDFium for your distribution/os!
|
61
57
|
|
58
|
+
### Install PDFShaver
|
62
59
|
|
63
|
-
|
64
|
-
|
65
|
-
`git clone https://pdfium.googlesource.com/pdfium`
|
66
|
-
|
67
|
-
|
60
|
+
`gem install pdfshaver` (you may have to use `sudo gem` instead of just `gem`)
|
data/bench/setup.rb
CHANGED
@@ -2,17 +2,24 @@ require_relative '../lib/pdfshaver'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'pp'
|
4
4
|
|
5
|
+
def print_rss(message="", io=STDOUT)
|
6
|
+
io.puts "#{message} [RSS: #{`ps -eo rss,pid | grep #{Process.pid} | grep -v grep | awk '{ print $1; }'`.chomp}]"
|
7
|
+
end
|
8
|
+
|
5
9
|
def extract(doc_path, prefix=rand(10**10))
|
6
10
|
out_dir = File.join(".", "output", prefix.to_s)
|
7
11
|
FileUtils.mkdir_p(out_dir)
|
8
|
-
log = File.open(File.join(out_dir, "log.txt"), 'w')
|
9
|
-
log.sync = true
|
12
|
+
#log = File.open(File.join(out_dir, "log.txt"), 'w')
|
13
|
+
#log.sync = true
|
14
|
+
log = STDOUT
|
10
15
|
doc = PDFShaver::Document.new(doc_path)
|
11
16
|
doc.pages.each do |page|
|
17
|
+
log.puts("Waiting for confirmation...")
|
18
|
+
STDIN.gets
|
12
19
|
log.puts("#{Time.now}: rendering page #{page.number}")
|
13
20
|
# shamelessly stolen from http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-ready-for-production
|
14
21
|
log.puts "RSS: #{`ps -eo rss,pid | grep #{Process.pid} | grep -v grep | awk '{ print $1; }'`}"
|
15
|
-
|
22
|
+
GC.start
|
16
23
|
#log.puts(GC.stat)
|
17
24
|
easy_render(page, out_dir)
|
18
25
|
end
|
@@ -68,6 +68,17 @@ void Define_Document() {
|
|
68
68
|
CPP_RUBY_METHOD_FUNC(initialize_document_internals), -1);
|
69
69
|
};
|
70
70
|
|
71
|
+
// Because a PDFium document's lifecycle has some complexity,
|
72
|
+
// its ruby deallocator doesn't immediately release its memory.
|
73
|
+
// The deallocator instead defers to the C++ class to track when
|
74
|
+
// it should be deallocated.
|
75
|
+
static void destroy_document_when_safe(Document* document) {
|
76
|
+
document->flagDocumentAsReadyForRelease();
|
77
|
+
document->destroyUnlessPagesAreOpen();
|
78
|
+
}
|
79
|
+
|
80
|
+
// Whenever a PDFShaver::Document is created, create a C++ Document
|
81
|
+
// in the document instance.
|
71
82
|
VALUE document_allocate(VALUE rb_PDFShaver_Document) {
|
72
83
|
Document* document = new Document();
|
73
84
|
return Data_Wrap_Struct(rb_PDFShaver_Document, NULL, destroy_document_when_safe, document);
|
@@ -79,6 +90,7 @@ VALUE initialize_document_internals(int arg_count, VALUE* args, VALUE self) {
|
|
79
90
|
// `path` argument and an optional `options` hash.
|
80
91
|
VALUE path, options;
|
81
92
|
int number_of_args = rb_scan_args(arg_count, args, "11", &path, &options);
|
93
|
+
if (number_of_args > 1) { /* there are options */}
|
82
94
|
|
83
95
|
// attempt to open document.
|
84
96
|
// path should at this point be validated & known to exist.
|
@@ -121,8 +133,3 @@ void document_handle_parse_status(int status, VALUE path) {
|
|
121
133
|
// break;
|
122
134
|
//}
|
123
135
|
}
|
124
|
-
|
125
|
-
static void destroy_document_when_safe(Document* document) {
|
126
|
-
document->flagDocumentAsReadyForRelease();
|
127
|
-
document->destroyUnlessPagesAreOpen();
|
128
|
-
}
|
data/ext/pdfium_ruby/document.h
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
class Page;
|
6
6
|
#include "pdfium_ruby.h"
|
7
7
|
#include "fpdf_ext.h"
|
8
|
-
//#include "core/include/fpdfapi/fpdf_parser.h"
|
9
8
|
#include "page.h"
|
10
9
|
#include <unordered_set>
|
11
10
|
|
@@ -45,9 +44,8 @@ class Document {
|
|
45
44
|
std::unordered_set<Page*> open_pages;
|
46
45
|
};
|
47
46
|
|
48
|
-
static void destroy_document_when_safe(Document* document);
|
49
|
-
|
50
47
|
VALUE initialize_document_internals(int arg_count, VALUE* args, VALUE self);
|
51
48
|
VALUE document_allocate(VALUE rb_PDFShaver_Document);
|
49
|
+
//static void destroy_document_when_safe(Document* document);
|
52
50
|
void document_handle_parse_status(int status, VALUE path);
|
53
51
|
#endif // __DOCUMENT_H__
|
data/ext/pdfium_ruby/extconf.rb
CHANGED
@@ -1,52 +1,61 @@
|
|
1
1
|
require "mkmf"
|
2
2
|
require 'rbconfig'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
]
|
11
|
-
end.flatten + paths
|
3
|
+
|
4
|
+
# Take a set of directories to search (usually system paths)
|
5
|
+
# and append the paths that we expect to find PDFium's peices.
|
6
|
+
def append_search_paths_to search_dirs, search_suffixes
|
7
|
+
search_dirs.map do |dir|
|
8
|
+
search_suffixes.map{ |path| File.join(dir, path) }
|
9
|
+
end.flatten + search_dirs
|
12
10
|
end
|
13
11
|
|
14
|
-
|
15
|
-
/usr/local/lib
|
16
|
-
/usr/lib/
|
12
|
+
lib_dirs = %w[
|
13
|
+
/usr/local/Cellar/pdfium/HEAD/lib
|
14
|
+
/usr/local/lib/pdfium
|
15
|
+
/usr/lib/pdfium
|
16
|
+
/usr/local/lib
|
17
|
+
/usr/lib
|
17
18
|
]
|
18
|
-
|
19
|
+
header_dirs = %w[
|
20
|
+
/usr/local/Cellar/pdfium/HEAD/include
|
21
|
+
/usr/local/include/pdfium
|
22
|
+
/usr/include/pdfium
|
19
23
|
/usr/local/include/
|
20
24
|
/usr/include/
|
21
25
|
]
|
26
|
+
header_paths = [
|
27
|
+
'public',
|
28
|
+
File.join('core', 'include'),
|
29
|
+
File.join('fpdfsdk', 'include'),
|
30
|
+
File.join('third_party', 'base', 'numerics')
|
31
|
+
]
|
32
|
+
LIB_DIRS = append_search_paths_to lib_dirs, ['third_party']
|
33
|
+
HEADER_DIRS = append_search_paths_to header_dirs, header_paths
|
22
34
|
|
23
35
|
# Tell ruby we want to search in the specified paths
|
24
36
|
dir_config("pdfium", HEADER_DIRS, LIB_DIRS)
|
25
37
|
|
38
|
+
# lib order needs to be in dependency loaded order, or will not link properly.
|
26
39
|
LIB_FILES= %w[
|
27
40
|
javascript
|
28
41
|
bigint
|
29
|
-
|
42
|
+
fx_freetype
|
43
|
+
fx_agg
|
44
|
+
fx_lcms2
|
45
|
+
fx_libjpeg
|
46
|
+
fx_libopenjpeg
|
47
|
+
fx_zlib
|
48
|
+
fxedit
|
49
|
+
fxcrt
|
50
|
+
fxcodec
|
51
|
+
fxge
|
30
52
|
fpdfdoc
|
31
53
|
fpdftext
|
32
54
|
formfiller
|
33
|
-
icudata
|
34
|
-
icuuc
|
35
|
-
icui18n
|
36
|
-
v8_libbase
|
37
|
-
v8_base
|
38
|
-
v8_snapshot
|
39
|
-
v8_libplatform
|
40
|
-
jsapi
|
41
55
|
pdfwindow
|
42
|
-
fxedit
|
43
|
-
fxcrt
|
44
|
-
fxcodec
|
45
56
|
fpdfdoc
|
46
57
|
fdrm
|
47
|
-
fxge
|
48
58
|
fpdfapi
|
49
|
-
freetype
|
50
59
|
pdfium
|
51
60
|
pthread
|
52
61
|
freeimage
|
data/ext/pdfium_ruby/page.cpp
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
Page::Page() { this->opened = false; }
|
10
10
|
|
11
11
|
// When destroying a C++ Page, make sure to dispose of the internals properly.
|
12
|
-
// And notify the parent document that this page
|
12
|
+
// And notify the parent document that this page will no longer be used.
|
13
13
|
Page::~Page() {
|
14
14
|
if (this->opened) {
|
15
15
|
this->unload();
|
@@ -30,6 +30,7 @@ void Page::initialize(Document* document, int page_index) {
|
|
30
30
|
bool Page::load() {
|
31
31
|
if (!this->opened) {
|
32
32
|
this->fpdf_page = FPDF_LoadPage(this->document->fpdf_document, this->page_index);
|
33
|
+
this->text_page = FPDFText_LoadPage(this->fpdf_page);
|
33
34
|
this->opened = true;
|
34
35
|
}
|
35
36
|
return this->opened;
|
@@ -37,14 +38,18 @@ bool Page::load() {
|
|
37
38
|
|
38
39
|
// Unload the page (freeing the page's memory) and mark it as not open.
|
39
40
|
void Page::unload() {
|
40
|
-
if (this->opened){
|
41
|
+
if (this->opened){
|
42
|
+
FPDFText_ClosePage(this->text_page);
|
43
|
+
FPDF_ClosePage(this->fpdf_page);
|
44
|
+
}
|
41
45
|
this->opened = false;
|
42
46
|
}
|
43
47
|
|
44
48
|
// readers for the page's dimensions.
|
45
|
-
double Page::width(){
|
46
|
-
double Page::height(){
|
47
|
-
double Page::aspect() {
|
49
|
+
double Page::width() { return FPDF_GetPageWidth(this->fpdf_page); }
|
50
|
+
double Page::height() { return FPDF_GetPageHeight(this->fpdf_page); }
|
51
|
+
double Page::aspect() { return width() / height(); }
|
52
|
+
//int Page::text_length() { return FPDFText_CountChars(this->text_page); }
|
48
53
|
|
49
54
|
// Render the page to a destination path with the dimensions
|
50
55
|
// specified by width & height (or appropriate defaults).
|
@@ -156,14 +161,16 @@ void Define_Page() {
|
|
156
161
|
rb_define_private_method(rb_PDFShaver_Page, "unload_data", CPP_RUBY_METHOD_FUNC(page_unload_data), 0);
|
157
162
|
}
|
158
163
|
|
159
|
-
//
|
160
|
-
|
164
|
+
// the C++ page can be deleted when we're done with the Ruby page.
|
165
|
+
static void destroy_page(Page* page) { delete page; }
|
166
|
+
|
167
|
+
// Whenever a PDFShaver::Page is created, we'll create a new C++ Page object
|
168
|
+
// and store it in the newly created Ruby page instances, and inform it to
|
169
|
+
// clean the page up using `destroy_page`.
|
161
170
|
VALUE page_allocate(VALUE rb_PDFShaver_Page) {
|
162
171
|
Page* page = new Page();
|
163
172
|
return Data_Wrap_Struct(rb_PDFShaver_Page, NULL, destroy_page, page);
|
164
173
|
}
|
165
|
-
// And delete the C++ page when we're done with the Ruby page.
|
166
|
-
static void destroy_page(Page* page) { delete page; }
|
167
174
|
|
168
175
|
// This function does the actual initialization of the C++ page's internals
|
169
176
|
// defining which page of the document will be opened when `load_data` is called.
|
@@ -171,6 +178,7 @@ VALUE initialize_page_internals(int arg_count, VALUE* args, VALUE self) {
|
|
171
178
|
// use Ruby's argument scanner to pull out a required
|
172
179
|
VALUE rb_document, page_index, options;
|
173
180
|
int number_of_args = rb_scan_args(arg_count, args, "21", &rb_document, &page_index, &options);
|
181
|
+
if (number_of_args > 2) { /* there are options */ }
|
174
182
|
|
175
183
|
// fetch the C++ document from the Ruby document the page has been initialized with
|
176
184
|
Document* document;
|
@@ -191,6 +199,7 @@ VALUE page_load_data(VALUE self) {
|
|
191
199
|
rb_ivar_set(self, rb_intern("@width"), INT2FIX(page->width()));
|
192
200
|
rb_ivar_set(self, rb_intern("@height"), INT2FIX(page->height()));
|
193
201
|
rb_ivar_set(self, rb_intern("@aspect"), rb_float_new(page->aspect()));
|
202
|
+
//rb_ivar_set(self, rb_intern("@length"), INT2FIX(page->text_length()));
|
194
203
|
return Qtrue;
|
195
204
|
}
|
196
205
|
|
@@ -202,12 +211,24 @@ VALUE page_unload_data(VALUE self) {
|
|
202
211
|
return Qtrue;
|
203
212
|
}
|
204
213
|
|
214
|
+
//VALUE page_text_length(VALUE self) {
|
215
|
+
// Page* page;
|
216
|
+
// Data_Get_Struct(self, Page, page);
|
217
|
+
// return INT2FIX(page->text_length());
|
218
|
+
//}
|
219
|
+
|
220
|
+
//VALUE page_text(VALUE self) {
|
221
|
+
// Page* page;
|
222
|
+
// Data_Get_Struct(self, Page, page);
|
223
|
+
// return INT2FIX(page->text());
|
224
|
+
//}
|
225
|
+
|
205
226
|
//bool page_render(int arg_count, VALUE* args, VALUE self) {
|
206
227
|
VALUE page_render(int arg_count, VALUE* args, VALUE self) {
|
207
228
|
VALUE path, options;
|
208
229
|
int width = 0, height = 0;
|
209
230
|
|
210
|
-
|
231
|
+
rb_scan_args(arg_count, args, "1:", &path, &options);
|
211
232
|
if (arg_count > 1) {
|
212
233
|
VALUE rb_width = rb_hash_aref(options, ID2SYM(rb_intern("width")));
|
213
234
|
VALUE rb_height = rb_hash_aref(options, ID2SYM(rb_intern("height")));
|
data/ext/pdfium_ruby/page.h
CHANGED
@@ -5,28 +5,35 @@
|
|
5
5
|
class Document;
|
6
6
|
#include "pdfium_ruby.h"
|
7
7
|
#include "document.h"
|
8
|
+
#include "fpdf_text.h"
|
8
9
|
|
9
10
|
class Page {
|
10
11
|
public:
|
12
|
+
// C++ constructor & destructor.
|
11
13
|
Page();
|
14
|
+
~Page();
|
12
15
|
|
16
|
+
// Ruby Data Initializer
|
13
17
|
void initialize(Document* document, int page_number);
|
18
|
+
|
19
|
+
// PDFium data initializer & cleanup
|
14
20
|
bool load();
|
15
21
|
void unload();
|
16
22
|
|
23
|
+
// Data access methods
|
17
24
|
double width();
|
18
25
|
double height();
|
19
26
|
double aspect();
|
27
|
+
int text_length();
|
20
28
|
|
21
29
|
bool render(char* path, int width, int height);
|
22
30
|
|
23
|
-
~Page();
|
24
|
-
|
25
31
|
private:
|
26
|
-
int
|
27
|
-
bool
|
28
|
-
Document
|
29
|
-
FPDF_PAGE
|
32
|
+
int page_index;
|
33
|
+
bool opened;
|
34
|
+
Document *document;
|
35
|
+
FPDF_PAGE fpdf_page;
|
36
|
+
FPDF_TEXTPAGE text_page;
|
30
37
|
};
|
31
38
|
|
32
39
|
void Define_Page();
|
@@ -35,6 +42,7 @@ VALUE page_render(int arg_count, VALUE* args, VALUE self);
|
|
35
42
|
VALUE page_allocate(VALUE rb_PDFShaver_Page);
|
36
43
|
VALUE page_load_data(VALUE rb_PDFShaver_Page);
|
37
44
|
VALUE page_unload_data(VALUE rb_PDFShaver_Page);
|
38
|
-
|
45
|
+
VALUE page_text_length(VALUE rb_PDFShaver_Page);
|
46
|
+
//static void destroy_page(Page* page);
|
39
47
|
|
40
48
|
#endif
|
@@ -8,7 +8,7 @@ void Init_pdfium_ruby (void) {
|
|
8
8
|
FPDF_InitLibrary();
|
9
9
|
|
10
10
|
// Define `PDFShaver` module as a namespace for all of our other objects
|
11
|
-
|
11
|
+
rb_define_module("PDFShaver");
|
12
12
|
|
13
13
|
// Define `Document` and `Page` classes
|
14
14
|
Define_Document();
|
data/lib/pdfshaver/page.rb
CHANGED
data/lib/pdfshaver/version.rb
CHANGED
data/test/page_spec.rb
CHANGED
@@ -128,6 +128,7 @@ describe PDFShaver::Page do
|
|
128
128
|
@page.instance_variable_get("@height").must_equal nil
|
129
129
|
@page.instance_variable_get("@width").must_equal nil
|
130
130
|
@page.instance_variable_get("@aspect").must_equal nil
|
131
|
+
@page.instance_variable_get("@length").must_equal nil
|
131
132
|
|
132
133
|
@page.instance_variable_get("@extension_data_is_loaded").must_equal false
|
133
134
|
@page.send(:load_dimensions)
|
@@ -135,6 +136,7 @@ describe PDFShaver::Page do
|
|
135
136
|
@page.height.wont_equal nil
|
136
137
|
@page.width.wont_equal nil
|
137
138
|
@page.aspect.wont_equal nil
|
139
|
+
#@page.length.wont_equal nil
|
138
140
|
@page.instance_variable_get("@extension_data_is_loaded").must_equal false
|
139
141
|
end
|
140
142
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdfshaver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ted Han
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -91,10 +91,11 @@ extra_rdoc_files: []
|
|
91
91
|
files:
|
92
92
|
- ".gitignore"
|
93
93
|
- Gemfile
|
94
|
-
-
|
94
|
+
- LICENSE
|
95
95
|
- Rakefile
|
96
96
|
- Readme.md
|
97
97
|
- bench/data_loading_speed.rb
|
98
|
+
- bench/extract_doc.rb
|
98
99
|
- bench/memory_stress.rb
|
99
100
|
- bench/setup.rb
|
100
101
|
- ext/pdfium_ruby/document.cpp
|
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
139
|
version: '0'
|
139
140
|
requirements: []
|
140
141
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.4.5
|
142
|
+
rubygems_version: 2.4.5.1
|
142
143
|
signing_key:
|
143
144
|
specification_version: 4
|
144
145
|
summary: Shave pages off of PDFs as images
|
data/Gemfile.lock
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
pdfium (0.0.1)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
addressable (2.3.7)
|
10
|
-
fastimage (1.6.6)
|
11
|
-
addressable (~> 2.3, >= 2.3.5)
|
12
|
-
minitest (5.5.1)
|
13
|
-
rake (10.4.2)
|
14
|
-
rake-compiler (0.9.5)
|
15
|
-
rake
|
16
|
-
|
17
|
-
PLATFORMS
|
18
|
-
ruby
|
19
|
-
|
20
|
-
DEPENDENCIES
|
21
|
-
bundler (~> 1.5)
|
22
|
-
fastimage
|
23
|
-
minitest
|
24
|
-
pdfium!
|
25
|
-
rake
|
26
|
-
rake-compiler
|