got a client who wants me to "stream pdf files instead of serving them so users cant download or print them".

as far as I know this is impossible. but he replied we dont care if an IT guy figured out a way to get it but we want majority of normal people to be unable to figure a way around it.

if im gonna need to show ms word and pdf files i will need an iframe or object embed and i cant disable right clicks or listen on ctrl s / p.

any ideas or should i not go for the project :(

  • 0
    Perhaps look ar how outlook secures attachments only for viewing purposes
  • 0
    Just set a bid to disable right click and reject keypresses for Ctrl+s/cmd+s. They can then iterate what they feel is a solution if they encounter issues.
  • 3
    I don't know if this work but here is an idea.

    Idea 1 (Prefer way) :

    Provide a custom viewer in your website which load the pdf file.Since the user doesn't know where the pdf file in actually store (without looking at source) , you essential prevent download.

    Idea 2 :

    When the user upload the pdf file , you encrypt it. You provide an viewer which essentially decrypt the pdf file before showing it to user.
  • 4
    Serve them as blob:// but there's nothing stopping them printing it to PDF.

    Or.. make it a video with the PDF embedded in the frames, but that seems overkill.
  • 3
    Embed a wasm PDF viewer with a canvas, load through websocket, decrypt client side. Fuck everyone, even witty IT guys.
    Or run it server side and use the canvas for output.
  • 1
    But there's always OCR.

    Honestly, find a better employer.
    If you're showing content to the user, how they consume it should be up to them. Not you.
  • 1
    @Lor-inc also do a event.preventDefault() on right click/menu events.
  • 0
    @melezorus34 And all keypress events.
  • 0
    @Lor-inc I can still do a printscreen or use a screen recording tool :D

    If I'm a streamer, I may even have a HDMI / DisplayPort grabber laying around in case you REALLY put effort into it
  • 1
    @hitko In that case the only option left is to make it a little noisy, such that it is only slightly inconvenient when you see it, but recording with a non-matching framerate or taking a screenshot results in terrible noise.
  • 0
    @Lor-inc I think I can match framerate through vsync / freesync, not sure what to do about screenshot though, but maybe OS already does something to prevent such issues
  • 1
    just told the client i will not work on such a project.
Add Comment