marcokrikke / pdf-burst

Bursts a PDF into single page files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PDF::Burst

What?

PDF::Burst is a gem that lets you split a PDF document with several pages into single page files.

Why?

We needed this functionality for the development of Lehtilompakko, and did not want any Java app to do the job.

How?

Simple! Once you install the 'pdf-burst' gem, all you need is:

require 'pdf-burst'
PDF::Burst.new("/path/to/my/document.pdf").run!

By default, the PDF files will be output to your current working directory. But that's not what you want, is it?

PDF::Burst.new("document.pdf", :output => "/tmp").run!

Better, huh?

Another default is the page name. They'll all be nicely named like "page_1.pdf", "page_2.pdf". We let you change that too:

PDF::Burst.new("document.pdf", :filename => "doc.%04d").run!

Would output them like this: "doc.0001.pdf", "doc.0002.pdf", etc.

Another default is the initial page number. That one starts at 1 by default. We let you change that too:

PDF::Burst.new("document.pdf", :initial_page_number => 4).run!

Would output them like this: "page_4.pdf", "page_5.pdf", etc.

Another default is the bundle size (number of pages in the output document). That one is 1 by default. We let you change that too:

PDF::Burst.new("document.pdf", :bundle_size => 2).run!

This could be useful when splitting double-sided documents.

Special thanks

Thanks to Hopeinen Norsu for letting us release this as open-source.

License

Check the LICENSE file. It's the MIT license.

About

Bursts a PDF into single page files.

License:MIT License


Languages

Language:Ruby 100.0%