How to add pdf thumbnails to ROX?

Word processors, spreadsheets, presentations, translation, etc.
Message
Author
dosh2684
Posts: 6
Joined: Tue 11 Jun 2013, 01:43

How to add pdf thumbnails to ROX?

#1 Post by dosh2684 »

i'd like to know if there is in any way for me to view thumbnails for all documents namely pdfs texts docs... heh i like ro view those when i browse thru rox or any file manager (if there is any).

how to go about this?

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#2 Post by Semme »

:D Though nonsense I agree, this post *may* get the ball rollin aboard Pup. As an aside, me thinks the big BOYZ have it.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#3 Post by Puppus Dogfellow »

http://bernaerts.dyndns.org/linux/76-gn ... l-nautilus

^perhaps can be adapted for puppy.
:?:

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#4 Post by Semme »

>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#5 Post by Puppus Dogfellow »

libreoffice gives document previews but only at launch and only in the "startcenter."

dosh2684
Posts: 6
Joined: Tue 11 Jun 2013, 01:43

#6 Post by dosh2684 »

how about rox? can rox do it?

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#7 Post by Puppus Dogfellow »

dosh2684 wrote:how about rox? can rox do it?
not until someone more competent shows up.
:D


my guess is that it can, but i'm not skilled enough to do it. it looks to me like the first script i linked to can generate the thumbnails. i don't see where it's specifically tied to nautilus, so i have no idea what to change to get it to work with rox (maybe it's just set to work with whatever is default?), but since the site says LO and OO and you also want pdf and doc/x, i'm not sure it'd fit your needs. libre itself can show previews for pretty much everything from what i've read, but i can't seem to find a way to be able to get back to the startcenter screen without first closing down the application and then restarting it. through LO seems like the simplest way since it has all the stuff needed to give the previews already built in. i'd like to see rox be able to do it as well--maybe mavrothal or mochimoppel or [there are many really skilled people here] will happen upon this thread and add something more helpful.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#8 Post by musher0 »

Hi, dosh2684.

If you really want to see pdfs in thumbnails, I can't help you much, I know little
about image programming. (EDIT: I'm taking that back! See below!)

However, if you want to quickly see the contents of a pdf file, even faster than with
epdfview, I may have a solution.

First download and install the pets from:
http://murga-linux.com/puppy/viewtopic. ... 877#745250 and
http://murga-linux.com/puppy/viewtopic. ... 877#745241
(The latter is the real "less", not the crippled "busybox" one that ships by default in
most Puppies. This real one has many more features.)

Then put this little script in /root//my-applications/bin as file pdf2less.sh.

Code: Select all

#!/bin/sh
# Location and title: 
# ~/my-applications/bin/pdf2less.sh
# (c) musher0, 2014-12-17
####
pdftotext -layout "$@" /tmp/pdf-to.txt | view-with-less.sh /tmp/pdf-to.txt
rm /tmp/pdf-to.txt
(Included in zip file below.) pdftotext normally ships in all Puppies.

Then in rox, open folder /root/.config/rox.sourceforge.net/OpenWith/.application_pdf
and make a symlink from ~/my-applications/bin/pdf2less.sh to there.

Next time you right click over a pdf file, you'll see a new entry. Left click on it, and
your pdf will open in plain text in less. (See pic below.)

I hope this answers part of your question.
(EDIT: It should for any "txt" or similar.)

Best regards.

musher0
Attachments
pdf2less.jpg
Don't worry about the instructions in French at the bottom of the window. The
&quot;view-in-less&quot; script is bilingual. The instructions at the bottom will show in English
in your Puppy if you have a default set-up.
(49.78 KiB) Downloaded 322 times
pdf2less.sh.zip
(311 Bytes) Downloaded 285 times
Last edited by musher0 on Wed 17 Dec 2014, 12:55, edited 2 times in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#9 Post by musher0 »

Alternatively, if you have the pdf plugin-in installed in abiword, you can view the text
contents of any pdf file in abiword. Same principle as above: you make a link from
/usr/local/bin/defaultwordprocessor to
/root/.config/rox.sourceforge.net/SendTo/.application_pdf/.
(See pic.)
Attachments
view-pdf-in-abiword.jpg
(40.61 KiB) Downloaded 306 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#10 Post by musher0 »

Back to generating actual pdf thumbnails, I found this, which avoids IMageMagick's slowness.
http://www.linuxquestions.org/questions ... ter-57142/
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#11 Post by musher0 »

For the record, this java app generates thumbnails as well as bookmarks.
http://flavianopetrocchi.blogspot.ca/
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#12 Post by musher0 »

There you go! For pdf's at least ! :)

Code: Select all

#!/bin/sh
# Location and title: 
# ~/my-applications/bin/pdf2thumb.sh
# (c) musher0, 2014-12-17
####
# set -xv
dirpath=${@%/*}
NOMFICHIER="`basename "$1" | cut -d. -f1`"
pdftops "$@"
cd $dirpath
pstopnm $NOMFICHIER.ps
# These little pnm* executables are pretty fussy, so 
# we have to take the winding road.
for i in `ls -1 $NOMFICHIER*.ppm`;do
	pnmscale 0.2 $i > "`basename $i | cut -d. -f1`".pnm
# For thumbnails, parameter can be from 0.1 to 0.3
done
for i in `ls -1 $NOMFICHIER*.pnm`;do
	pnmtojpeg $i > "`basename $i | cut -d. -f1`".jpg
done
rm -f *.p?m 
rm -f *.ps
mtpaint -v "$NOMFICHIER"00?.jpg
# set +xv
####
# Final note.
# Usage from cli: 
# pdf2thumb.sh <nameof>.pdf
Usage: Same principle: copy the above and past in file pdf2thumb.sh in folder
~/my-applications/bin. Make it executable.
Then make a kink from there to folder
/root/.config/rox.sourceforge.net/OpenWith/.application_pdf.

Now when you want to view some pdf thumbnails, highlight the file, right-click on it,
choose pdf2thumbs.sh in the list, and left-click.

Note. It still takes pretty iong. The bigger the pdf, the longer the process, of course.
For example, are you really sure that you want to view the bashReference.pdf in
160 thumbnails? :twisted: I suppose you could take out the trash in the meantime! ;)

BTW, all valid improvements are welcome.

Enjoy! :)

musher0
Attachments
pdf2thumb.sh.zip
(574 Bytes) Downloaded 237 times
pdf2thumb.jpg
(32.43 KiB) Downloaded 291 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#13 Post by Semme »

:D I suppose organization skills and a memory couldn't hurt.

Musher, can you even read those from your systems view?
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#14 Post by Puppus Dogfellow »

musher, does your program generate a preview for every page? if so, is there a way to limit it to just the first page? i think the main purpose of a preview thumbnail is to give a document a unique icon that helps identify its contents and visually differentiate similarly titled files, in which case the cover shot (so to speak) should be enough. i think most previews show only the first page for this reason, or at least i'm not aware of any that show more than the first page. then again, libreoffice, old memories of windows, and google drive are the only things i've used that actually give document previews, or at least so it seems to me in my morning grogginess.

anyway, cool (but if you want to look at 20 pages of a document at a time you'd probably be better off using libreoffice and making the pages fit your screen as legibly as possible).

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#15 Post by musher0 »

Semme wrote::D I suppose organization skills and a memory couldn't hurt.

Musher, can you even read those from your systems view?
Nope! :) Not even in mtpaint! :) What are you getting at, man? :)
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#16 Post by musher0 »

Puppus Dogfellow wrote:musher, [...] is there a way to limit it to just the first page? i think the main purpose of a preview thumbnail is to give a document a unique icon that helps identify its contents and visually differentiate similarly titled files, in which case the cover shot (so to speak) should be enough. [... ]
Now you tell me! :) Ok, guys, version 2 coming up! :)
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#17 Post by musher0 »

Hi, guys.

Best I can do ATM taking into consideration the remarks of both of you. For some
reason, if the # of p. is limited to 1 in pdftops, later, pmnmscale doesn't like ti. So
we have 2 pages minimum. Also, I don't like the wide whitespace at the top and at
the right, and the guilty program should be hunted down later. Finally, if we want to
be able to read the content, IMO, these are not "thumbnails" anymore, simply
"reduced-size images".

Which is why it's not version 2 yet, only version 1a! Sorry. Again, you're welcome
to fiddle with the script to improve it. BFN.

musher0
#!/bin/sh
# Location and title:
# ~/my-applications/bin/pdf2thumb-1a.sh
# Version 1a, for Semme and PuppusDogfellow! ;)
# (c) musher0, 2014-12-17
####
# set -xv
dirpath=${@%/*}
NOMFICHIER="`basename "$1" | cut -d. -f1`"
pdftops -f 1 -l 2 "$@"
cd $dirpath
pstopnm -xsize=700 -ysize=900 -portrait $NOMFICHIER.ps
# -dpi=300, no.
# These little pnm* executables are pretty fussy, so
# we have to take the winding road.
for i in `ls -1 $NOMFICHIER*.ppm`;do
pnmscale 0.9 $i > "`basename $i | cut -d. -f1`".pnm
# This is barely readable... # Still, for real thumbnails, parameter should be from 0.1 to 0.3.
done
for i in `ls -1 $NOMFICHIER*.pnm`;do
pnmtojpeg $i > "`basename $i | cut -d. -f1`".jpg
done
wait
rm -f *.p?m
rm -f *.ps
mtpaint -v "$NOMFICHIER"00?.jpg || defaultimageviewer "$NOMFICHIER"00?.jpg
# set +xv
####
# Final note.
# Usage from cli:
# pdf2thumb.sh <nameof>.pdf
Attachments
article001.jpg
I removed about an inch of whitespace at the top and right borders...
Readable... barely. :)
(60.39 KiB) Downloaded 273 times
Last edited by musher0 on Wed 17 Dec 2014, 22:49, edited 1 time in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#18 Post by musher0 »

Re-reading the title:
the script produces "thumbnails" NOT integrated to ROX...
Oh well...
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#19 Post by Semme »

To our OP, Dosh.. What's the *target icon size* here, and *where* are you accustomed to viewing such a preview?
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#20 Post by musher0 »

Semme wrote:To our OP, Dosh.. What's the *target icon size* here, and *where* are
you accustomed to viewing such a preview?
Hi Semme.

I'd suggest that Dosh is a WhineDose refugee. WhineDose Explorer has it and a couple of
document organiszers in WhineDose * Seven.

musher0

~~~~~~~
* The OS that Whines if it doesn't get it's Dose (of anti-something). Hey, man, fear
sells! (It's not just sex anymore !) :twisted: .
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply