SYSTEM INFO:
Obsidian version: v1.4.5
Installer version: v1.4.5
Operating system: Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:52 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T8103 22.6.0
Login status: not logged in
Insider build toggle: off
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: on
I get blurry PDFs on windows 11, and had this problem since the launch of the new pdf viewer, and it has survived multiple reinstalls of obsidian and different computers.
I’ve reproduced the problem with a completely fresh obsidian vault, and added debug info as well. This is related to the following bug: Blurry pdf preview on Linux ( Fedora )
Below is a screenshot of the issue, comparing two pdfs side by side, left side using pdfjs directly and right side the viewer inside the obsidian vault. The left hand side looks crisp ‘in-person’, but it’s just that the compression from the screenshotting itself is creating small artifacts, so ignore that.
The left hand side is using pdf.js directly from Mozilla to view the PDF, link to viewer used here: PDF.js viewer
Notice the blurriness is especially visible on small details and equations, and it becomes quite annoying to read text in obsidian due to this.
I’ve noticed that if you nudge the size / aspect of the window in obsidian, sometimes the preview renders the pdf more clearly. I suspect there’s some aspect ratios which get resized better than others. Using pdf.js directly from the link does not exhibit this behavior, it just rescales correctly.
Debug info
*(Notice, it says windows 10, I don’t know why it does that…)
SYSTEM INFO:
Obsidian version: v1.4.12
Installer version: v1.4.5
Operating system: Windows 10 Pro 10.0.22621
Login status: not logged in
Insider build toggle: off
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: on
Hey, as I was curious if I could replace the bundled pdf.js viewer with my own, and I needed to familiarize myself with pdf.js and obsidian plugin dev anyway for other things, I managed to get a proof of concept up and running using the standard latest npm version of pdf.js inside obsidian.
The blurriness can be completely removed by changing a parameter given to the pdf object from PDFJS.getDocument. When calling getViewport in pdf.js, this can be adjusted.
I.e. const viewport = pdfPage.getViewport({ scale: 4.0 }); and rendering the pdf via an attached div on the current page.
Everything is completely clear to me now. Given I know obsidian has some more stuff on top of it, so it might not be so simple, but I will further explore this option later and see if I can bundle it as a quickfix via a plugin at some point, unless of course they fix it first
Otherwise it might be that this scaling factor is not being set high enough, when the layout logic and similar is getting called natively in obsidian. But it might be other issues, that I am not simply aware of, since I am new to obsidian plugin dev etc.
Hey, i have same Problems on Win 11. Were you able to make a Plugin?
Or could you explain, how you did it? Because in obsidian i dont find any pdf.js file which i could edit. Could you explain which file we hafve to edit and what we have to edit ?
Or please if you already did it, could you make a plugin, if this is not to much work ?
I would like to decide by myself, what scaling i want. Hate pdf viewer, who think no one see’s it, when you scale down.
Hello, i’m new on obsidian but i encounter the same problem and i think it was due to zooming my obsidian window (not my pdf file). By reseting the zoom, my pdf is less blurry. Hope it helps.
I also have blurry PDFs, but I’m on windows 11.
I’ve noticed that depending on the scale of the pdf getting rendered inside the obsidian window bounds, it sometimes renders more clearly. I can nudge it to go from badly blurry to better blurry.
I suspect it is because whatever scaling algorithm is being used works better at certain aspects than others when it tries to approximate pixels. I don’t have this problem with the built-in pdf viewers of the browsers I use.
Ah, sorry, obsidian is more blurry than the same pdf opened in that viewer you linked.
I’ve screenshotted both apps in one go, and the blurriness is visible if I open the attached image itself so it’s full screen.
And while the image compression is altering the results, since the left one is clear to me ‘in-person’, you can see that the right one, which is from obsidian, is more blurry when compared side by side, especially if you look at the formulas.
So it’s clear that something is messing with the rendering, since it’s screenshoot directly from windows. I’ve had this problem from day 1 of the new pdf viewer, and had hoped it would be fixed with time, because it’s quite annoying to read blurry text when I’m reading longer texts and doing notes back and forth. Side note, this bug survived multiple reinstalls of obsidian for me, since I’ve changed computer since I first experienced it.
Hey, this might also be fixable on linux by changing the parameters for calculating scale for pdf.js. i.e. pdfPage.getViewport({ scale: 5.0 });
I can fix this problem by replacing pdf.js with my own bundled version where I can adjust the parameters, and I’ve tried to change the parameters of the built-in pdfjs, but I cannot access them, even though I’ve tried monkey patching and proxying, since they are protected. And the place where obsidian loads pdfjs lib itself is nested inside a place I cannot access either.