r/CodingHelp • u/DarksidersWar • Jan 03 '26
[How to] Manipulating a website's drawing before it draws on the canvas.
A website opens PDFs using an embedded tool (probably pdf.js) in a pdf.js view. It displays PDF pages by drawing on the canvas. The text on the page cannot be selected in any way, but I can download the canvas using a script that uses toDataURL() in the console. What I want is for the website to extract the text before drawing it on the canvas and then draw it that way. In my research, I concluded that I could do this using CanvasRenderingContext2D or by directly manipulating the browser's source code and recompiling it. What do you recommend?
•
u/AutoModerator Jan 03 '26
Thank you for posting on r/CodingHelp!
Please check our Wiki for answers, guides, and FAQs: https://coding-help.vercel.app
Our Wiki is open source - if you would like to contribute, create a pull request via GitHub! https://github.com/DudeThatsErin/CodingHelp
We are accepting moderator applications: https://forms.fillout.com/t/ua41TU57DGus
We also have a Discord server: https://discord.gg/geQEUBm
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/coloredgreyscale Jan 03 '26
If you want the pdf check the page info or network traffic if you can get the raw pdf from there.
0
u/[deleted] Jan 03 '26
[deleted] — view deleted comment