I'm developing a REST API in the Slim framework, it is used by web browser and Android devices.

It is on online books library. Most books are in PDF format.

Requirements for the code library:

  1. The book must be sent page by page, because some books are large.
  2. Text from books must not be copiable.
  3. A simple user should not the have opportunity to save pages.
    (Of course advanced users can find a solution for that).

For this purpose, I need a PDF reader SDK (not necessary php) to read a PDF page by page. I'm thinking about an sdk which can read the pdf, save one page to an image, then send that as response.

  • 1
    If the book page can be viewed in the user's browser, then they can screen capture and optical character read the page and end up with a searchable pdf. All of that can be automated. Basically, if the user can see or hear it on their computer, they can copy it.
    – Daniel
    Commented Jan 23, 2019 at 13:22
  • What you(Daniel) are describing is not "a simple user".
    – Gordon
    Commented Jan 23, 2019 at 14:47
  • 1
    @Gordon If a simple user can't take a screen shot or use free ocr software, then part of the OP's solution is to layer the page content behind a large, transparent image. Left-clicking and right-clicking will select the transparent image and not the content.
    – Daniel
    Commented Jan 23, 2019 at 15:09
  • That's a good point. There is very little, if anything, that can be done about screenshots and OCR or people fetching the images from the dev tools. I believe we are approaching the problem with different definitions of "simple user." If he is automating the process, I no longer consider him a "simple user". There will always be the kid with too much time on his hand that is willing to screenshot/download each page (in a large book) and feed it through OCR.
    – Gordon
    Commented Jan 23, 2019 at 15:23

1 Answer 1


A solution for protecting book content from a 'simple user' is to use layers in the UI, placing the book content behind a transparent image. No simple interaction of the mouse or keyboard will be able to select / copy or download the book content.

Using this method, the book content does not need to be served as an image, it could be a pdf, html or text.

The next step might be to pre-convert all of your pdf books to a format that is easy to work with, such as html. You can use a tool like pdf2htmlEX to do that. I have used this library before and found it to be quite good.

  • Thanks for advice! If I place bookpage(as html or text) behind the transparent image, when user save page as html, book page will not save? And second problem is some of book(book pages) consist of images, because the pages are scanned on scanner and then maked pdf file. For this cause can pdf2htmlEX convert this type of page to html? Commented Jan 24, 2019 at 3:59
  • The book page would be saved with all the other html. A user would have to look through the code to identify the book page. Is that a simple user? If so, you can use obfuscation to turn the book page to gibberish. That can be defeated, but adds more complexity to defeat a 'simple user'. pdf2htmlEX site has examples of what the library can do, it is amazing. Check out the example for Full Circle magazine.
    – Daniel
    Commented Jan 24, 2019 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.