Skip to content
This repository

The PDF::Reader library implements a PDF parser conforming as much as possible to the PDF specification from Adobe.

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 CHANGELOG
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 preflight.gemspec
README.rdoc

Preflight

Check your PDF files meet the standard you require.

The full PDF spec is a beast, and there are any number of ways of producing a valid PDF. Receivers of PDF files may need to ensure the files they're sent meet a particular set of requirements, be it PDF/X, PDF/A or just “images must be 300 dpi or greater”. These checks are called preflight.

There's expensive software around that can preflight for you, but it's often difficult to script and you know, expensive.

This may not check as comprehensively as the official preflight tools from Adobe and friends, but hopefully it'll get you most of the way with less stress.

Installation

gem install preflight

Usage

Standard Profile ( PDF/X-1a )

require "preflight"

preflight = Preflight::Profiles::PDFX1A.new

puts preflight.check("somefile.pdf").inspect

File.open("somefile.pdf", "rb") do |file|
  puts preflight.check(file).inspect
end

Custom Profile

require "preflight"

class MyPreflight
  include Preflight::Profile

  profile_name "simple-pdf"

  rule Preflight::Rules::MaxVersion, 1.4
  rule Preflight::Rules::NoEncryption
  rule Preflight::Rules::DocumentId
end

preflight = MyPreflight

puts preflight.check("somefile.pdf").inspect

Extend A Profile

require "preflight"

class MyPreflight
  include Preflight::Profile

  profile_name "simple-pdf"

  import Preflight::Profiles::PDFX1A

  rule Preflight::Rules::MaxVersion, 1.4
  rule Preflight::Rules::NoEncryption
  rule Preflight::Rules::DocumentId
end

preflight = MyPreflight

puts preflight.check("somefile.pdf").inspect

Status

This library is in an early stage of development. Use at your own risk.

Compatability

This is pure ruby should run on most ruby VMs. I develop on MRI 1.9.2.

Further Reading

Something went wrong with that request. Please try again.