Evidlo / remarkable_news

Daily news/comics on your reMarkable's suspend screen
GNU General Public License v3.0
285 stars 32 forks source link

Pdf converter #19

Open harrylepotter opened 4 years ago

harrylepotter commented 4 years ago

Hey @Evidlo . Did some mucking about this afternoon. Noticed that a bunch of the images on newseum.org are pretty low resolution. Made a really, really dirty change to enable downloading/resizing of pdfs from the same source. I've never written anything in go before, so go easy on me..

In order to use it, the remarkable needs to have imagemagick and ghostscript installed. I got these off entware, which i noticed you also maintain for the remarkable. The cropping could really be optimized (especially at the top), or possibly using trim on imagemagick would do this magically for most of the pdfs on newseum, at-least..

Evidlo commented 3 years ago

Did some investigation and it seems like we might be able to use existing /usr/lib/libpdfium.so for rendering a PDF to an image.

https://github.com/Evidlo/go-pdfium-test

I haven't gotten it to work when cross-compiling though.

harrylepotter commented 3 years ago

pdfium might be a challenge due to all of the repaging and operations that are taken. Another option might be something like: https://blog.golang.org/generate or https://github.com/go-bindata/go-bindata, but i have no idea how you'd make this work if you want to maintain x86/non-remarkable build functionality.

Evidlo commented 3 years ago

but i have no idea how you'd make this work if you want to maintain x86/non-remarkable build functionality

I don't think this is all that important, as testing on the reMarkable is only slightly more inconvenient than testing on desktop. Definitely worth the trade if we can use PDFs as sources.