GithubHelp home page GithubHelp logo

PDF Splitting about pressurecooker HOT 4 CLOSED

kollivier avatar kollivier commented on June 10, 2024
PDF Splitting

from pressurecooker.

Comments (4)

kollivier avatar kollivier commented on June 10, 2024

One issue with this functionality is that PDF splitting can break accessibility. Unfortunately, my research so far has failed to find a quick fix for this, for a couple reasons:

  1. The easiest workable solution would be to modify the PDF to remove pages, rather than creating a new PDF, so that the accessibility data remains intact. Unfortunately, all the Python PDF APIs I've found only open a document for reading or for writing, and the writing APIs always create a new PDF rather than taking an existing one. This is likely due to the technical complexity of modifying an existing PDF.

  2. None of the Python APIs I've explored so far offer the ability to both read and write accessibility info to PDFs. A vast majority of the Python libraries I've explored are concerned with converting to and from PDF, and don't consider PDF accessibility as a feature at all.

For reference, here's some of the libraries I've explored so far:

  • PyPDF2 - The library we currently use. Can read and write, but does not handle accessibility data at all.
  • pdfminer - Does provide read access to at least some of the accessibility data we need. The problem is that it's read-only, so we lack a library to write that data into the split PDF.
  • ReportLab - Write only, does not appear to have accessibility writing APIs, though documentation is somewhat sparse so it's possible it's in the source somewhere.

I will keep exploring, but if I cannot find a library that supports adding accessibility data into PDFs, we will either need to extend an existing library or seek other solutions to splitting the PDF in order to keep accessibility. With pdfminer, we can at least warn about the loss of accessibility support when it happens.

from pressurecooker.

kollivier avatar kollivier commented on June 10, 2024

This task is on hold as we will probably just implement the ability to have ContentNodes display specific a PDF page range instead, in order to keep accessibility.

from pressurecooker.

jayoshih avatar jayoshih commented on June 10, 2024

Here is the PDF-splitting logic used in Open Stax chef:

https://github.com/learningequality/sushi-chef-openstax/blob/master/utils/pdf.py#L93-L112

Recommended commercial product to check:

https://www.pdflib.com/download/pdflib-product-family/

recommendation on stack overflow:

from pressurecooker.

ivanistheone avatar ivanistheone commented on June 10, 2024

PDF splitting utils are now provided in ricecooker, see https://ricecooker.readthedocs.io/en/latest/pdfutils.html#pdf-splitter

from pressurecooker.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.