itsjunetime / tdf

A tui-based PDF viewer
Mozilla Public License 2.0
297 stars 5 forks source link

Doesn't render #3

Closed Prajwalg19 closed 1 month ago

Prajwalg19 commented 1 month ago

I tried tdf on both gnome-terminal and alacritty

Couldn't render a page: Couldn't render page: Couldn't paint Context: Invalid Matrix

itsjunetime commented 1 month ago

So the issue with alacritty is that it doesn't support image graphics (see this pr), which are necessary to make this work (as it renders pdf pages to pngs, then displays them with ratatui_image). As of right now, ratatui_image renders colors to unicode halfblocks when it can't determine what graphics protocol the current window supports, but that's obviously not very good. Unfortunately, there's no easy way to display PDFs nicely when the terminal doesn't support images. We could try to extract the text and print that out in the terminal, but that would mess up formatting, and sometimes PDFs don't even contain the text they show (e.g. it's stored as an image internally anyways), so that wouldn't work in all cases. I don't think that's an issue we can really fix; I'd just recommend using a different terminal emulator.

And the issue with gnome-terminal is the same as we're seeing in issue #1, so I'll close this in favor of that.