jichu4n / jfbview Goto Github PK
View Code? Open in Web Editor NEWPDF and image viewer for the Linux framebuffer.
PDF and image viewer for the Linux framebuffer.
Just want to upvote this project and thank farseerfc (jichu4n) for creating the AUR package.
I actually had it bookmarked long ago (2018), but only recently tested it and noticed it again because github alerted me of your 2020 commits. You should commit and release more often :-)
I works wonderfully in the console. The search and TOC functinality is very polished and usefull. Specially showing the search results in context. Very well done. Maybe you could add a screenshot or animation on the README highlighting all this. It really deserves it.
I also liked that you tried to somehow mimic the Zathura keybindings . and give the end user a very VIM like experience. Very appealing for the potential users of this tools. Instead of reinventing the wheel with yet another set of totally different keybindings.
I tested and use a lot of pdf and image console viewers like, http://www.kraxel.org/blog/linux/fbida/ (gives fbi and fbpdf on arch) and https://aur.archlinux.org/packages/fbpdf-git (fbpdf2).( Maybe you'd also challenge your self to make a nice image viewer for the console ?)
Anyway this one is definetly the most polished.
Any plans to add epub support (through mupdf ) ?
.
I also want to report that it compiles and works perfectly on the raspberry pi 2 and on ARM chromebooks, that is "armv7h".
So, to repeat @zertyz request, please update the PKGBUILD to include "armv6h" and "armv7h"
Aside from g++, I've also tried:
CXXFLAGS="Wno-format-security"
.git-cloned$ sudo apt-get install \
> libssl-dev \
> libopenjp2-7-dev \
> libjbig2dec-dev \
> libharfbuzz-dev \
> libncurses5-dev \
> libimlib2-dev \
> libmupdf-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libjbig2dec0-dev' instead of 'libjbig2dec-dev'
libharfbuzz-dev is already the newest version (1.7.2-1ubuntu1).
libjbig2dec0-dev is already the newest version (0.13-6).
libimlib2-dev is already the newest version (1.4.10-1).
libncurses5-dev is already the newest version (6.1-1ubuntu1.18.04).
libssl-dev is already the newest version (1.1.1-1ubuntu2.1~18.04.4).
libopenjp2-7-dev is already the newest version (2.3.0-2build0.18.04.1).
libmupdf-dev is already the newest version (1.14.0-0build3+ubuntu18.04).
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
git-cloned$ git clone https://github.com/jichu4n/jfbview.git
Cloning into 'jfbview'...
remote: Enumerating objects: 1334, done.
remote: Total 1334 (delta 0), reused 0 (delta 0), pack-reused 1334
Receiving objects: 100% (1334/1334), 309.16 KiB | 3.06 MiB/s, done.
Resolving deltas: 100% (943/943), done.
git-cloned$ cd jfbview
jfbview$ make
g++ -Wall -O2 -std=c++1y -o mupdf_version mupdf_version.cpp -lmupdf
=============================
Detected configuration:
MUPDF_VERSION = 10016
OPENJP2 = openjp2
=============================
make[1]: Entering directory '/home/tehnyaz/git-cloned/jfbview'
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o command.o command.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o document.o document.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o framebuffer.o framebuffer.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o image_document.o image_document.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o multithreading.o multithreading.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o outline_view.o outline_view.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o pdf_document.o pdf_document.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o pixel_buffer.o pixel_buffer.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o search_view.o search_view.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o string_utils.o string_utils.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o ui_view.o ui_view.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o viewer.o viewer.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -c -o main.o main.cpp
main.cpp: In function ‘int main(int, char**)’:
main.cpp:716:47: warning: format not a string literal and no format arguments [-Wformat-security]
fprintf(stderr, FRAMEBUFFER_ERROR_HELP_STR);
^
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10016 -o jfbview command.o document.o framebuffer.o image_document.o multithreading.o outline_view.o pdf_document.o pixel_buffer.o search_view.o string_utils.o ui_view.o viewer.o main.o -lpthread -lform -lncurses -lmupdf -lfreetype -lharfbuzz -lz -ljbig2dec -ljpeg -lopenjp2 -lmupdf-third -lssl -lcrypto -lImlib2
pdf_document.o: In function `PDFDocument::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':
pdf_document.cpp:(.text+0x13da): undefined reference to `fz_do_catch'
pdf_document.cpp:(.text+0x141d): undefined reference to `fz_do_try'
collect2: error: ld returned 1 exit status
Makefile:101: recipe for target 'jfbview' failed
make[1]: *** [jfbview] Error 1
make[1]: Leaving directory '/home/tehnyaz/git-cloned/jfbview'
Makefile:125: recipe for target 'all' failed
make: *** [all] Error 2
edit: formatting.
I'm getting a handful of errors when I try to compile. I've reproduced them below:
g++ -Wall -O3 -c -o pdf_document.o pdf_document.cpp
In file included from pdf_document.cpp:22:0:
pdf_document.hpp:111:3: error: 'fz_bbox' does not name a type
pdf_document.cpp: In member function 'virtual const Document::PageSize PDFDocument::GetPageSize(int, float, int)':
pdf_document.cpp:74:9: error: 'fz_bbox' does not name a type
pdf_document.cpp:76:19: error: 'bbox' was not declared in this scope
pdf_document.cpp: In member function 'virtual void PDFDocument::Render(Document::PixelWriter_, int, float, int)':
pdf_document.cpp:122:9: error: 'fz_bbox' does not name a type
pdf_document.cpp:123:75: error: 'bbox' was not declared in this scope
pdf_document.cpp:128:56: error: cannot convert 'const fz_matrix' to 'const fz_matrix_ {aka const fz_matrix_s_}' for argument '4' to 'void pdf_run_page(pdf_document_, pdf_page_, fz_device_, const fz_matrix_, fz_cookie_)'
pdf_document.cpp: In member function 'fz_matrix PDFDocument::Transform(float, int)':
pdf_document.cpp:252:39: error: cannot convert 'float' to 'fz_matrix* {aka fz_matrix_s_}' for argument '1' to 'fz_matrix_ fz_scale(fz_matrix_, float, float)'
pdf_document.cpp:253:38: error: invalid conversion from 'int' to 'fz_matrix_ {aka fz_matrix_s_}' [-fpermissive]
pdf_document.cpp:253:38: error: too few arguments to function 'fz_matrix_ fz_rotate(fz_matrix_, float)'
In file included from /usr/include/mupdf.h:4:0,
from pdf_document.hpp:28,
from pdf_document.cpp:22:
/usr/include/fitz.h:957:12: note: declared here
pdf_document.cpp: At global scope:
pdf_document.cpp:257:1: error: 'fz_bbox' does not name a type
pdf_document.cpp: In member function 'virtual const Document::PageSize PDFDocument::GetPageSize(int, float, int)':
pdf_document.cpp:77:1: warning: control reaches end of non-void function [-Wreturn-type]
make: *_* [pdf_document.o] Error 1
When opening a PDF, I get warning: dropping unclosed device
printed on screen; when I hit escape, the message stays up for a second longer and then goes away. It looks like the warning comes from the call here to this line of the MuPDF function fz_drop_device
.
I'm using Arch Linux on ARM and MuPDF 1.13. Let me know if there's anything more I can do that would help diagnose the issue!
1.17 has some security issues apparently..
Is there a timeline for building with newer versions in the future?
Would it be possible to add you fantastic package to those OSs?
First of all the program is wonderful, works great for viewing pdfs in framebuffer.
But I noticed that the compiled binaries jfbview
, jpdfcat
and jpdfgrep
have a total size of over 100MB, while the project source files are only under 200K.
Of course the static libmupdf seems to be about 50MB. Despite this, I think seperate executables for jpdfcat
and jpdfgrep
aren't necessary as they also include a copy of libmupdf (thus we got a total 3 of them) but only provide a tiny additional functionality. My thoughts are merge the functionalities of jpdfcat
and jpdfgrep
into jfbview
by providing a --prep
and a --cat
option or something similar.
make results to the following, trying to compile with libmupdf 1.12.0-2
make
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10012 -c -o pdf_document.o pdf_document.cpp
pdf_document.cpp: In member function ‘virtual void PDFDocument::Render(Document::PixelWriter*, int, float, int)’:
pdf_document.cpp:162:56: error: invalid conversion from ‘int’ to ‘fz_separations* {aka fz_separations_s*}’ [-fpermissive]
_fz_context, fz_device_rgb(_fz_context), &bbox, 1);
^
pdf_document.cpp:162:56: error: too few arguments to function ‘fz_pixmap* fz_new_pixmap_with_bbox(fz_context*, fz_colorspace*, const fz_irect*, fz_separations*, int)’
In file included from /usr/include/mupdf/fitz.h:35:0,
from /usr/include/mupdf/pdf.h:4,
from pdf_document.cpp:29:
/usr/include/mupdf/fitz/pixmap.h:86:12: note: declared here
fz_pixmap *fz_new_pixmap_with_bbox(fz_context *ctx, fz_colorspace *colorspace, const fz_irect *bbox, fz_separations *seps, int alpha);
^~~~~~~~~~~~~~~~~~~~~~~
pdf_document.cpp: In member function ‘std::__cxx11::string PDFDocument::GetPageText(int, int)’:
pdf_document.cpp:231:3: error: ‘fz_stext_sheet’ was not declared in this scope
fz_stext_sheet* text_sheet = fz_new_stext_sheet(_fz_context);
^~~~~~~~~~~~~~
pdf_document.cpp:231:3: note: suggested alternative: ‘fz_stext_page’
fz_stext_sheet* text_sheet = fz_new_stext_sheet(_fz_context);
^~~~~~~~~~~~~~
fz_stext_page
pdf_document.cpp:231:19: error: ‘text_sheet’ was not declared in this scope
fz_stext_sheet* text_sheet = fz_new_stext_sheet(_fz_context);
^~~~~~~~~~
pdf_document.cpp:231:32: error: ‘fz_new_stext_sheet’ was not declared in this scope
fz_stext_sheet* text_sheet = fz_new_stext_sheet(_fz_context);
^~~~~~~~~~~~~~~~~~
pdf_document.cpp:231:32: note: suggested alternative: ‘fz_new_stext_page’
fz_stext_sheet* text_sheet = fz_new_stext_sheet(_fz_context);
^~~~~~~~~~~~~~~~~~
fz_new_stext_page
pdf_document.cpp:258:8: error: ‘fz_page_block’ was not declared in this scope
for (fz_page_block* page_block = text_page->blocks;
^~~~~~~~~~~~~
pdf_document.cpp:258:8: note: suggested alternative: ‘fz_page_s’
for (fz_page_block* page_block = text_page->blocks;
^~~~~~~~~~~~~
fz_page_s
pdf_document.cpp:258:23: error: ‘page_block’ was not declared in this scope
for (fz_page_block* page_block = text_page->blocks;
^~~~~~~~~~
pdf_document.cpp:258:23: note: suggested alternative: ‘page_struct’
for (fz_page_block* page_block = text_page->blocks;
^~~~~~~~~~
page_struct
pdf_document.cpp:258:47: error: ‘fz_stext_page {aka struct fz_stext_page_s}’ has no member named ‘blocks’
for (fz_page_block* page_block = text_page->blocks;
^~~~~~
pdf_document.cpp:259:32: error: ‘fz_stext_page {aka struct fz_stext_page_s}’ has no member named ‘blocks’
page_block < text_page->blocks + text_page->len;
^~~~~~
pdf_document.cpp:259:52: error: ‘fz_stext_page {aka struct fz_stext_page_s}’ has no member named ‘len’
page_block < text_page->blocks + text_page->len;
^~~
pdf_document.cpp:262:29: error: ‘FZ_PAGE_BLOCK_TEXT’ was not declared in this scope
if (page_block->type != FZ_PAGE_BLOCK_TEXT) {
^~~~~~~~~~~~~~~~~~
pdf_document.cpp:262:29: note: suggested alternative: ‘FZ_STEXT_BLOCK_TEXT’
if (page_block->type != FZ_PAGE_BLOCK_TEXT) {
^~~~~~~~~~~~~~~~~~
FZ_STEXT_BLOCK_TEXT
pdf_document.cpp:267:49: error: ‘fz_stext_block {aka struct fz_stext_block_s}’ has no member named ‘lines’
for (fz_stext_line* text_line = text_block->lines;
^~~~~
pdf_document.cpp:268:34: error: ‘fz_stext_block {aka struct fz_stext_block_s}’ has no member named ‘lines’
text_line < text_block->lines + text_block->len;
^~~~~
pdf_document.cpp:268:54: error: ‘fz_stext_block {aka struct fz_stext_block_s}’ has no member named ‘len’
text_line < text_block->lines + text_block->len;
^~~
pdf_document.cpp:271:12: error: ‘fz_stext_span’ was not declared in this scope
for (fz_stext_span* text_span = text_line->first_span;
^~~~~~~~~~~~~
pdf_document.cpp:271:12: note: suggested alternative: ‘fz_text_span’
for (fz_stext_span* text_span = text_line->first_span;
^~~~~~~~~~~~~
fz_text_span
pdf_document.cpp:271:27: error: ‘text_span’ was not declared in this scope
for (fz_stext_span* text_span = text_line->first_span;
^~~~~~~~~
pdf_document.cpp:271:27: note: suggested alternative: ‘fz_text_span’
for (fz_stext_span* text_span = text_line->first_span;
^~~~~~~~~
fz_text_span
pdf_document.cpp:271:50: error: ‘fz_stext_line {aka struct fz_stext_line_s}’ has no member named ‘first_span’; did you mean ‘first_char’?
for (fz_stext_span* text_span = text_line->first_span;
^~~~~~~~~~
first_char
pdf_document.cpp:293:3: error: ‘fz_drop_stext_sheet’ was not declared in this scope
fz_drop_stext_sheet(_fz_context, text_sheet);
^~~~~~~~~~~~~~~~~~~
pdf_document.cpp:293:3: note: suggested alternative: ‘fz_drop_stext_page’
fz_drop_stext_sheet(_fz_context, text_sheet);
^~~~~~~~~~~~~~~~~~~
fz_drop_stext_page
make: *** [<builtin>: pdf_document.o] Error 1
Howdy, i packaged your fine output into an alpinelinux package. And I wondered if you plan adding a search feature?
following the instructions and installing the dependencies first,
which included
The following NEW packages will be installed:
libjbig2dec0-dev libmupdf-dev libopenjp2-7-dev
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
and reported no errors
then make fails with
/usr/bin/ld: cannot find -lopenjpeg
I had previously questioned about this in another non related issue, some time ago.
I decided to open this issue, specific only to this question, should this request ever be taken in consideration.
Currently jfbview only accepts one file as it's input.
So, for example if I'm in a folder, containing many pdf files, or, a folder containing many pictures, this will happen:
$ jfbview *.jpg
Please specify exactly one input file. Try "-h" for help.
or
$ jfbview *.pdf
Please specify exactly one input file. Try "-h" for help.
Specifying a folder as input:
CASE 1: One file only inside a folder:
$ ls ./some_folder/
some_picture.jpg
$ jfbview some_folder/
error: read error: Is a directory
error: cannot recognize version marker
error: read error: Is a directory
error: read error: Is a directory
error: cannot tell in file
Failed to open document "some_folder/".
This will work:
$ jfbview some_folder/*.jpg
CASE2: With more than one file inside a folder, it will not work:
$ cp another_picture.jpg some_folder/
$ ls ./some_folder/
some_picture.jpg another_picture.jpg
$ jfbview some_folder/*.jpg
Please specify exactly one input file. Try "-h" for help.
$ jfbview some_folder/
error: read error: Is a directory
error: cannot recognize version marker
error: read error: Is a directory
error: read error: Is a directory
error: cannot tell in file
Failed to open document "some_folder/".
I would be nice if all this was possible.
Accetping the usual shell expansion "*." :
jfbview /path/to/some-folder/full-of-images-or-pdfs/*.pdf
And even better if it could be made recursively
For example, with a "-r" flag, or
Something like:
jfbview -r /path/to/pictures/
pictures/
├── 2020
│ ├── family
│ ├── vacation
│ └── work
├── 2021
│ ├── family
│ ├── vacation
│ └── work
└── 2022
├── family
├── vacation
└── work
12 directories, 0 files
is the intention that it'd automatically switch to file 2 when you reach the end of file 1 and so on?
yes, something like that. If you keep pressing "n" or "Space" it opens the next file, "p" or "Backspace" the previous, and "q" quits.
Something like the way sxiv and feh do it:
sxiv /path/to/folder-with-pictures/
or recursevly
sxiv -r /path/to/folder-containing-subfolders-with-pictures/
man sxiv:
-r Search the given directories recursively for images to view.
feh /path/to/folder-with-pictures/
recursevly
feh -r /path/to/folder-containing-subfolders-with-pictures/
man feh:
-r, --recursive
Recursively expand any directories in the command line arguments to the content of those directo‐
ries, all the way down to the bottom level.
I can confirm the deb already provided in the packaging folder works great under Debian 10.
But if I try to build myself I get
sudo ./build-package-deb.sh
Hi there,
I don't know why but on my new Arch Linux setup jfbview just gives me a black screen in the tty. Pressing q to exit does work, though.
Cheers
After building this project on Raspberry Pi 1 (armv6) on the Archlinux ARM distribution, all libs updated, I cannot see anything on the HDMI display.
Other programs (like fbi, qt) run fine using the framebuffer.
My command line was like this -- over SSH:
jfbview --fb=/dev/fb0 --page=2 --zoom_to_width '/usr/share/doc/libxml2-2.9.9/html/tutorial/xmltutorial.pdf'
I notice the SSH console cleared and turned gray, but nothing was shown neither on the SSH console nor on the HDMI display.
Maybe a debug option would be useful? I'd gladly test it again.
Thank you for sharing your work.
It looks like the header file "mupdf.h" was renamed to "pdf.h" and moved to a new "include" directory starting with this commit (http://git.ghostscript.com/?p=mupdf.git;a=commitdiff;h=03e5755b93e90cc4c09daad4c79b6016bf4ce43c).
JFBView does not compile therefore because it cannot find the required header files.
Hi!
I'm running Arch Linux, with G++ 9.2.0, kernel info as follows:
Linux archlinux 5.4.10-arch1-1 #1 SMP PREEMPT Thu, 09 Jan 2020 10:14:29 +0000 x86_64 GNU/Linux
System was just updated with sudo pacman -Syu, 2-3 hours earlier.
I opened a terminal in the the main folder of 'yay', and ran
'''
yay -S jfbiew
'''
yay started to build in the following below directory.
/home/saif/.cache/yay/jfbview/src/jfbview-0.5.6
Towards the end, I ran into the error of 'main.cpp:<stropts.h>, no such file or directory', during the build process.
To solve that, I ran the risk of running,
'''
touch /usr/include/stropts.h
'''
which solved this problem. After that, I ran 'yay -S jfbview' again, and this time, I was thrown the error of, 'ioctl was not declared in the scope'.
Googling this issue revealed that it needed a header file, #include <sys/ioctls.h>, but I do not know where to make this addition to, or which lines to edit to fix this.
I tried cd'ing into where the build was being made, and inserted a line for the header file, but I'm not sure if that's correct because the end result is still that the build stopped halfway through in main.cpp.
Screenshots are attached as imgur links,
1): [https://imgur.com/Ra3doab](Accepting installation process)
2): [https://imgur.com/armXQtL](Error thrown during build)
Thank you for your time!
would it be possible to make next and previous page be on different edges than default or make it so you have to use next page key?
(for a use case i am using this on a handheld it has a rotated screen that right now after rotating the screen to match left edge is next page.)
When I attach an external monitor to my laptop ( which gets mirrored ) jfbview outputs multiples of what is being displayed all overlapping each other. Nor does it get the screen size correct. Any idea why? Green pdf viewer works but I can't switch virtual TTY's when its being used for some reason and I've always used jfbview before having this problem.
This is from my Arch Linux machine. I tried compiling it and I got this error:
g++ -std=c++1y -Wall -O2 -c -o pdf_document.o pdf_document.cpp
pdf_document.cpp: In static member function ‘static PDFDocument* PDFDocument::Open(const string&, int)’:
pdf_document.cpp:54:51: error: ‘pdf_close_document’ was not declared in this scope
pdf_close_document(context, raw_pdf_document);
^
pdf_document.cpp: In destructor ‘virtual PDFDocument::~PDFDocument()’:
pdf_document.cpp:76:48: error: ‘pdf_close_document’ was not declared in this scope
pdf_close_document(_fz_context, _pdf_document);
^
pdf_document.cpp: In member function ‘std::__cxx11::string PDFDocument::GetPageText(int, int)’:
pdf_document.cpp:172:3: error: ‘fz_text_sheet’ was not declared in this scope
fz_text_sheet* text_sheet = fz_new_text_sheet(_fz_context);
^
pdf_document.cpp:172:18: error: ‘text_sheet’ was not declared in this scope
fz_text_sheet* text_sheet = fz_new_text_sheet(_fz_context);
^
pdf_document.cpp:172:60: error: ‘fz_new_text_sheet’ was not declared in this scope
fz_text_sheet* text_sheet = fz_new_text_sheet(_fz_context);
^
pdf_document.cpp:173:3: error: ‘fz_text_page’ was not declared in this scope
fz_text_page* text_page = fz_new_text_page(_fz_context);
^
pdf_document.cpp:173:17: error: ‘text_page’ was not declared in this scope
fz_text_page* text_page = fz_new_text_page(_fz_context);
^
pdf_document.cpp:173:57: error: ‘fz_new_text_page’ was not declared in this scope
fz_text_page* text_page = fz_new_text_page(_fz_context);
^
pdf_document.cpp:174:73: error: ‘fz_new_text_device’ was not declared in this scope
fz_device* dev = fz_new_text_device(_fz_context, text_sheet, text_page);
^
pdf_document.cpp:180:66: error: ‘fz_begin_page’ was not declared in this scope
fz_begin_page(_fz_context, dev, &fz_infinite_rect, &fz_identity);
^
pdf_document.cpp:183:31: error: ‘fz_end_page’ was not declared in this scope
fz_end_page(_fz_context, dev);
^
pdf_document.cpp:194:5: error: ‘fz_text_block’ was not declared in this scope
fz_text_block* const text_block = page_block->u.text;
^
pdf_document.cpp:194:20: error: expected primary-expression before ‘const’
fz_text_block* const text_block = page_block->u.text;
^
In file included from /usr/include/c++/5.3.0/cassert:43:0,
from cache.hpp:27,
from pdf_document.hpp:29,
from pdf_document.cpp:31:
pdf_document.cpp:195:12: error: ‘text_block’ was not declared in this scope
assert(text_block != nullptr);
^
pdf_document.cpp:196:10: error: ‘fz_text_line’ was not declared in this scope
for (fz_text_line* text_line = text_block->lines;
^
pdf_document.cpp:196:24: error: ‘text_line’ was not declared in this scope
for (fz_text_line* text_line = text_block->lines;
^
pdf_document.cpp:204:36: error: ‘fz_text_span {aka struct fz_text_span_s}’ has no member named ‘text’
const int c = text_span->text[i].c;
^
pdf_document.cpp:222:43: error: ‘fz_drop_text_page’ was not declared in this scope
fz_drop_text_page(_fz_context, text_page);
^
pdf_document.cpp:223:45: error: ‘fz_drop_text_sheet’ was not declared in this scope
fz_drop_text_sheet(_fz_context, text_sheet);
^
<builtin>: recipe for target 'pdf_document.o' failed
make: *** [pdf_document.o] Error 1
Feature request: Automatically reload a file when the file changes on disk. This is useful e.g. for LaTeX editing.
Hi, jfbview is actually very neat viewer.
I'd love to have it one more feature:
Why? I'd love to continue reading book another day from last read page. This way, i could note page number somewhere and then jump right to it.
What would also solve this would be permanent marks between jfbviews reexecutions. But i guess, this would be rather more complicated.
I actually looked at code, and was lost. I do some higher level programming and a little bit of plain C, but this is complete gibberish for me :)
Compilation errors under MuPDF 1.14:
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10014 -c -o pdf_document.o pdf_document.cpp pdf_document.cpp: In member function ‘virtual void PDFDocument::Render(Document::PixelWriter*, int, float, int)’:
pdf_document.cpp:169:48: error: could not convert ‘& bbox’ from ‘const fz_irect*’ {aka ‘const fz_irect_s*’} to ‘fz_irect’ {aka ‘fz_irect_s’}
_fz_context, fz_device_rgb(_fz_context), &bbox, nullptr, 1); ^~~~~
pdf_document.cpp:170:52: error: could not convert ‘& fz_identity’ from ‘const fz_matrix*’ {aka ‘const fz_matrix_s*’} to ‘fz_matrix’ {aka ‘fz_matrix_s’}
fz_device* dev = fz_new_draw_device(_fz_context, &fz_identity, pixmap); ^~~~~~~~~~~~
pdf_document.cpp:174:62: error: could not convert ‘& m’ from ‘const fz_matrix*’ {aka ‘const fz_matrix_s*’} to ‘fz_matrix’ {aka ‘fz_matrix_s’}
pdf_document.cpp:51:47:
pdf_run_page((context), (page), (dev), (matrix), (cookie))
~~~~~~~~
pdf_document.cpp:174:62:
pdf_run_page(_fz_context, _pdf_document, page_struct, dev, &m, nullptr);
pdf_document.cpp:51:48: note: in definition of macro ‘pdf_run_page’
pdf_run_page((context), (page), (dev), (matrix), (cookie))
^~~~~~
pdf_document.cpp: In member function ‘fz_matrix PDFDocument::Transform(float, int)’:
pdf_document.cpp:410:12: error: cannot convert ‘fz_matrix*’ {aka ‘fz_matrix_s*’} to ‘float’
fz_scale(&scale_matrix, zoom, zoom);
^~~~~~~~~~~~~
In file included from /usr/include/mupdf/fitz/context.h:6,
from /usr/include/mupdf/fitz.h:11,
from /usr/include/mupdf/pdf.h:4,
from pdf_document.cpp:29:
/usr/include/mupdf/fitz/geometry.h:305:26: note: initializing argument 1 of ‘fz_matrix fz_scale(float, float)’
fz_matrix fz_scale(float sx, float sy);
~~~~~~^~
pdf_document.cpp:411:13: error: cannot convert ‘fz_matrix*’ {aka ‘fz_matrix_s*’} to ‘float’
fz_rotate(&rotate_matrix, rotation);
^~~~~~~~~~~~~~
In file included from /usr/include/mupdf/fitz/context.h:6,
from /usr/include/mupdf/fitz.h:11,
from /usr/include/mupdf/pdf.h:4,
from pdf_document.cpp:29:
/usr/include/mupdf/fitz/geometry.h:374:27: note: initializing argument 1 of ‘fz_matrix fz_rotate(float)’
fz_matrix fz_rotate(float degrees); ~~~~~~^~~~~~~
pdf_document.cpp:412:13: error: could not convert ‘& transformation_matrix’ from ‘fz_matrix*’ {aka ‘fz_matrix_s*’} to ‘fz_matrix’ {aka ‘fz_matrix_s’}
fz_concat(&transformation_matrix, &scale_matrix, & rotate_matrix);
^~~~~~~~~~~~~~~~~~~~~~
pdf_document.cpp: In member function ‘fz_irect PDFDocument::GetBoundingBox(pdf_page*, const fz_matrix&)’:
pdf_document.cpp:53:48: error: too many arguments to function ‘fz_rect pdf_bound_page(fz_context*, pdf_page*)’
pdf_bound_page((context), (page), (bbox))
^
pdf_document.cpp:422:7: note: in expansion of macro ‘pdf_bound_page’
pdf_bound_page(_fz_context, _pdf_document, page_struct, &bbox), &m));
^~~~~~~~~~~~~~
In file included from /usr/include/mupdf/pdf.h:16,
from pdf_document.cpp:29:
/usr/include/mupdf/pdf/page.h:61:9: note: declared here
fz_rect pdf_bound_page(fz_context *ctx, pdf_page *page); ^~~~~~~~~~~~~~
pdf_document.cpp:422:71: error: could not convert ‘& m’ from ‘const fz_matrix*’ {aka ‘const fz_matrix_s*’} to ‘fz_matrix’ {aka ‘fz_matrix_s’}
pdf_bound_page(_fz_context, _pdf_document, page_struct, &bbox), &m));
^~
make: *** [<builtin>: pdf_document.o] Error 1
My current workaround for viewing djvu files on the fb console looks like this:
#!/bin/bash
#
# fbdjview --- View DjVu files on Linux framebuffer console
# By Tigran Aivazian, v1.0, 29 December 2017
# License: GPLv3
#
# Pre-requisites: fbi and ddjvu (Run "sudo apt install fbi djvulibre-bin" to install on Ubuntu)
#
if [ $# -ne 1 ] ; then
echo "Usage: fbdjview file.djvu"
exit 1
fi
if [ ! -f "$1" ] ; then
echo "fbdjview: No such file \"$1\""
exit 2
fi
md5=$(md5sum "$1" | cut -d' ' -f1)
cachedir=~/.cache/fbdjview/$md5
function cleanup() {
echo "Cleaning up $cachedir"
rm -rf $cachedir
exit
}
trap cleanup SIGINT
if [ ! -d $cachedir ] ; then
mkdir -p $cachedir
echo -n "Please wait, generating cache in $cachedir ..."
ddjvu -eachpage -scale=150 -format=tiff "$1" $cachedir/page%04d.tif || cleanup
fi
fbi -a $cachedir/page*.tif
The obvious drawback is that it needs to generate the cache for the first viewing of any file and that it uses up disk space for this cache. So, it would be very nice if jfbview supported djvu format natively.
I would love to be able to display pages with white text on a black background to reduce eyestrain and ease reading lengthy text in dark environments. I currently use Zathura's invert feature to read pdfs but it sadly relies on X11.
pdf_drop_page
no longer seems to exist.
mupdf news doesn't mention any breaking changes, but looks like they made one.
make
g++ -Wall -O2 -std=c++1y -o mupdf_version mupdf_version.cpp -lmupdf
=============================
Detected configuration:
MUPDF_VERSION = 10011
OPENJP2 = openjp2
=============================
make[1]: Entering directory '/home/colin/src/JFBView'
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10011 -c -o command.o command.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10011 -c -o document.o document.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10011 -c -o framebuffer.o framebuffer.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10011 -c -o image_document.o image_document.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10011 -c -o multithreading.o multithreading.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10011 -c -o outline_view.o outline_view.cpp
g++ -Wall -O2 -std=c++1y -DMUPDF_VERSION=10011 -c -o pdf_document.o pdf_document.cpp
pdf_document.cpp: In member function ‘virtual void PDFDocument::PDFPageCache::Discard(const int&, pdf_page* const&)’:
pdf_document.cpp:55:8: error: ‘pdf_drop_page’ was not declared in this scope
pdf_drop_page((context), (page))
^
pdf_document.cpp:360:3: note: in expansion of macro ‘pdf_drop_page’
pdf_drop_page(_parent->_fz_context, _parent->_pdf_document, page_struct);
^~~~~~~~~~~~~
pdf_document.cpp:55:8: note: suggested alternative: ‘pdf_run_page’
pdf_drop_page((context), (page))
^
pdf_document.cpp:360:3: note: in expansion of macro ‘pdf_drop_page’
pdf_drop_page(_parent->_fz_context, _parent->_pdf_document, page_struct);
^~~~~~~~~~~~~
make[1]: *** [<builtin>: pdf_document.o] Error 1
make[1]: Leaving directory '/home/colin/src/JFBView'
make: *** [Makefile:119: all] Error 2
Hello I tried using this today on ubuntu 15 and it seems like whenever I open a pdf I'm confronted with a blank terminal, I can still quit with q
I am getting following error message every time:
Error initializing framebuffer: Permission denied
Segmentation fault (core dumped)
Any solutions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.