Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Docsplit 0.3.4

  • Loading branch information...
commit e85000ae018d3bf628d5165d419facac669814de 1 parent 5efc676
@jashkenas jashkenas authored
Showing with 12 additions and 1 deletion.
  1. +7 −0 index.html
  2. +5 −1 lib/docsplit/image_extractor.rb
View
7 index.html
@@ -280,6 +280,13 @@ <h2 id="internals">Internals</h2>
<h2 id="changes">Change Log</h2>
<p>
+ <b class="header">0.3.4</b><br />
+ Adding a suggested optimization from the GraphicsMagick list -- only ever
+ generate one page image per GraphicsMagick call. Saves large amounts of
+ disk space for tempfiles on long documents.
+ </p>
+
+ <p>
<b class="header">0.3.3</b><br />
Start using the MAGICK_TMPDIR environment variable to prevent parallel
Docsplit runs from having the potential to clobber each other's temporary
View
6 lib/docsplit/image_extractor.rb
@@ -23,6 +23,10 @@ def extract(pdfs, options)
end
# Convert a single PDF into page images at the specified size and format.
+ # If `--rolling`, and we have a previous image at a larger size to work with,
+ # we simply downsample that image, instead of re-rendering the entire PDF.
+ # Now we generate one page at a time, a counterintuitive opimization
+ # suggested by the GraphicsMagick list, that seems to work quite well.
def convert(pdf, size, format, previous=nil)
tempdir = Dir.mktmpdir
basename = File.basename(pdf, File.extname(pdf))
@@ -88,7 +92,7 @@ def page_list(pages)
else
range.to_i
end
- }.flatten.sort
+ }.flatten.uniq.sort
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.