No release in over 3 years
A Rails engine that adds the ability to import PDF files into a Writebook book, creating pages and pictures from the PDF content.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

 Project Readme

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