Comments (6)
Have you tried (defun pdf-util-frame-scale-factor () 2)? In case that works, what is (frame-scale-factor) returning? And (pdf-util-frame-scale-factor)? And pdf-view-use-scaling?
Yes that works! Turns out I hadn't properly set pdf-view-use-scaling
to t
correctly and I should have RTFM more carefully. Thanks a lot!
from pdf-tools.
Ok, I'm closing this because it has indeed been fixed in emacs 28. There is a lot of confusion around this issue so for other ones in the same boat: the ns/cocoa/official port does work but you require the latest dev version of it. You probably are using org mode and write LaTeX so you also want svg rendering. Just install emacs 28 from brew with a few extensions pre-enabled: brew install emacs-plus@28
.
from pdf-tools.
Just to be clear, the documentation for pdf-view-use-scaling
states:
Whether images should be allowed to be scaled for rendering.
But it's all the document that is rendered blurry, not just images.
from pdf-tools.
(defun pdf-util-frame-scale-factor ()
"Return the frame scale factor depending on the image type used for display.
When `pdf-view-use-scaling' is non-nil, return the scale factor of the frame
if available. If the scale factor isn't available, return 2 if the
frame's PPI is larger than 180. Otherwise, return 1."
(if pdf-view-use-scaling
(or (and (fboundp 'frame-scale-factor)
(truncate (frame-scale-factor)))
(and (fboundp 'frame-monitor-attributes)
(cdr (assq 'backing-scale-factor (frame-monitor-attributes))))
(if (>= (pdf-util-frame-ppi) 180)
2
1))
1))
Here both (fboundp 'frame-scale-factor)
and (assq 'backing-scale-factor (frame-monitor-attributes))
are nil, so there's a fallback to the last clause.
Now:
(defun pdf-util-frame-ppi ()
"Return the PPI of the current frame."
(let* ((props (frame-monitor-attributes))
(px (nthcdr 2 (alist-get 'geometry props)))
(mm (alist-get 'mm-size props))
(dp (sqrt (+ (expt (nth 0 px) 2)
(expt (nth 1 px) 2))))
(di (sqrt (+ (expt (/ (nth 0 mm) 25.4) 2)
(expt (/ (nth 1 mm) 25.4) 2)))))
(/ dp di)))
Here frame-monitor-attributes
reports 1280px x 800px, so ppi < 180 and ultimately pdf-util-frame-scale-factor
is returning 1.
I think this is ignoring the fact that the reported pixels are not physical ones.
Now, if I force pdf-util-frame-scale-factor
to return 2, then the resolution of the output is the right one. Comparing the output to the one of Preview, there surely is room for improvement, since pdf-view rendering is a bit too thin in comparison, but it's clear that's not a matter of resolution anymore.
So my horrible workaround was (defun pdf-util-frame-scale-factor () 2)
.
from pdf-tools.
I am on emacs 28 and I still see the image blurry, and what you describe in your previous comment is almost exactly what is going on (only my resolution is 1440x900). Is there some setting that I need to adjust to fix it?
from pdf-tools.
only my resolution is 1440x900
This is MacBook's default as per late, they changed the default scaling factor from 2 to 1.75 a few years ago and I always scale up to 2 again first thing. But it shouldn't be the issue, since emacs will be rendering at 2x and the system is in charge to downscale that to 1.75, the downscaled version might be a little blurry but then it's the same for the rest of the system because that's what macOS does in general.
Have you tried (defun pdf-util-frame-scale-factor () 2)
? In case that works, what is (frame-scale-factor)
returning? And (pdf-util-frame-scale-factor)
? And pdf-view-use-scaling
?
from pdf-tools.
Related Issues (20)
- Feature request: highlight by selecting HOT 1
- Unknown render command: :selection-style HOT 6
- make: cask: No such file or directory HOT 3
- Image cache not cleared after closing pdf-buffer HOT 2
- PDF-tools does not compile properly leading to no annotation and proper isearch functionality HOT 1
- Epdfinfo wrongly reports missing poppler library on Arch Linux HOT 4
- asyntax error near unexpected token `png,' (macos) HOT 1
- Zoom in and out using mousewheel
- [feature request?] change height of `pdf-annot-edit` window HOT 1
- pdf-annot does not recognize text insert comments from Adobe Acrobat
- Not installing subfolders when installing pdf-tools via MELPA
- An equivalent capture with `pdf-tools` like that by skim, hook and craft?
- Add support for Android Emacs
- Can't open pdf files on macOS? HOT 1
- Feature Request: Hide PDF Annotations
- two-column pdf: cannot select a single column
- text selection is incorrect when close to some math symbols HOT 3
- With dired+ installed, navigating from pdf-tools buffer hangs emacs HOT 1
- Backward search with long source lines HOT 1
- Better forward search HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdf-tools.