-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FR] DPI/scale parameter option #97
Comments
I guess PDF.js already has a mechanism for avoiding such blurring. The resolution of the rendered PDF is determined by this class: https://github.com/mozilla/pdf.js/blob/b14f6960710127adccba3a5fca5906c333259da5/web/ui_utils.js#L82 This class uses
So I'd suggest checking your Screen.Recording.2024-03-10.at.16.40.01.mov |
You can see a simplified example of how You also might be interested in this example from the MDN docs: In addition to the canvas renderer, the text layer builder also uses That said, it's obviously not desirable to add an option to change |
Thank you so much for the feedback! I'm not a javascript dev by any means, but I don't mind opening up stuff and reading whatever languages. I asked around on obsidian forums and the dev discord for obsidian, and no one could answer this back then. Setting the devicePixelRatio worked wonderfully! It is thankfully persistent across zooms, but since you said it might not be, I'm a bit afraid of what conditions can change it, since my knowledge is limited for the domain in which javascript itself runs. I'm off to make a quick obsidian plugin, hope I can either use the provided method in the example you gave, via a media query to track changes on the browsers own terms / lifecycle methods. Otherwise it's either monkeypatching the setter, or in the worse/hackiest scenario, making a timer to check if it needs to be changed. |
Many thanks for the Templater startup script you provided here:
I would be happy if you could provide us another Templater startup script that people can use for a fixed devicePixelRatio. I need a value of 2.4 hence my testing in the console. |
@N3C2L I guess just But again, I'm not sure what kind of problem can occur due to a manually fixed |
Works flawless, thanks again! |
Hey everyone, I noticed the official forum has a bug report thread for this exact problem, and WhiteNoise from the Obsidian team wants to hear your voice: |
Thanks for the fix. Guys, how can I save changes in Obs source code? It overwrites every time I leave dev console(I pressed Ctrl+S) I'm a beginner. Sorry about stupid question |
Describe your request
Hey, would be awesome if you could add a scale/dpi option which would adjust the resolution of the built-in render in the pdf JavaScript pdf.js library.
I have earlier experimented with this, but never found a solution which could monkeypatch the built-in viewer, instead of bundling a whole new one, and then I just didn't get around to further trying to monkeypatch it after I banged my head into a wall too much 🙃
The blurriness of pdfs (which some people experience (me)) can be completely removed by changing a parameter given to the pdf object from the PDFJS.getDocument library. When calling getViewport in pdf.js, this can be adjusted as part of its parameters.
I.e. const viewport = pdfPage.getViewport({ scale: 4.0 });
It's then a question of finding the correct pdf object inside obsidian ('ve mangled it quite a lot without luck, but it looks like you've got a lot of experience with doing exactly that), and hopefully once you have access it would be easy to change it (I hope).
Kind Regards
The text was updated successfully, but these errors were encountered: