Skip to content

albertski/writebook_pdf_import

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WritebookPdfImport

A Rails engine that adds PDF import support to Writebook. It parses a PDF and creates Page and Picture leaves in a book.

Usage

An Import PDF button is added to the book page, allowing you to upload a PDF directly from the Writebook interface.

Import PDF button on the book page

Installation

Add to your Gemfile:

gem "writebook_pdf_import"

What it does

  • Extracts text from each PDF page and creates a Page leaf
  • Extracts embedded images (JPEG, JPEG 2000, raw RGB/grayscale/CMYK) and creates Picture leaves
  • Uses the first line of text as the page title if it's 3–100 characters, otherwise falls back to "Page #"
  • Skips blank pages

Dependencies

  • pdf-reader ~> 2.12
  • mini_magick (for JPEG 2000 and raw image conversion)
  • ImageMagick must be installed on the system

Background Jobs

PDF imports are processed asynchronously using Active Job. You must have Redis and a Solid Queue worker running:

redis-server

About

Adds PDF Import to Writebook

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors