Protecting PDF

I want to create a project where people can upload PDFs, but I only want users to be able to see certain pages of a PDF unless they meet certain requirements. I can't do this on the client since people would obviously be able to check their network tab and get the PDF's URL from there 😛 I've been checking other websites that do something similar and it seems they fetch each page of the PDF as HTML instead of the entire file... Any idea how I could do something similar or if there is another way of accomplishing this?
4 Replies
Amos
Amos•3y ago
I am guessing I can do something like 1. User uploads PDF 2. Convert to HTML with https://github.com/shebinleo/pdf2html 3. If user can see real version, just give them the PDF, otherwise get HTML from CDN and show that on page instead
dan
dan•3y ago
Basically what i was typing yea. although depending on how heavy the pdf to html conversion is you may want to convert the pdf when they upload it and store that in db or file on cdn whatever
Amos
Amos•3y ago
Thanks for being my rubber duck 😄
dan
dan•3y ago
happyThumbsup
Want results from more Discord servers?
Add your server