Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on PostScript and PDF.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/ps.e>
#           or at <http://angg.twu.net/e/ps.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######




# «.ps-mode.el»			(to "ps-mode.el")
# «.gv»				(to "gv")
# «.gv-big-window»		(to "gv-big-window")
# «.gv-very-spartan»		(to "gv-very-spartan")
# «.gv-cvs»			(to "gv-cvs")
# «.gv-deb-src»			(to "gv-deb-src")
# «.ghostscript-deb-src»	(to "ghostscript-deb-src")
# «.gs-dj610c»			(to "gs-dj610c")
# «.gs_primitives»		(to "gs_primitives")
# «.gs_interactively»		(to "gs_interactively")
# «.gv_psheaders»		(to "gv_psheaders")
# «.pstotext»			(to "pstotext")
# «.gs_read_file»		(to "gs_read_file")
# «.eps_crop_to_jpg»		(to "eps_crop_to_jpg")
# «.gsfonts»  			(to "gsfonts")
# «.encrypted_pdfs»		(to "encrypted_pdfs")
# «.gv-starting-page»		(to "gv-starting-page")
# «.eemp»			(to "eemp")
# «.xpdftools»			(to "xpdftools")
# «.gv-version»			(to "gv-version")
# «.xpdf»			(to "xpdf")
# «.xpdf-deb-src»		(to "xpdf-deb-src")
# «.xpdf-touchpad-scroll»	(to "xpdf-touchpad-scroll")
# «.xpdf-ubuntu»		(to "xpdf-ubuntu")
# «.djvulibre-deb-src»		(to "djvulibre-deb-src")
# «.gv-lpr»			(to "gv-lpr")
# «.eepitch-gs»			(to "eepitch-gs")
# «.ps-intro»			(to "ps-intro")
# «.books»			(to "books")
# «.gs-examples»		(to "gs-examples")
# «.run»			(to "run")
# «.tex.pro»			(to "tex.pro")
# «.psutils»			(to "psutils")
# «.pdfpages»			(to "pdfpages")
# «.pdfjam»			(to "pdfjam")
# «.pdfnup»			(to "pdfnup")
# «.default-pdf-viewer»		(to "default-pdf-viewer")
# «.see»			(to "see")
# «.pdftk»			(to "pdftk")
# «.qpdf»			(to "qpdf")
# «.qpdf-merge»			(to "qpdf-merge")
# «.djvu-to-pdf»		(to "djvu-to-pdf")
# «.djview»			(to "djview")
# «.other-djvu-viewers»		(to "other-djvu-viewers")
# «.evince»			(to "evince")
# «.pdftotext»			(to "pdftotext")
# «.pdftotext-for-windows»	(to "pdftotext-for-windows")
# «.pdftotext-spurious-ffs»	(to "pdftotext-spurious-ffs")
# «.page-labels»		(to "page-labels")
# «.reduce-pdf-file-size»	(to "reduce-pdf-file-size")
# «.zathura»			(to "zathura")
# «.mupdf»			(to "mupdf")
# «.epdfview»			(to "epdfview")
# «.okular»			(to "okular")
# «.paps»			(to "paps")
# «.pypdf»			(to "pypdf")




# (find-zsh "installeddebs | sort | grep pdf")
# (find-zsh "availabledebs | sort | grep pdf")




#####
#
# ps-mode.el
#
#####

# «ps-mode.el»  (to ".ps-mode.el")
# http://odur.let.rug.nl/~kleiweg/postscript/
# (find-efile "progmodes/ps-mode.el")
# (find-efunction 'ps-mode)
# (find-evariable 'ps-run-x)

(setq ps-run-x '("gs" "-r36" "-sPAPERSIZE=a4"))
(require 'ps-mode)
(progn (ps-mode) (ps-run-start))
(ps-run-quit)

%*
% (eeb-psrun)
% (eeb-invoke 'ps-run-region ee-delimiter-percent)
%
/dx 120 def
/dy 120 def
/x0 60 def
/y0 60 def
/myp {dy mul y0 add exch dx mul x0 add exch} def
/defp {myp 2 array astore cvx def} def
  /p7 0 3 defp  /p8 1 3 defp  /p9 2 3 defp
  /p4 0 2 defp  /p5 1 2 defp  /p6 2 2 defp
  /p1 0 1 defp  /p2 1 1 defp  /p3 2 1 defp
/foo { newpath p3 moveto p4 lineto p9 lineto closepath } def
foo gsave 1 1 0 setrgbcolor fill grestore
    gsave 8 setlinewidth stroke grestore

%*
% (eeb-psrun)
/Times-Roman findfont
100 scalefont setfont
72 200 moveto
(typography) show

%*



#####
#
# gv
# 2000dec17
#
#####

# (find-status "gv")
# (find-vldifile "gv.list")
# (find-fline "/usr/doc/gv/")

gv /usr/doc/gv/gv.ps.gz

# (find-w3 "/usr/doc/gv/gv.html")
# (find-w3 "/usr/doc/gv/gv-3.html" "-page")




#####
#
# gv
# 2005oct12
#
#####

# «gv»  (to ".gv")
# http://www.gnu.org/software/gv/
# http://savannah.gnu.org/projects/gv/

# About a bug that I reported:
# Bug #14319 overview: <pgup> and <pgdn> don't scroll the pages window
# http://savannah.gnu.org/bugs/?func=detailitem&item_id=14319
# (find-fline "/tmp/gv-pagewindow-scroll-fix.patch")

# «gv-big-window»  (to ".gv-big-window")
# (find-angg ".zshrc" "regv-beamer")
# About running gv in fullscreen mode by making it open a big window:
# (find-angg ".Xdefaults")
# (find-fline "/usr/lib/gv/gv_class.ad" "GV*background:")
# (find-man "X" "GEOMETRY SPECIFICATIONS")
# (find-node "(gv)Resources of gv" "*maximumWidth, maximumHeight*")
# (find-sh0 "echo 'GV*background: black' > ~/.gv")
# (find-sh0 "rm -v ~/.gv")
# (find-sh0 "gv --spartan --scale=3 -geometry 1135x785+916+737 $EEV/slides/slides.ps.gz")

# «gv-very-spartan»  (to ".gv-very-spartan")
# About running gv in fullscreen mode "the right way":

# (find-node "(dvips)Option summary")
# (find-man "1 gv")
# (find-node "(gv)Key Bindings")
# (find-node "(gv)How can I make even more room for the image?")
# (find-sh "gv --help")
# (find-fline "/usr/lib/gv/gv_spartan.dat")

# (find-fline "/usr/lib/gv/gv_spartan.dat")
# (find-fline "/tmp/veryspartan.dat")
# (find-angg ".zshrc" "regv-beamer")

#*
cat > /tmp/veryspartan.dat <<'%%%'
!##### Layouts
GV.control.MButton.font: -*-Helvetica-Medium-R-Normal--*-120-*-*-P-*-ISO8859-1
GV*orientationButton*forcedWidth:	72
GV*upsidedown.Label:			Up-Down
GV.?.processButton.label:		\ working

!##### Main Layout
!##### (find-file "/usr/lib/gv/gv_spartan.dat")
GV*control.layout: |v{ viewFrame<+[2]-100%*+9999-100%> }
%%%

* (eechannel-xterm "A")
gv --ad=/tmp/veryspartan.dat $EEV/slides/slides.ps &

(defun foo () (interactive)
  (eech "gv --ad=/tmp/veryspartan.dat $EEV/slides/slides.ps &\r"))




#####
#
# gv from cvs
# 2005oct12
#
#####

# «gv-cvs»  (to ".gv-cvs")
# http://www.gnu.org/software/gv/
# http://savannah.gnu.org/projects/gv/
#*
# Update gv-cvs.tar.gz
rm -Rv ~/usrc/gv/
cd     ~/usrc/
tar -C ~/usrc/ -xvzf ~/tmp/gv-cvs.tar.gz
cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/gv co gv
tar -C ~/usrc/ -cvzf ~/tmp/gv-cvs.tar.gz gv/
cd     ~/usrc/gv/

#*
# Download the patch "gv-pagewindow-scroll-fix.patch", by
# Markus Steinborn <msteinbo@uni-paderborn.de>, from:
# http://savannah.gnu.org/bugs/?func=detailitem&item_id=14319
# http://savannah.gnu.org/bugs/download.php?item_id=14319&item_file_id=3019
wget -O /tmp/gv-pagewindow-scroll-fix.patch \
 'http://savannah.gnu.org/bugs/download.php?item_id=14319&item_file_id=3019'

# (find-fline "/tmp/gv-pagewindow-scroll-fix.patch")

#*
# Unpack and apply the patch.
# This is independent from the "download the patch" step above.
rm -Rv ~/usrc/gv/
tar -C ~/usrc/ -xvzf ~/tmp/gv-cvs.tar.gz
cd     ~/usrc/gv/

{
patch -p0 <<'%%%'
--- src/misc.c.orig
+++ src/misc.c
@@ -323,12 +323,15 @@
 	ny = (int)newtocClip->core.height - ((int)newtoc->core.y + yl + 14);
         if (y>ny) b = True;
       }
-      if (event && b) {
+      if (b) {
 	INFIMESSAGE(jumping to,ny)
 	ClipWidgetSetCoordinates(newtocClip,x,ny);
-	entry = VlistEntryOfPosition(newtoc,(int)event->xbutton.y+(y-ny));
-	if (entry != VlistHighlighted(newtoc) && check_toc)
+	if (event)
+	{
+	   entry = VlistEntryOfPosition(newtoc,(int)event->xbutton.y+(y-ny));
+	   if (entry != VlistHighlighted(newtoc) && check_toc)
 		VlistChangeHighlighted(newtoc,entry,XawVlistSet);
+        }
       }
     }
   }
%%%
} |& tee op

#*
cd ~/usrc/gv/
autoreconf -i   |& tee oai
./bootstrap     |& tee ob
./configure     |& tee oc
make            |& tee om

#*





#####
#
# gv (from the debian sources; solves the bug above)
# 2007sep16
#
#####

# «gv-deb-src»  (to ".gv-deb-src")
# http://ftp.de.debian.org/debian/pool/main/g/gv/
# http://ftp.de.debian.org/debian/pool/main/g/gv/gv_3.6.3dfsg-2.dsc
# http://ftp.de.debian.org/debian/pool/main/g/gv/gv_3.6.3dfsg-2.diff.gz
# http://ftp.de.debian.org/debian/pool/main/g/gv/gv_3.6.3dfsg.orig.tar.gz
#*
rm -Rv ~/usrc/gv/
mkdir  ~/usrc/gv/
cd $S/http/ftp.de.debian.org/debian/pool/main/g/gv/
cp -v gv_3.6.3dfsg* ~/usrc/gv/
cd     ~/usrc/gv/
dpkg-source -sn -x gv_3.6.3dfsg-2.dsc
cd     ~/usrc/gv/gv-3.6.3dfsg/
dpkg-buildpackage -us -uc -b -rfakeroot     |& tee odb

#*
# (find-fline "~/usrc/gv/")
* (eepitch-shell)
cd ~/usrc/gv/
sudo dpkg -i *.deb

#*
# (code-c-d "gv" "~/usrc/gv/gv-3.6.3dfsg/")
# (find-gvfile "")

# http://ftp.de.debian.org/debian/pool/main/g/gv/
# http://ftp.de.debian.org/debian/pool/main/g/gv/gv_3.6.5.91-1.dsc
# http://ftp.de.debian.org/debian/pool/main/g/gv/gv_3.6.5.91-1.diff.gz
# http://ftp.de.debian.org/debian/pool/main/g/gv/gv_3.6.5.91.orig.tar.gz
#*
rm -Rv ~/usrc/gv/
mkdir  ~/usrc/gv/
cd $S/http/ftp.de.debian.org/debian/pool/main/g/gv/
cp -v gv_3.6.5.91* ~/usrc/gv/
cd     ~/usrc/gv/
dpkg-source -sn -x gv_3.6.5.91-1.dsc
cd     ~/usrc/gv/gv-3.6.5.91/
dpkg-buildpackage -us -uc -b -rfakeroot     |& tee odb

#*
# (find-fline "~/usrc/gv/")
* (eepitch-shell)
cd ~/usrc/gv/
sudo dpkg -i *.deb

#*
# (code-c-d "gv" "~/usrc/gv/gv-3.6.5.91/")
# (find-gvfile "")





#####
#
# ghostscript (from the debian sources)
# 2010nov07
#
#####

# «ghostscript-deb-src»  (to ".ghostscript-deb-src")
# http://ftp.debian.org/debian/pool/main/g/ghostscript/
# http://ftp.debian.org/debian/pool/main/g/ghostscript/ghostscript_9.00~dfsg-1.dsc
# http://ftp.debian.org/debian/pool/main/g/ghostscript/ghostscript_9.00~dfsg-1.diff.gz
# http://ftp.debian.org/debian/pool/main/g/ghostscript/ghostscript_9.00~dfsg.debian.tar.gz

#*
rm -Rv ~/bigsrc/ghostscript/
mkdir  ~/bigsrc/ghostscript/
cd $S/http/ftp.debian.org/debian/pool/main/g/ghostscript/
cp -v ghostscript_9.00\~dfsg* ~/bigsrc/ghostscript/
cd     ~/bigsrc/ghostscript/
dpkg-source -sn -x ghostscript_9.00\~dfsg-1.dsc
cd     ~/bigsrc/ghostscript/ghostscript-9.00\~dfsg/

find .* * -type f                | sort > .files
find .* * -type f -name '*.[ch]' | sort > .files.ch
etags $(cat .files.ch)

# dpkg-buildpackage -us -uc -b -rfakeroot     |& tee odb

#*
# (find-fline "~/bigsrc/ghostscript/")
* (eepitch-shell)
cd ~/bigsrc/ghostscript/
sudo dpkg -i *.deb

#*
# (code-c-d "ghostscript" "~/bigsrc/ghostscript/ghostscript-9.00~dfsg/")
# (find-ghostscriptfile ".files")
# (find-ghostscriptfile "")
# (find-ghostscriptfile "psi/")
# (find-ghostscriptfile "psi/zdict.c")
# (find-ghostscriptfile "psi/opdef.h")

# (find-ghostscriptgrep "grep -nrH -e param_write *")
# (find-ghostscriptgrep "grep -nrH -e param_begin *")
# (find-ghostscriptgrep "grep -nH -e 'const op_def' $(cat .files.ch)")
# (find-ghostscriptgrep "grep -nriH -e prompt $(cat .files)")
# (find-ghostscriptfile "base/gsdparam.c" "/* Standard parameters */")


# (find-ghostscriptfile "doc/")
# (find-ghostscriptw3m "doc/Readme.htm#Develop")
# (find-ghostscriptw3m "doc/Source.htm")
# (find-ghostscriptw3m "doc/Language.htm")
# (find-ghostscriptw3m "doc/Language.htm#Dictionary")
# (find-ghostscriptw3m "doc/Lib.htm")







#####
#
# gs source (potato)
# 2000sep19
#
#####

# (find-status "gs")
# (find-vldifile "gs.list")
# (find-fline "/usr/doc/gs/")
#*
pdsc $SDEBIAN/dists/potato/main/source/text/gs_5.10-9.1.dsc
cd /usr/src/gs-5.10/

cd /usr/src/gs-5.10/
# (find-node "(gawk)Ranges")
for i in $(agrep -l BEGIN_OP_DEFS *.c); do
  echo "\n$i:"
  awk '/BEGIN_OP_DEFS/, /END_OP_DEFS/' < $i
done > .OPDEFS

etags *.[ch]
#*
# (code-c-d "gs5" "/usr/src/gs-5.10/")
# (find-gs5file ".OPDEFS")
# (find-gs5file "opdef.h" "Each operator file")

# «gs-dj610c»  (to ".gs-dj610c")
# (find-htetfile "Printing-HOWTO.txt.gz" "DeskJet 610C")
# (find-gs5file "contrib/hp8xxs13/devs.mak" "use -r600 for DJ 600")
# (eeman "gs-hpdj")

# «gs_primitives»  (to ".gs_primitives")
# (find-fline "/o/home/root/ICON/gsops.icn")
# (find-gs5file "opdef.h" "BEGIN_OP_DEFS")
# agrep -l BEGIN_OP_DEFS *.[ch]





#####
#
# running gs interactively using eeg
# 2000jan13
#
#####

# «gs_interactively»  (to ".gs_interactively")
# (find-gs5file "gs_init.ps" "pstack")
# (find-gs5file "gs_init.ps" "/== {")
# (find-gs5file "gs_init.ps" "(gs_fonts.ps) runlibfile")
# (find-gs5file "gs_fonts.ps")

# (find-gs5file ".OPDEFS")
#*
cat > $EEG <<'---'
10 22 (foo) pstack
== ==
pop

/square {dup mul} pstack
bind pstack
def
/square load ==

[10 20] ==
[10 20 ppstack
] pop

/dx 120 def
/dy 120 def
/x0 60 def
/y0 60 def
/myp {dy mul y0 add exch dx mul x0 add exch} def
/defp {myp 2 array astore cvx def} def

  % /p7 {0 3 myp} def
/p7 0 3 defp  /p8 1 3 defp  /p9 2 3 defp
/p4 0 2 defp  /p5 1 2 defp  /p6 2 2 defp
/p1 0 1 defp  /p2 1 1 defp  /p3 2 1 defp
      /p0 1.5 0 defp

/foo { newpath p3 moveto p4 lineto p9 lineto closepath } def
foo gsave 1 1 0 setrgbcolor fill grestore
    gsave 8 setlinewidth stroke grestore
---
eeg gs
#*

# (find-gssharefile "uninfo.ps" "\"printing\" PostScript items")





#####
#
# making gs read files
# 2000may02
#
#####

# «gs_read_file»  (to ".gs_read_file")
# (find-status "gs")
# (find-vldifile "gs.list")
# (find-fline "/usr/doc/gs/")
# (eeman "gs" "run")
#*
cd /usr/share/doc/gs/examples/
gzip -cd tiger.ps.gz > /tmp/tiger.ps

cd /tmp/
cat > $EEG <<'---'
(tiger.ps) run
quit
---
eeg gs

#*




#####
#
# gv-3.5.8 (slink)
# 99oct08
#
#####

# «gv_psheaders»  (to ".gv_psheaders")

pdsc /big/slinks2/dists/slink/main/source/text/gv_3.5.8-9.dsc
cd /usr/src/gv-3.5.8

# On how the headers of a gv-able PS must be:
# (find-gvfile "source/ps.c" "Header section:")

# (find-fline "/usr/doc/gv/comments.doc.gz")




#####
#
# Some old notes on gs5.10
#
#####

cd /usr/src/gs5.10/
etags $(cat of.used.here of.used.there)
glimpseindex -H . $(cat of.used.here; ls *.ps; cat of.used.there)
~/ICON/gsops $(cat of.used.here) |& tee .OPS
#
# (find-gs5file "opdef.h" "Each operator file")
# (find-gs5file ".OPS")
# (find-gs5file "gs_init.ps" "pstack")
# (find-gs5file "gs_init.ps" "/== {")
# (find-gs5tag "zbind")
# (find-gs5file "deskjet.dev")
# (find-gs5file "djet500.dev")
# (find-gs5file "gdevdjet.c")
#
dvips -D 300 -p 1 -l 1 -o blank.ps blank.dvi
gs -sDEVICE=djet500 -sOutputFile=/dev/lp1 -dNOPAUSE -dBATCH blank.ps

# (find-gs5file "gs_init.ps" 80)

# Mais antigos:

# (find-gvtag "main")
# (find-gvfile "source/main.c" "int main(")
# (find-gvfile "source/main.c" 903)
# (find-gvtag "render_page")
# (find-gvtag "GhostviewEnableInterpreter")
# (find-gvtag "StartInterpreter")

# (find-gs5tag "gdev_x_open")






#####
#
# gslab
#
#####

(emacs-lisp-mode)
(find-fline "~/CRIM/gslab.el")

(progn
  (load-library "~/CRIM/gslab")
  (setq gs-window-shrink-amount 12)  ; Gives gs 23-12 lines on 50-line VCs.
  (gs-initialize)
)

# (find-gs5file ".OPS" "setrgbcolor")
# (find-gs5file "gs_init.ps")





#####
#
# Fixing a FrameMaker ps
#
#####

# (find-hamm "psutils")
# (find-fline "/usr/doc/psutils/README.gz" "framemaker")
# (find-fline "/usr/bin/fixfmps")

# (find-gvfile "source/ps.c" "%!")
# (find-fline "~/LATEX/lcp1.ps")

# (find-fline "/usr/info/")

# (find-fline "/snarf/http/www.cica.indiana.edu/cica/faq/tcl/")
# (find-fline "/snarf/http/www.cica.indiana.edu/cica/faq/tcl/book.p1.ps")
# %!PS-Adobe-2.0

# (find-fline "/usr/src/psutils-1.17/psnup.c")
# (find-fline "/usr/src/psutils-1.17/psnup.c" "'s'")
# (find-fline "/usr/src/psutils-1.17/psutil.c" "a4")
# (find-node "(a2ps)Your Media")

# (find-fline "/usr/src/psutils-1.17/pstops.c")


cd /snarf/http/www.cica.indiana.edu/cica/faq/tcl/
# S=0.5; H0=24; H1=297; V0=434; V2=50
S=0.55; H0=-16; H1=257; V0=434; V2=50
cat book.p1.ps |
  pstops -d 4:0@$S($H0,$V0)+1@$S($H1,$V0)+2@$S($H0,$V2)+3@$S($H1,$V2) > p1.ps
cat book.p2.ps |
  pstops -d 4:0@$S($H0,$V0)+1@$S($H1,$V0)+2@$S($H0,$V2)+3@$S($H1,$V2) > p2.ps
cat book.p3.ps |
  pstops -d 4:0@$S($H0,$V0)+1@$S($H1,$V0)+2@$S($H0,$V2)+3@$S($H1,$V2) > p3.ps
cat book.p4.ps |
  pstops -d 4:0@$S($H0,$V0)+1@$S($H1,$V0)+2@$S($H0,$V2)+3@$S($H1,$V2) > p4.ps

cd /snarf/http/www.cica.indiana.edu/cica/faq/tcl/
gv -media a4 -scale -2 p1.ps
gv -media a4 -scale -2 p2.ps
gv -media a4 -scale -2 p3.ps
gv -media a4 -scale -2 p4.ps

cd /snarf/http/www.cica.indiana.edu/cica/faq/tcl/
tar -cvzf ~/tb.tgz p?.ps
zip ~/tb.zip p?.ps

gs -sDEVICE=djet500 -r300 -sOutputFile=o.p%02d -dNOPAUSE -dBATCH /snarf/http/www.cica.indiana.edu/cica/faq/tcl/p3.ps
rm o.zip; zip o.zip o.p0?
laf o.zip


# psnup -1 -d -Pletter -pletter |


# (find-hamm "tk8.0-dev")
man 3tk pack

# (find-tkfile "")

cd /snarf/http/www.cica.indiana.edu/cica/faq/tcl/
psnup -nup 4 -s0.5 -Pletter -pa4 -d -m-8 < book.p3.ps > p3.ps
gv -media a3 p3.ps

# -m100 qdz que overwrite bastante.
# -m-100 qdz que separa bastante as folhinhas.

# psnup -nup 4 -s0.4 -Pletter -pa4 -d -b78 < book.p3.ps > p3.ps


debsource /debian/main/source/text psutils 1.17 -2
debsource /debian/main/source/text a2ps 4.10.2 -4

debsource /debian/main/source/libs tk8.0 8.0p2 -4




#####
#
# pgs
#
#####

dmissingp perl-tk

# (find-fline "/usr/bin/pgs")
# (find-pl5file "Tk/Ghostview.pm")
# (find-pl5file "Tk/Ghostscript.pm")
# (find-pl5file "Tk/Pretty.pm")
# (find-pl5file "Tk/DSC.pm")

# (find-fline "/usr/lib/perl5/Tk/Ghostview.pm")
# (find-fline "/usr/lib/perl5/Tk/Ghostscript.pm")
# (find-fline "/usr/lib/perl5/Tk/Pretty.pm")




#####
#
# pstotext
# 99oct09
#
#####

# «pstotext»  (to ".pstotext")

apti pstotext
# (find-vldifile "pstotext.list")
# (find-fline "/usr/doc/pstotext/")
# (eeman "pstotext")

pstotext /tmp/bdf.PS
pstotext /tmp/bdf.PS | tr ยก -			| tee ~/o
pstotext /tmp/bdf.PS | tr $(echo "\0255") -

# Why does it stop in the middle of the pic manual?
# (find-es "tex" "pic_manual")

pstotext $S/http/cm.bell-labs.com/cm/cs/cstr/116.ps > ~/o
(pstotext -debug $S/http/cm.bell-labs.com/cm/cs/cstr/116.ps > ~/o) |& tee ~/o2
# (find-fline "~/o")
# (find-fline "~/o2")
# (find-fline "$S/http/cm.bell-labs.com/cm/cs/cstr/116.ps" "guess is wrong")


pdsc /big/slinks2/dists/slink/main/source/text/pstotext_1.7-3.dsc
debian/rules binary	|& tee odrb

# (code-c-d "ptt" "/usr/src/pstotext-1.7/")
# (find-pttfile "odrb")

# (find-pttfile "main.c")
# (find-pttfile "bundle.c")
# (find-pttfile "ptotdll.c")
# (find-pttfile "ocr.ps")




#####
#
# .eps->.jpg, with cropping
# 2000may30
#
#####

# «eps_crop_to_jpg»  (to ".eps_crop_to_jpg")
# (find-es "music" "ps_to_png")
#*
cat ~/LATEX/eps/histmat1.eps \
  | gs -q -sDEVICE=ppmraw -sOutputFile="-" -r150 \
      -dNOPAUSE - -c quit \
  | pnmcrop \
  > /tmp/histmat1.ppm
convert /tmp/histmat1.ppm /tmp/histmat1.jpg

cat ~/LATEX/eps/histmat2.eps \
  | gs -q -sDEVICE=ppmraw -sOutputFile="-" -r150 \
      -dNOPAUSE - -c quit \
  | pnmcrop \
  > /tmp/histmat2.ppm
convert /tmp/histmat2.ppm /tmp/histmat2.jpg

ls -lAF /tmp
#*



#####
#
# my own crude a2ps (aborted...)
# 2000jun29
#
#####

# (find-node "(a2ps)Top")

# (find-status "a2ps")
# (find-vldifile "a2ps.list")
# (find-fline "/usr/doc/a2ps/")

# (find-fline "/usr/lib/xemacs/site-lisp/" "a2ps")
# (find-fline "/usr/share/ogonkify/")
# (find-fline "/usr/share/a2ps/ps/")

ls | a2ps -o /tmp/o.ps

# (find-fline "/tmp/o.ps")




#####
#
# gsfonts
# 2000oct30
#
#####

# «gsfonts»  (to ".gsfonts")
# (find-status "gsfonts")
# (find-vldifile "gsfonts.list")
# (find-fline "/usr/doc/gsfonts/")

# (find-fline "/usr/lib/ghostscript/fonts/")
cd /usr/lib/ghostscript/fonts/




#####
#
# making gv redisplay a file
# 2001mar27
#
#####

# (find-man "1 gv" "-watch, -nowatch")
# (find-angg ".zshrc" "rexdvi")
# (find-angg ".zshrc" "regv")




#####
#
# making gs display encrypted PDFs
# 2001dec10
#
#####

# «encrypted_pdfs»  (to ".encrypted_pdfs")
# (find-shttpw3 "members.ozemail.com.au/~geoffk/pdfencrypt/")
# (find-shttpfile "members.ozemail.com.au/~geoffk/pdfencrypt/pdf_sec.ps")
# (find-fline "/usr/lib/ghostscript/5.10/pdf_sec.ps")
# (find-fline "/usr/lib/ghostscript/5.10/pdf_sec.ps.orig")
#*
cd /usr/lib/ghostscript/5.10/
if [ ! -e pdf_sec.ps.orig ]; then cp -v pdf_sec.ps pdf_sec.ps.orig; fi
cp -v $S/http/members.ozemail.com.au/~geoffk/pdfencrypt/pdf_sec.ps .

#*
cd /usr/lib/ghostscript/5.10/
mv -v pdf_sec.ps.orig pdf_sec.ps

#*
cd $S/http/www.ville.montreal.qc.ca/mtlcarte/anglais/pdf/

#*
# Woody:
# (find-status "gs")
# (find-vldifile "gs.list")
# (find-fline "/usr/doc/gs/")
# (find-fline "/usr/share/gs/6.53/")
# (find-fline "/usr/share/gs/6.53/pdf_sec.ps" "geoffk/pdfencrypt/")




#*
pdsc $S/http/ftp.debian.org/debian/pool/main/g/gs/gs_5.50-8.dsc
debian/rules binary	|& tee odrb
#*
# (code-c-d "gs" "/usr/src/gs-5.50/")
# (find-gsfile "debian/jpeg")

psnedeb <<'---'
  1977288 pool/main/g/gs/gs_6.51-5.diff.gz
      685 pool/main/g/gs/gs_6.51-5.dsc
  4375426 pool/main/g/gs/gs_6.51.orig.tar.gz
---




#####
#
# specifying a starting page for gv
# 2002nov12
#
#####

# «gv-starting-page»  (to ".gv-starting-page")
# (find-man "1 gv" "-page=LABEL")
# (find-angg ".emacs" "find-xxxpage")

# A problem: dvips generates "ps"s whose pages can be labeled, say,
# 1 2 3 4 1 2 3 4 5 6 7 8 9... - and I still don't know how to jump to
# the "second page 3" in these cases.




#####
#
# flipping the even pages for two-sided printing
# 2003feb13
#
#####

# (find-man "pstops")
#*
dvips -o /tmp/test.ps ~/LATEX/2002cms.dvi
#*
cd /tmp/
cat test.ps | pstops '2:0+1U(21.5cm,31.5cm)' > test2.ps  && gv test2.ps
#*
dvired -o /tmp/test.ps $S/ftp/ftp.math.mcgill.ca/pub/barr/tt.dvi
#*
cd /tmp/
cat test.ps | pstops '2:0+1U(23.5cm,29.4cm)' > test2.ps  && gv test2.ps
#*
dvired -o /tmp/test.ps ~/LATEX/2002cms.dvi
#*
cd /tmp/
cat test.ps | pstops '2:0+1U(22.1cm,29.4cm)' > test2.ps  && gv -seascape test2.ps
#*

# (* 40 (/ 1.0 72.0) 2.54)



#####
#
# metapost
# 2004apr13
#
#####

rm -Rv /tmp/mpdoc/
mkdir  /tmp/mpdoc/

# (find-status "tetex-bin")
# (find-vldifile "tetex-bin.list")
# (find-fline "/usr/doc/tetex-bin/")

# (find-fline "/usr/share/doc/texmf/metapost/base/")
# (code-ps "mpman"   "/usr/share/doc/texmf/metapost/base/mpman.ps.gz")
# (code-ps "mpintro" "/usr/share/doc/texmf/metapost/base/mpintro.ps.gz")
# (find-mpmanpage   1)
# (find-mpintropage 1)

#*
cd /tmp/
cat > tmp.mp <<'%%%'
beginfig(0);
input ee.mp;
endfig;
end
%%%

cat > ee.mp <<'%%%'
pickup pencircle scaled 4pt;
draw (20,20)--(0,0)--(0,40)--(30,0)--(0,0);
%%%

mpost tmp.mp
awk '{if (NR==1) {print "%!PS-Adobe-2.0 EPSF-1.2"} else print}' \
  < tmp.0 > tmp.0.eps

regv tmp.0.eps -scale 10 &

#*
;; «eemp»  (to ".eemp")
;; (find-eevfile "tmp.mp")

(progn

(defvar ee-file-mp        "~/eev-current/ee.mp")
(defvar eemp-eevscript "cd ~/eev-current/
  mpost tmp.mp
  awk '{if (NR==1) {print \"%!PS-Adobe-2.0 EPSF-1.2\"} else print}' \\
    < tmp.0 > tmp.0.eps
  regv tmp.0.eps -scale 10")

(defun eemp (s &optional e)
  (interactive "r")
  (ee-write s e "" "" ee-file-mp)
  (eev eemp-eevscript nil)
  (format "eemp: wrote %s and %s" ee-file-mp ee-file))

(ee-define-bounded eemp   eemp-bounded   ee-delimiter-percent)

)

%*
% (ee-once (eeb-mp))
pickup pencircle scaled 4pt;
draw (20,20)--(0,0)--(0,30)--(30,0)--(0,0);

%*
% (eemp-bounded 'once)
numeric u; u=1cm;
draw (2u,2u)--(0,0)--(0,3u)--(3u,0)--(0,0);
pickup pencircle scaled 4pt;
for i=0 upto 2:
  for j=0 upto 2:
    draw (i*u,j*u);
  endfor
endfor

%*
endfig;




#####
#
# gs source
# 2004apr22
#
#####

/hda7/pandahome/edrx/snarf/http/ftp.debian.org/debian/pool/main/g/gs/
/hda7/pandahome/edrx/snarf/http/ftp.debian.org/debian/pool/main/g/gs/

# (code-c-d "gs" "/usr/src/gs-6.53/")
# (find-gsfile "")
# (find-gsfile "src/gsfunc4.c")
# (find-gsfile "src/gstype1.h" "\"closepath\"")
# (find-gsfile "src/zpath.c")

# (find-gsfile "src/opdef.h" "limited to 16 entries")
# (find-gsfile "src/zcontrol.c" "const op_def zcontrol1_op_defs[] =")

cd /usr/src/gs-6.53/src/
grep 'const op_def' *.[ch] |& l -S

#*
cd /usr/src/gs-6.53/src/
egrep -l '^const op_def ' *.c | tee .files.opdef
echo -n > OPDEFS
for i in $(<.files.opdef); do
  echo "/* (find-fline \"$i\" \"\\\\nconst op_def \")"
  echo " */"
  awk '
    /^const op_def / {interesting=1}
    interesting==1   {print}
    /^}/             {interesting=0}
  ' $i
  echo
  echo
done > OPDEFS
# (find-gsfile "src/OPDEFS")

#*
# (find-gsfile "lib/")
# (find-gsfile "lib/gs_init.ps")
# (find-gsfile "lib/gs_init.ps" "/pstack")
# (find-gsfile "lib/gs_init.ps" "/ppstack")


#*
cat > $EEG <<'---'
1 2
==
==
1 2 3 pstack
== == ==
quit
---
eeg gs -sDEVICE=nullpage

#*
cat > $EEG <<'---'
/square {dup mul} def
5 square
==
quit
---
eeg gs -sDEVICE=nullpage

#*
% (eeg-
/Times-Roman findfont ==


(defun eegs-simple ()
  (eev "eeg gs -sDEVICE=nullpage")
  (eeg 


eegs

eev

# (find-efunctionpp 'eeg-bounded)
# (find-efunctionpp (key-binding [f3]))
# (find-efunction 'describe-function)
# (find-efunction 'describe-key)
# (find-efunction 'find-efunctionpp)





(find-ekeypp [f3])
(find-ekeypp "\r")
(find-ekeypp "\n")
(find-ekeypp "\M-P")
(find-efunctionpp ee-bounded-function)







(defvar ee-s0 nil)
(defvar ee-s1 nil)
(defvar ee-e  nil)

(defmacro with-ee-l1-percent (&rest body)
  `(let* ((ee-s0 (ee-search-backward ee-delimiter-percent))
	  (ee-s1 (save-excursion (goto-char ee-s0)
				 (next-line 1) (beginning-of-line) (point)))
	  (ee-e (1+ (ee-search-forward ee-delimiter-percent))))
     . ,body))

(defun eegs (gsargs pre post s &optional e)
  (eev (concat "eeg gs " (or gsargs "-sDEVICE=nullpage")))
  (eeg (concat (or pre "")
	       (ee-se-to-string s e)
	       (or post "")))
  (format "eegs: wrote %s and %s" ee-file-generic ee-file))
  
(defun eegs-l1 (gsargs pre post)
  (with-ee-l1-percent (eegs gsargs pre post ee-s1 ee-e)))

(defun eegs-simple ()
  (eegs-l1 nil nil "quit"))



(defun eeM-e (s &optional e)
  (interactive "r")
  (save-excursion (goto-char s) (ee-eval-sexp-eol ee-arg)))

(ee-define-bounded eeM-e eeM-e-percent-bounded ee-delimiter-percent)

(defalias 'eemep-bounded 'eeM-e-percent-bounded)


%*
% (eegs-simple)
1 2
==
==
1 2 3 pstack
== == ==

%*
% (eegs-simple)
/square {dup mul} def
5 square
==
{dup mul} 0 get ==        %-> dup
{dup mul} 1 get ==        %-> mul
(a string) type ==        %-> stringtype
[2 3]      type ==        %-> arraytype
{dup mul}  type ==        %-> arraytype
/square    type ==        %-> nametype
1          type ==        %-> integertype
1.2        type ==        %-> realtype
444 type   type ==        %-> nametype

%*
% (eegs-simple)
[10 20 30] 0 get ==       %-> 10
[10 20 30] 2 get ==       %-> 30
/a [10 20 30] def
a 2 33 put
a ==                      %-> [10 20 33]

%*
% (eegs-simple)
/square {dup mul} def
/a 3 def  /b 4 def
a square b square add sqrt
dup ==
dup round ==
dup floor ==
dup truncate ==
dup truncate cvi ==

%*
% (eegs-simple)
% (find-psfirstgw3m "escapes.html")
(This is a \
string \
that has no \
newlines)                 %-> (This is a string that has no newlines)
==

%*
% (eegs-simple)





/Times-Roman findfont ==


# (code-c-d "psfirstg" "/hda6/snarf/http/www.cs.indiana.edu/docproject/programming/postscript/")
# (code-c-d "psimation" "/hda6/snarf/http/ips.imation.com/techsupport/resources/web/psweb/")
# (find-psfirstgfile "")
# (find-psfirstgw3m "escapes.html")

# (find-psimationfile "")
# (find-psimationw3m "PSL2gh.html#get")
# (find-psimationw3m "PSL2e.html#exec")

# (find-psimationw3m "REF2.html")

  [L http://www.cs.indiana.edu/docproject/programming/postscript/postscript.html
    A First Guide to PostScript]
  [L http://www.tinaja.com/post01.html
    Guru's Lair: Don Lancaster's PostScript Library]
  [L http://www.cs.washington.edu/homes/dylan/pshacks.html
    Dylan's PostScript Page]
  [L http://ips.imation.com/techsupport/resources/PS/PSindex.html
    Imation - Index To Postscript Pages]
  [L http://ips.imation.com/techsupport/resources/web/psweb/REF.html
    ref]
  [L http://www.iftech.com/oltc/ps/ps0.stm
    pstut]



/TeXDict 250 dict def TeXDict begin /N{def}def /B{bind def}N /S{exch}N
/X{S N}B /TR{translate}N /isls false N /vsize 11 72 mul N /hsize 8.5 72
mul N /landplus90{false}def /@rigin{isls{[0 landplus90{1 -1}{-1 1}
ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale
isls{landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div
hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul
TR[matrix currentmatrix{dup dup round sub abs 0.00001 lt{round}if}
forall round exch round exch]setmatrix}N /@landscape{/isls true N}B
/@manualfeed{statusdict /manualfeed true put}B /@copies{/#copies X}B
/FMat[1 0 0 -1 0 0]N /FBB[0 0 0 0]N /nn 0 N /IE 0 N /ctr 0 N /df-tail{
/nn 8 dict N nn begin /FontType 3 N /FontMatrix fntrx N /FontBBox FBB N
string /base X array /BitMaps X /BuildChar{CharBuilder}N /Encoding IE N
end dup{/foo setfont}2 array copy cvx N load 0 nn put /ctr 0 N[}B /df{
/sf 1 N /fntrx FMat N df-tail}B /dfs{div /sf X /fntrx[sf 0 0 sf neg 0 0]
N df-tail}B /E{pop nn dup definefont setfont}B /ch-width{ch-data dup
length 5 sub get}B /ch-height{ch-data dup length 4 sub get}B /ch-xoff{
128 ch-data dup length 3 sub get sub}B /ch-yoff{ch-data dup length 2 sub
get 127 sub}B /ch-dx{ch-data dup length 1 sub get}B /ch-image{ch-data
dup type /stringtype ne{ctr get /ctr ctr 1 add N}if}B /id 0 N /rw 0 N
/rc 0 N /gp 0 N /cp 0 N /G 0 N /sf 0 N /CharBuilder{save 3 1 roll S dup
/base get 2 index get S /BitMaps get S get /ch-data X pop /ctr 0 N ch-dx




# (find-gsfile "src/OPDEFS")
# (find-gsfile "src/OPDEFS" "truncate")

#*
# (find-gsfile "lib/")
# (find-gsfile "lib/gs_init.ps")
# (find-gsfile "lib/gs_init.ps" "/pstack")
# (find-gsfile "lib/gs_init.ps" "/ppstack")


(eegs-hyped " -sDEVICE=nullpage" "quit")



#####
#
# ps-mode and comint
# 2004may02
#
#####

# (find-efile "")
# (find-efile "progmodes/ps-mode.el")

(require 'ps-mode)
(ps-run-start)

(find-fline 


 0 0.5 dtransform truncate idtransform setlinewidth pop [] 0 setdash
 1 setlinecap 1 setlinejoin 10 setmiterlimit
newpath 56.6929 56.6929 moveto
0 0 lineto
0 85.03935 lineto
85.03935 0 lineto
0 0 lineto stroke
 0 3.98505 dtransform truncate idtransform setlinewidth pop
newpath 0 0 moveto 0 0 rlineto stroke
newpath 0 28.34645 moveto 0 0 rlineto stroke
newpath 0 56.6929 moveto 0 0 rlineto stroke
newpath 28.34645 0 moveto 0 0 rlineto stroke
newpath 28.34645 28.34645 moveto 0 0 rlineto stroke
newpath 28.34645 56.6929 moveto 0 0 rlineto stroke
newpath 56.6929 0 moveto 0 0 rlineto stroke
newpath 56.6929 28.34645 moveto 0 0 rlineto stroke
newpath 56.6929 56.6929 moveto 0 0 rlineto stroke
showpage






# (find-gsfile "src/opdef.h" "Each operator file")
# (find-gs5file ".OPS")
# (find-gs5file "gs_init.ps" "pstack")
# (find-gs5file "gs_init.ps" "/== {")




# (find-gsfile "debian/control" "Build-Depends:")
apti libpaperg-dev libpng2-dev zlib1g-dev xlibs-dev debhelper html2text
apti libglib1.2-dev libgimpprint-dev

pdsc $SDEBIAN/pool/main/g/gs/gs_6.53-3.dsc
cd /usr/src/gs-6.53/
debian/rules build	|& tee odrb

(find-gsfile "")
(find-gsfile "odrb")




# (find-status "tetex-base")
# (find-vldifile "tetex-base.list")
# (find-fline "/usr/doc/tetex-base/")



# (find-man "1 gv" "-style gv_spartan.dat")
# (find-fline "/usr/X11R6/lib/X11/gv/")




#####
#
# gv --version
# 2007jun07
#
#####

# «gv-version»  (to ".gv-version")
# http://ftp.debian.org/debian/pool/main/g/gv/
# http://ftp.debian.org/debian/pool/main/g/gv/gv_3.6.2-4.dsc
apti debhelper quilt xaw3dg-dev texinfo

# http://ftp.gnu.org/gnu/gv/gv-3.5.8.tar.gz
# http://ftp.gnu.org/gnu/gv/gv-3.6.0.tar.gz
# http://ftp.gnu.org/gnu/gv/gv-3.6.1.tar.gz
# http://ftp.gnu.org/gnu/gv/gv-3.6.2.tar.gz
#*
rm -Rv ~/usrc/gv-3.5.8/
tar -C ~/usrc/ -xvzf $S/http/ftp.gnu.org/gnu/gv/gv-3.5.8.tar.gz
cd     ~/usrc/gv-3.5.8/
xmkmf          |& tee oxmkmf
make Makefiles |& tee omM
make           |& tee om

# (code-c-d "gv358" "~/usrc/gv-3.5.8/")
# (find-gv358file "")
# (find-gv358file "om")
# (find-gv358file "source/Aaa.c" 49)
# (find-gv358file "source/Aaa_intern.h" 44 "INC_X11(Xlib.h)")

#*
rm -Rv ~/usrc/gv-3.6.0/
mkdir  ~/usrc/gv-3.6.0/
tar -C ~/usrc/gv-3.6.0/ -xvzf $S/http/ftp.gnu.org/gnu/gv/gv-3.6.0.tar.gz
cd     ~/usrc/gv-3.6.0/gv/
./configure |& tee oc
make        |& tee om
# (code-c-d "gv360" "~/usrc/gv-3.6.0/gv/")
# (find-gv360file "")
# (find-gv360sh "src/gv --version")

#*
rm -Rv ~/usrc/gv-3.6.1/
tar -C ~/usrc/ -xvzf $S/http/ftp.gnu.org/gnu/gv/gv-3.6.1.tar.gz
cd     ~/usrc/gv-3.6.1/
./configure |& tee oc
make        |& tee om
# (code-c-d "gv361" "~/usrc/gv-3.6.1/")
# (find-gv361file "")
# (find-gv361sh "src/gv --version")

#*
rm -Rv ~/usrc/gv-3.6.2/
tar -C ~/usrc/ -xvzf $S/http/ftp.gnu.org/gnu/gv/gv-3.6.2.tar.gz
cd     ~/usrc/gv-3.6.2/
./configure |& tee oc
make        |& tee om
# (code-c-d "gv362" "~/usrc/gv-3.6.2/")
# (find-gv362file "")
# (find-gv362sh "src/gv --version")

#*



;; Note: according to jemarch (gv's maintainer),
;; gv 3.5.8 (and earlier versions) accept short arguments only,
;; gv 3.6.0 and gv 3.6.1 accept long arguments only,
;; gv 3.6.2 (and later versions) accept both long and short arguments.
;; To select a starting page in a "short arguments" version we have to
;; use "-page 42" instead of "--page=42".

# (find-eevfile "eev.el" "jemarch")





#####
#
# xpdftools
# 2006jul17
#
#####

# «xpdftools»  (to ".xpdftools")
# (find-angg ".emacs" "find-pdfpage-pdftotext")
# pdftops (from xpdftools) is better than pdf2ps (from ghostscript):
# http://www.codecomments.com/archive276-2005-8-561854.html
# (find-status   "xpdf-utils")
# (find-vldifile "xpdf-utils.list")
# (find-udfile   "xpdf-utils/")

cd ~/tmp/
pdftotext -layout cvs.pdf
# (find-fline "~/tmp/cvs.txt")
# (find-man "pdftotext")





#####
#
# xpdf (from the debian sources)
# 2008aug17 / 2019oct18
#
#####

# «xpdf» (to ".xpdf")
# «xpdf-deb-src»  (to ".xpdf-deb-src")
# (find-angg ".Xdefaults")
# The version in etch cannot switch between normal
# and fullscreen mode, but this version can...
# http://ftp.debian.org/debian/pool/main/x/xpdf/
# http://ftp.debian.org/debian/pool/main/x/xpdf/xpdf_3.02-1.3.dsc
# http://ftp.debian.org/debian/pool/main/x/xpdf/xpdf_3.02-1.3.diff.gz
# http://ftp.debian.org/debian/pool/main/x/xpdf/xpdf_3.02.orig.tar.gz
# (find-man "1 xpdf")
# (find-man "1 xpdf" "-mattecolor")
# (find-man "1 xpdf" "-fullscreen")
# (find-man "1 xpdf" "Toggle full-screen mode.")

# (find-man "1 xpdf" "toggleFullScreenMode")
# (find-man "1 xpdf" "alt-f")

# (code-c-d "xpdf" "~/usrc/xpdf/xpdf-3.02/")
# (find-xpdfgrep "grep -nH -e fullscreen $(find *)")
# (find-xpdfgrep "grep -nH -e fullScreen $(find *)")
# (find-xpdffile "xpdf/xpdf.cc" "-fullscreen")
# (find-xpdffile "")




#####
#
# xpdf: disabling the touchpad scroll (that works as PgUp and PgDn)
# 2019oct23
#
#####

# «xpdf-touchpad-scroll» (to ".xpdf-touchpad-scroll")
# (find-es "emacsconf2019" "short")
# (find-man "1 xpdf")
# (find-man "1 xpdf" "bind mousePress4" "scrollUpPrevPage(16)")
# (find-apt-get-source-links "xpdf")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/d/
mkdir  /tmp/d/
cd     /tmp/d/
sudo apt-get build-dep -y   xpdf
     apt-get source         xpdf   2>&1 | tee osource
     apt-get source --build xpdf   2>&1 | tee osourceb

ls -lAF      xpdf_*.deb
sudo dpkg -i xpdf_*.deb

# (find-fline "/tmp/d/")
# (find-fline "/tmp/d/xpdf-3.04/")
# (code-c-d "xpdf" "/tmp/d/xpdf-3.04/")
# (find-xpdffile "")
# (find-xpdfsh "find * | sort")
# (find-xpdfgrep "grep --color -nRH -e mousePress4 *")
# (find-xpdfgrep "grep --color -nRH -e scrollUpPrevPage *")
# (find-xpdffile "xpdf/GlobalParams.cc" "xpdfKeyCodeMousePress4")



#####
#
# xpdf is being deprecated on Ubuntu
# 2020oct15
#
#####

# «xpdf-ubuntu»  (to ".xpdf-ubuntu")
# https://askubuntu.com/questions/1245518/how-to-install-xpdf-on-ubuntu-20-04





#####
#
# djvulibre (from the debian sources)
# 2008nov20
#
#####

# «djvulibre-deb-src»  (to ".djvulibre-deb-src")
# http://djvu.sourceforge.net/
# http://ftp.debian.org/debian/pool/main/d/djvulibre/
# http://ftp.debian.org/debian/pool/main/d/djvulibre/djvulibre_3.5.21-1.dsc
# http://ftp.debian.org/debian/pool/main/d/djvulibre/djvulibre_3.5.21-1.diff.gz
# http://ftp.debian.org/debian/pool/main/d/djvulibre/djvulibre_3.5.21.orig.tar.gz
#*
rm -Rv ~/usrc/djvulibre/
mkdir  ~/usrc/djvulibre/
cd $S/http/ftp.debian.org/debian/pool/main/d/djvulibre/
cp -v djvulibre_3.5.21* ~/usrc/djvulibre/
cd     ~/usrc/djvulibre/
dpkg-source -sn -x djvulibre_3.5.21-1.dsc
cd     ~/usrc/djvulibre/djvulibre-3.5.21/
dpkg-buildpackage -us -uc -b -rfakeroot     |& tee odb

#*
# (find-fline "~/usrc/djvulibre/")
* (eepitch-shell)
cd ~/usrc/djvulibre/
sudo dpkg -i *.deb

#*
# (code-c-d "djvulibre" "~/usrc/djvulibre/djvulibre-3.5.21/")
# (find-djvulibrefile "")
# (find-djvulibrefile "gui/djview/")




#####
#
# Changing the "lpr" in gv to "~/bin/lpr"
# 2009jan11
#
#####

# «gv-lpr»  (to ".gv-lpr")
# (find-angg "bin/lpdj-tmp")

Print Marked Pages
Print command:




#####
#
# eepitch-gs
# 2009jul26
#
#####

# «eepitch-gs»  (to ".eepitch-gs")
# (find-man "1 gs")

(defun eepitch-gs () (interactive) (eepitch-comint "gs" "gs -r60"))
(defun eepitch-gs () (interactive) (eepitch-comint "gs" "gs -r45"))

* (eepitch-gs)
* (eepitch-kill)
* (eepitch-gs)

1 2
==
==
1 2 3 pstack
== == ==

/square {dup mul} def
5 square
==
{dup mul} 0 get ==        %-> dup
{dup mul} 1 get ==        %-> mul
(a string) type ==        %-> stringtype
[2 3]      type ==        %-> arraytype
{dup mul}  type ==        %-> arraytype
/square    type ==        %-> nametype
1          type ==        %-> integertype
1.2        type ==        %-> realtype
444 type   type ==        %-> nametype

[10 20 30] 0 get ==       %-> 10
[10 20 30] 2 get ==       %-> 30
/a [10 20 30] def
a 2 33 put
a ==                      %-> [10 20 33]

/square {dup mul} def
/a 3 def  /b 4 def
a square b square add sqrt
dup ==
dup round ==
dup floor ==
dup truncate ==
dup truncate cvi ==

% (find-psfirstgw3m "escapes.html")
% This is problematic. By default gs has ""
% as its PS2, so comint gets stuck here...
% We can be careful and use S-F8.
(This is a \
string \
that has no \
newlines)                 %-> (This is a string that has no newlines)
==



* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
gs -r60
quit

/Courier findfont
20 scalefont
setfont
72 500 moveto
(Hello world!) show
showpage


/Times-Roman findfont ==



#####
#
# ps-intro
# 2010oct07
#
#####

# «ps-intro»  (to ".ps-intro")
# Like this,  (find-es "lua-intro" "quick-presentation")
# but I am learning PostScript as I write it...
# (find-angg ".emacs" "gs")

* (eepitch-gs)
* (eepitch-kill)
* (eepitch-gs)
/Times-Roman findfont
100 scalefont setfont
72 200 moveto
(typography) show
%
/PNW {100 500} def  /PN {300 500} def
                                     /PSE {500 100} def
/mypath {newpath PNW moveto PN lineto PSE lineto closepath} def
 mypath gsave 1 1 0 setrgbcolor fill grestore
        gsave 8 setlinewidth stroke grestore
erasepage
 mypath gsave 1 0 0 setrgbcolor fill grestore


* (eepitch-gs)
* (eepitch-kill)
* (eepitch-gs)
(foo)      type ==    % stringtype
[10 20]    type ==    % arraytype
{dup mul}  type ==    % arraytype
/dup       type ==    % nametype
10         type ==    % integertype
10.0       type ==    % realtype
systemdict type ==    % dicttype
10 type    type ==    % nametype

/Times-Roman findfont type == % dicttype

% Arrays
[10 20 30]         == % [10 20 30]
[10 20 30] 0 get   == % 10
{10 20 30} 2 get   == % 30
[10 20 30] length  == % 3
% [10 20 30] 4 get == % Error: /rangecheck in --execute--

% Arrays: the executable bit, def, and execute
[10 20 30] cvx     == % {10 20 30}
/coords [10 20] def  coords ==     % [10 20]
/coords {10 20} def  coords == ==  % 10 20
        {10 20}     execute == ==  % 10 20

% Arrays: bind
{dup mul} 0 get           == % dup
{dup mul} 0 get type      == % nametype
{dup mul} bind            == % {--dup-- --mul--}
{dup mul} bind 0 get      == %  --dup--
{dup mul} bind 0 get type == % operatortype

% How do I convert /dup to dup?
% How do I obtain systemdict[dup]?

/5mul {5 mul} def
12     5mul           ==     % 60
12    {5 mul} execute ==
12    /5mul   execute == ==  % oops! /5mul 60


* (eepitch-gs)
* (eepitch-kill)
* (eepitch-gs)
% (find-psbluepage (+  4  48) "100 200 translate")
/mytri { 0 0 moveto 50 0 lineto 0 100 lineto closepath fill } def
mytri
100 200 translate
mytri
90 rotate
mytri

* (eepitch-gs)
* (eepitch-kill)
* (eepitch-gs)
gsave 72 2.54 div dup scale
% newpath 2 2 moveto 4 2 lineto 2 6 lineto closepath stroke
  newpath 2 2 moveto 4 2 lineto 2 6 lineto closepath fill
grestore
newpath 50 50 moveto 200 50 lineto closepath stroke

matrix ==

% (find-angg "PS/psbluebookops.txt")


% (find-psbluepage (+  4  61) "7. Loops and Conditionals")
% (find-psbluepage (+  4  77) "8. Arrays")
% (find-psbluepage (+  4  87) "9. More Fonts")
% (find-psbluepage (+  4 101) "10. Clipping and Line Details")
% (find-psbluepage (+  4 111) "11. Images")
% (find-psbluepage (+  3 119) "12. Postscript Printers")
% (find-psbluepage (+ -4 233) "Operator Summary")
% (find-psbluepage (+ -4 241) "Index")
% (find-psbluetext)




       countexecstack array execstack dup length 2 sub 0 exch getinterval
       $error /estack 3 -1 roll
       countdictstack array dictstack $error /dstack 3 -1 roll






#####
#
# Books on PostScript
# 2009jul26
#
#####

# «books»  (to ".books")
# (find-angg ".emacs.papers" "postscript")
# http://en.wikipedia.org/wiki/PostScript
# http://partners.adobe.com/public/developer/en/ps/PLRM.pdf
# http://partners.adobe.com/public/developer/en/ps/sdk/sample/BlueBook.zip
# http://partners.adobe.com/public/developer/en/ps/sdk/sample/GreenBook.zip
# http://www.rightbrain.com/download/books/ThinkingInPostScript.pdf
# http://www.adobe.com/devnet/postscript/
# http://www.adobe.com/devnet/postscript/pdfs/PLRM.pdf
# http://www.adobe.com/devnet/postscript/pdfs/PSerrata.txt
# http://www.adobe.com/devnet/postscript/pdfs/PS3010and3011.Supplement.pdf
# http://www.adobe.com/devnet/postscript/pdfs/5001.DSC_Spec.pdf
#*
rm -Rv ~/usrc/BlueBook/
rm -Rv ~/usrc/GreenBook/
unzip -d ~/usrc/ $S/http/partners.adobe.com/public/developer/en/ps/sdk/sample/BlueBook.zip
unzip -d ~/usrc/ $S/http/partners.adobe.com/public/developer/en/ps/sdk/sample/GreenBook.zip

for i in ~/usrc/BlueBook/CODE/*.PS; do
  tr -d \\r < $i > $i.txt; mv -v $i.txt $i
done

#*
# (find-fline "~/usrc/BlueBook/CODE/")
# (find-fline "~/usrc/GreenBook/CODE/")

% (find-psbluepage         3  "Contents")
% (find-psbluepage (+  8   1) "1. Introduction")
% (find-psbluepage (+  7   7) "2. Stack and Arithmetic")
% (find-psbluepage (+  6  17) "3. Beginning Graphics")
% (find-psbluepage (+  4  35) "5. Printing Text")
% (find-psbluepage (+  4  47) "6. More Graphics")
% (find-psbluepage (+  4  61) "7. Loops and Conditionals")
% (find-psbluepage (+  4  77) "8. Arrays")
% (find-psbluepage (+  4  87) "9. More Fonts")
% (find-psbluepage (+  4 101) "10. Clipping and Line Details")
% (find-psbluepage (+  4 111) "11. Images")
% (find-psbluepage (+  3 119) "12. Postscript Printers")
% (find-psbluepage (+ -4 233) "Operator Summary")
% (find-psbluepage (+ -4 241) "Index")
% (find-psbluetext)
% (find-psbluefile "")

% (find-psbluefile "PROG_03.PS" "/ellipse")
% (find-psbluepage (+  0 139) "Elliptical arcs")

% (find-psgreenpage        2  "Contents")
% (find-psgreenpage (+ 11  1) "1. The Postscript Language: Overview")
% (find-psgreenpage (+ 10 11) "2. The Execution Model")
% (find-psgreenpage (+ 10 21)   "The bind operator")
% (find-psgreenpage (+ 9  37) "3. The Imaging Model")
% (find-psgreenpage (+ 9  41)   "Here are the element of the graphics state:")
% (find-psgreenpage (+ 9  57) "4. Emulators and Translators")
% (find-psgreenpage (+ 9  69)   "72 72 scale")
% (find-psgreenpage (+ 8  77) "5. Designing the Page and the Program")
% (find-psgreenpage (+ 8  87) "6. Program Structure")
% (find-psgreenpage (+ 7  99) "7. The Mechanics of Setting Text")
% (find-psgreenpage (+ 6 123) "8. Scanned Images and Halftones")
% (find-psgreenpage (+ 6 137) "9. Complex Graphic Problem-Solving")
% (find-psgreenpage (+ 6 157) "10. File Interchange Standards")
% (find-psgreenpage (+ 6 167) "11. Merging Files from Different Sources")
% (find-psgreenpage (+ 6 173) "12. Writing a Print Spooler")
% (find-psgreenpage (+ 5 185) "13. Memory and File Resource Management")
% (find-psgreenpage (+ 4 197) "14. Error Handling")
% (find-psgreenpage (+ 4 207) "15. Debugging Techniques")
% (find-psgreenpage (+ 4 217) "A. Error Handler")
% (find-psgreenpage (+ 3 221) "Index")
% (find-psgreentext)
% (find-psgreenfile "")




#####
#
# gs-examples
# 2010aug24
#
#####

# «gs-examples»  (to ".gs-examples")
# (find-status   "ghostscript")
# (find-vldifile "ghostscript.list")
# (find-udfile   "ghostscript/")
# (find-status   "ghostscript-x")
# (find-vldifile "ghostscript-x.list")
# (find-udfile   "ghostscript-x/")
# (find-udfile   "gs-common/")
# (find-udfile   "gs-common/NEWS.Debian.gz" "renamed to ghostscript")
# (find-status   "ghostscript-doc")
# (find-vldifile "ghostscript-doc.list")
# (find-udfile   "ghostscript-doc/")
# (find-udfile   "ghostscript/examples/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/gs-examples/
cp -Rv /usr/share/doc/ghostscript/examples/ /tmp/gs-examples/
gunzip -rv /tmp/gs-examples/

# (find-fline "/tmp/gs-examples/")

locate tiger
dmissing tiger.ps
dmissing tiger
dmissing ghostscript | grep examp





#####
#
# run (a ghostcript command to load files)
# 2010aug24
#
#####

# «run»  (to ".run")
# http://www.ugrad.math.ubc.ca/Flat/ps-toc.html
# http://www.ugrad.math.ubc.ca/Flat/files.html





#####
#
# tex.pro
# 2010oct07
#
#####

# «tex.pro»  (to ".tex.pro")
% (find-fline "/usr/share/texmf-texlive/dvips/base/tex.pro")
% (find-fline "/usr/share/texmf-texlive/dvips/base/")
% (find-LATEXfile "2009-2-MD-prova-1.ps" "%%BeginProcSet: tex.pro")
% (find-LATEXfile "2009-2-MD-prova-1.ps" "%%BeginProcSet: special.pro")

/TeXDict 300 dict def
TeXDict begin
  /N{def}def
  /B{bind def}N
  /S{exch}N
  /X{S N}B
  /A{dup}B
  /TR{translate}N
  /isls false N
  /vsize 11 72 mul N
  /hsize 8.5 72 mul N
  /landplus90{false}def
  /@rigin{isls
          {[0 landplus90 {1 -1} {-1 1} ifelse 0 0 0] concat} if
          72 Resolution div 72 VResolution div neg scale isls
          {landplus90 {VResolution 72 div vsize mul 0 exch}
                      {Resolution -72 div hsize mul 0} ifelse TR} if
          Resolution VResolution vsize -72 div 1 add mul TR
          [matrix currentmatrix
           {A A round sub abs 0.00001 lt {round} if} forall round
           exch round exch]setmatrix}N
  /@landscape{/isls true N}B
  /@manualfeed{statusdict/manualfeed true put}B
  /@copies{/#copies X}B
  /FMat[1 0 0 -1 0 0]N
  /FBB[0 0 0 0]N
  /nn 0 N
  /IEn 0 N
  /ctr 0 N
  /df-tail{/nn 8 dict N nn begin
           /FontType 3 N
	   /FontMatrix fntrx N
	   /FontBBox FBB N string
	   /base X array
           /BitMaps X/BuildChar{CharBuilder}N
	   /Encoding IEn N end A
	   {/foo setfont}2 array copy cvx N
	   load 0 nn put
	   /ctr 0 N[}B
   /sf 0 N
   /df{/sf 1 N
       /fntrx FMat N
       df-tail}B
   /dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B
   /E{pop nn A definefont setfont}B
   /Cw{Cd A length 5 sub get}B
   /Ch{Cd A length 4 sub get}B
   /Cx{128 Cd A length 3 sub get sub}B
   /Cy{Cd A length 2 sub get 127 sub}B
   /Cdx{Cd A length 1 sub get}B
   /Ci{Cd A type/stringtype ne{ctr get/ctr ctr 1 add N}if}B
   /CharBuilder{save 3 1 roll S A/base get 2 index get S
       /BitMaps get S get/Cd X pop/ctr 0 N Cdx 0 Cx Cy Ch sub Cx Cw add Cy
       setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx sub Cy .1 sub]{Ci}imagemask
       restore}B
   /D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn
      /BitMaps get S ctr S sf 1 ne
      {A A length 1 sub A 2 index S get sf div put}if
      put/ctr ctr 1 add N}B
   /I{cc 1 add D}B
   /bop{userdict/bop-hook known{bop-hook}if
        /SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A
        mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N
   /eop{SI restore userdict/eop-hook known{eop-hook}if showpage}N
   /@start{userdict/start-hook known{start-hook}if pop/VResolution X/Resolution
           X 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255
	   {IEn S A 360 add 36 4 index cvrs cvn put}for
	   pop 65781.76 div/vsize X 65781.76 div/hsize X}N
   /p{show}N
   /RMat[1 0 0 -1 0 0]N
   /BDot 260 string N
   /Rx 0 N
   /Ry 0 N
   /V{}B
   /RV/v{/Ry X/Rx X V}B
   statusdict begin
     /product where{pop false[(Display)(NeXT)(LaserWriter 16/600)]
                    {A length product length le
		     {A length product exch 0 exch getinterval eq
		      {pop true exit}if
		     }{pop}ifelse
		    }forall
                   }{false}ifelse
     end
   {{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask grestore}}
   {{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot}imagemask grestore}}
   ifelse B
   /QV{gsave newpath transform round exch round
       exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto
       fill grestore}B
   /a{moveto}B
   /delta 0 N
   /tail{A/delta X 0 rmoveto}B
   /M{S p delta add tail}B
   /b{S p tail}B
   /c{-4 M}B
   /d{-3 M}B
   /e{-2 M}B
   /f{-1 M}B
   /g{0 M}B
   /h{1 M}B
   /i{2 M}B
   /j{3 M}B
   /k{4 M}B
   /w{0 rmoveto}B
   /l{p -4 w}B
   /m{p -3 w}B
   /n{p -2 w}B
   /o{p -1 w}B
   /q{p 1 w}B
   /r{p 2 w}B
   /s{p 3 w}B
   /t{p 4 w}B
   /x{0 S rmoveto}B
   /y{3 2 roll p a}B
   /bos{/SS save N}B
   /eos{SS restore}B
   end



#####
#
# psutils
# 2011apr28
#
#####

# «psutils»  (to ".psutils")
# (find-status   "psutils")
# (find-vldifile "psutils.list")
# (find-udfile   "psutils/")
# (find-status   "xpdf-utils")
# (find-vldifile "xpdf-utils.list")
# (find-udfile   "xpdf-utils/")
# (find-status   "poppler-utils")
# (find-vldifile "poppler-utils.list")
# (find-udfile   "poppler-utils/")

http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

# A simple script to reduce pdf file size:
# http://www.alfredklomp.com/programming/shrinkpdf/

# http://icking-music-archive.org/scores/franck/
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd $S/http/icking-music-archive.org/scores/franck/
cp -v Franck-Lento-fuge-op.18.pdf /tmp/fugue.pdf
cd /tmp/
cp -v fugue.pdf fugue2.pdf
# (find-man "mogrify")
mogrify -scale '90%' fugue2.pdf

# (find-fline "$S/http/www.cs.cmu.edu/~joshuad/pdfrescale")
bash $S/http/www.cs.cmu.edu/~joshuad/pdfrescale fugue 0.9

# (find-zsh "dmissing pdfpages")



#####
#
# pdfpages (for resizing a pdf)
# 2011apr28
#
#####

# «pdfpages»  (to ".pdfpages")
# (find-es "tex" "pdfpages")
# (code-c-d "pdfpagesdoc" "/usr/share/doc/texlive-latex-recommended-doc/latex/pdfpages/")
# (find-pdfpagesdocfile "")

# http://www.cs.cmu.edu/~joshuad/pdfrescale
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/
cat > fugue2.tex <<'%%%'
  \documentclass[twoside]{article}
  \usepackage{pdfpages}
  \begin{document}
  \includepdf[pages=-,scale=0.9,landscape=true]{fugue.pdf}
  \end{document}
%%%
pdflatex fugue2.tex

# (find-pdf-page "/tmp/fugue2.pdf")

(code-pdf-page  "pdfpages" "/usr/share/doc/texlive-latex-recommended-doc/latex/pdfpages/pdfpages.pdf")
(code-pdf-text  "pdfpages" "/usr/share/doc/texlive-latex-recommended-doc/latex/pdfpages/pdfpages.pdf")
;; (find-pdfpagespage      1  "Contents")
;; (find-pdfpagestext "")




#####
#
# pdfjam (for pdfnup)
# 2011jun20
#
#####

# «pdfjam»  (to ".pdfjam")
# «pdfnup»  (to ".pdfnup")
# (find-status   "pdfjam")
# (find-vldifile "pdfjam.list")
# (find-udfile   "pdfjam/")
# (find-udw3m    "pdfjam/PDFjam-README.html" "select")
# http://www.warwick.ac.uk/go/pdfjam
# (find-sh "pdfjam --help")

# (find-man "1 pdfjoin")
# (find-man "1 pdfbook")
# (find-man "1 pdfjam-pocketmod")
# (find-man "1 pdf270")
# (find-man "1 pdfpun")
# (find-man "1 pdf180")
# (find-man "1 pdf90")
# (find-man "1 pdfnup")
# (find-man "1 pdfjam")
# (find-man "1 pdfjam-slides3up")
# (find-man "1 pdfjam-slides6up")
# (find-man "1 pdfflip")

# (find-sh "pdfnup --help")
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
pdfnup -o /tmp/monep-8-2up.pdf /tmp/monep-8.pdf
# (find-pdf-page "/tmp/monep-8-2up.pdf")




#####
#
# default PDF viewer
# 2013sep04
#
#####

# «default-pdf-viewer» (to ".default-pdf-viewer")
# «see» (to ".see")
# (find-es "debian" "mailcap")




#####
#
# pdftk
# 2015dec10 / 2021feb10
#
#####

# «pdftk» (to ".pdftk")
# http://askubuntu.com/questions/221962/how-can-i-extract-a-page-range-a-part-of-a-pdf
# http://linuxcommando.blogspot.com.br/2013/02/splitting-up-is-easy-for-pdf-file.html
# http://williamjturkel.net/2013/08/24/working-with-pdfs-using-command-line-tools-in-linux/
# http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
# https://gitlab.com/pdftk-java/pdftk
# https://www.pdflabs.com/docs/pdftk-cli-examples/
# (find-status   "pdftk")
# (find-vldifile "pdftk.list")
# (find-udfile   "pdftk/")
# (find-status   "pdftk-java")
# (find-vldifile "pdftk-java.list")
# (find-udfile   "pdftk-java/")
# (find-man "1 pdftk")

cd /tmp/
pdftk pagliapscap01.pdf cat 1 output 01.pdf





#####
#
# qpdf
# 2021feb10
#
#####

# «qpdf»  (to ".qpdf")
# (find-status   "qpdf")
# (find-vldifile "qpdf.list")
# (find-udfile   "qpdf/")
# (find-status   "libqpdf21")
# (find-vldifile "libqpdf21.list")
# (find-udfile   "libqpdf21/")
# (find-man "1 fix-qdf")
# (find-man "1 qpdf")
# (find-man "1 zlib-flate")
# (find-sh "qpdf --help")

/usr/share/doc/qpdf/qpdf-manual.html
/usr/share/doc/qpdf/qpdf-manual.pdf

# (code-pdf-page "qpdfmanual" "/usr/share/doc/qpdf/qpdf-manual.pdf")
# (code-pdf-text "qpdfmanual" "/usr/share/doc/qpdf/qpdf-manual.pdf")
# (find-qpdfmanualpage)
# (find-qpdfmanualtext)
# (find-qpdfmanualpage 5 "structural, content-preserving transformations")
# (find-qpdfmanualtext 5 "structural, content-preserving transformations")


# https://unix.stackexchange.com/questions/394065/command-line-how-do-you-rotate-a-pdf-file-90-degrees
# (c2m221vsbp 4 "questoes-2-e-3")
# (c2m221vsba   "questoes-2-e-3")
# (find-sh0 "cp -v  ~/LATEX/2022-1-C2-VSB.pdf /tmp/")
# (find-sh0 "cp -v  ~/LATEX/2022-1-C2-VSB.pdf /tmp/in.pdf")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cp -v  ~/LATEX/2022-1-C2-VSB.pdf /tmp/
cp -v  ~/LATEX/2022-1-C3-VSB.pdf /tmp/
cd /tmp/
qpdf 2022-1-C2-VSB.pdf 2022-1-C2-VSB-rodado.pdf --rotate=+90
qpdf 2022-1-C3-VSB.pdf 2022-1-C3-VSB-rodado.pdf --rotate=+90

# (find-fline "/tmp/")




#####
#
# qpdf-merge
# 2023jul01
#
#####

# «qpdf-merge»  (to ".qpdf-merge")
# https://github.com/qpdf/qpdf/issues/11
# (find-angg     "LUA/QPDFMerge.lua")
# (find-anggfile "LUA/QPDFMerge.lua" "qpdf --empty --pages")
# (find-pdfanim-links "/tmp/qdraw/" "a_" "all")
# (find-efunction 'find-pdfanim-links)





#####
#
# converting djvu to pdf
# 2017jun14
#
#####

# «djvu-to-pdf» (to ".djvu-to-pdf")
# (find-zsh "apt-file search djvu | grep pdf")
# (find-angg "SCANS/Makefile" "pdf")
# (find-es "scan" "djvu2pdf")




#####
#
# djview
# 2017jul28
#
#####

# «djview» (to ".djview")
# (find-es "scan" "djview")
# (find-es "scan" "djview-page")
# (find-es "scan" "djview-default-page")




#####
#
# Other djvu viewers
# 2017ago01
#
#####

# «other-djvu-viewers» (to ".other-djvu-viewers")
# (find-status "djview4")
# (find-status "djview4" "djvu-viewer")
# (find-status "evince")





#####
#
# evince
# 2017ago01
#
#####

# «evince» (to ".evince")
# (find-es "mate" "atril")
# (find-status   "evince")
# (find-status   "evince" "Conflicts: evince-gtk")
# (find-vldifile "evince.list")
# (find-udfile   "evince/")
# (find-man "1 evince")
# (find-man "1 evince" "-i, --page-index=NUMBER")
# (find-man "1 evince" "-f, --fullscreen")
# (find-man "1 evince" "-s, --presentation")
# http://www.gnome.org/projects/evince/
# https://wiki.gnome.org/Apps/Evince

# (find-fline "~/books/__cats/")
# (find-books "__cats/__cats.el" "johnstone-elephant")
# (setenv "DJVU" (ee-expand "~/books/__cats/johnstone__sketches_of_an_elephant_2vols.djvu"))

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
evince --help
evince --page-index=2 $DJVU
evince -f --page-index=99 $DJVU
evince -s --page-index=99 $DJVU
evince -w --page-index=99 $DJVU

evince -f -i $[17+99] $DJVU
evince -s -i $[17+99] $DJVU

evince -geometry +0+0 -s --page-index=99 $DJVU
 



#####
#
# pdftotext
# 2017ago01
#
####

# «pdftotext» (to ".pdftotext")
# (find-es "charsets" "pdftotext")
# https://poppler.freedesktop.org/
# (find-status   "poppler-utils")
# (find-vldifile "poppler-utils.list")
# (find-udfile   "poppler-utils/")
# (find-man "1 pdftotext")
# (find-efunction 'find-pdf-text)

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-sh "apt-cache show    poppler-utils")
# (find-sh "apt-cache showsrc poppler")
rm -Rv /tmp/d/
mkdir  /tmp/d/
cd     /tmp/d/
sudo apt-get build-dep -y   poppler
     apt-get source         poppler   |& tee osource
     apt-get source --build poppler   |& tee osourceb

# (find-fline "/tmp/d/")
# (find-fline "/tmp/d/poppler-0.41.0/utils/pdftotext.cc")




#####
#
# pdftotext-for-windows
# 2021oct21
#
#####

# «pdftotext-for-windows»  (to ".pdftotext-for-windows")
# https://en.wikipedia.org/wiki/Xpdf
# https://www.xpdfreader.com/download.html
# https://dl.xpdfreader.com/xpdf-tools-win-4.03.zip

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "/tmp/xpdf-tools-win-4.03/")
# (find-fline "/tmp/xpdf-tools-win-4.03/README")
# (find-fline "/tmp/xpdf-tools-win-4.03/bin64/" "pdftotext.exe")

rm -Rv /tmp/xpdf-tools-win-4.03/
mkdir  /tmp/xpdf-tools-win-4.03/
cd     /tmp/
unzip $S/https/dl.xpdfreader.com/xpdf-tools-win-4.03.zip
cd     /tmp/xpdf-tools-win-4.03/

cp -v  /tmp/xpdf-tools-win-4.03/bin64/pdftotext.exe ~/2021-oficina/
# (find-fline "~/2021-oficina/")




#####
#
# pdftotext generates spurious formfeeds
# 2019apr11
#
#####

# «pdftotext-spurious-ffs» (to ".pdftotext-spurious-ffs")
# (find-eev "eev-pdflike.el" "ee-goto-position-page")
# (find-eev "eev-pdflike.el" "ee-goto-position-page" "ee-pdftotext-replace-bad-ffs")
# (find-eev "eev-pdflike.el" "find-pdf-text")
# (find-eev "eev-pdflike.el" "find-pdf-text" "pdftotext")

# An example of a PDF in which my cleanup function doesn't work:
# https://github.com/pluralsight/git-internals-pdf/releases/download/v2.0/peepcode-git.pdf
# (find-books "__comp/__comp.el" "git-internals")
# (find-books "__comp/__comp.el" "git-internals" "\\f\\f")
# (find-gitinternalstext  16 "blob : a906cb")
# (find-gitinternalstext  16 "blob : a906cb" "\f\f")

# (find-man "1 pdftotext")
# (find-man "1 pdftotext" "-enc encoding-name")
# (find-man "1 pdftotext" "-enc encoding-name" "UTF-8")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd /tmp/
# wget -nc https://github.com/pluralsight/git-internals-pdf/releases/download/v2.0/peepcode-git.pdf
cp -v $S/https/github.com/pluralsight/git-internals-pdf/releases/download/v2.0/peepcode-git.pdf .
pdftotext -layout -enc Latin1 peepcode-git.pdf peepcode-git.latin1
pdftotext -layout             peepcode-git.pdf peepcode-git.utf8
# (find-fline "/tmp/peepcode-git.latin1")
# (find-fline "/tmp/peepcode-git.latin1" " 15")
# (find-fline "/tmp/peepcode-git.latin1" " 15" "blob : a906cb")
# (find-fline "/tmp/peepcode-git.latin1" " 15" "blob : a906cb" "\f\f")
# (find-fline "/tmp/peepcode-git.utf8")
# (find-fline "/tmp/peepcode-git.utf8"   " 15")
# (find-fline "/tmp/peepcode-git.utf8"   " 15" "blob : a906cb")
# (find-fline "/tmp/peepcode-git.utf8"   " 15" "blob : a906cb" 3)
# (find-fline "/tmp/peepcode-git.latin1" "SimpleGit Ruby Library" -2)
# (find-fline "/tmp/peepcode-git.utf8"   "SimpleGit Ruby Library" -2)




#####
#
# Page labels in PDFs
# 2018dec03
#
#####

# «page-labels» (to ".page-labels")
# (find-es "tex" "hyperref")
# (find-man "1 pdfinfo")
# https://stackoverflow.com/questions/12924073/export-pdf-page-labels-on-command-line
# https://tex.stackexchange.com/questions/246705/pdf-page-labels
# https://texfaq.org/FAQ-pdfpagelabels

https://manuals.setasign.com/setapdf-core-manual/page-labels/




#####
#
# reduce-pdf-file-size
# 2019dec01
#
#####

# «reduce-pdf-file-size» (to ".reduce-pdf-file-size")
# https://bash.cyberciti.biz/file-management/linux-shell-script-to-reduce-pdf-file-size/





#####
#
# zathura
# 2020dec01
#
#####

# «zathura»  (to ".zathura")
# https://pwmt.org/projects/zathura/
# https://pwmt.org/projects/zathura/download/
# https://pwmt.org/projects/zathura/installation/
# https://pwmt.org/projects/zathura/screenshots/
# https://git.pwmt.org/pwmt/girara.git
# https://git.pwmt.org/pwmt/girara
# https://git.pwmt.org/pwmt
# https://git.pwmt.org/pwmt/zathura
# (find-status   "zathura")
# (find-vldifile "zathura.list")
# (find-udfile   "zathura/")
# (find-man "1 zathura")
# (find-bgprocess "zathura -P 3 ~/Coetzee99.pdf")

(defun  ee-find-zathura-page (fname &optional page)
  `("zathura"
    "-P" ,(format "%d" (or page 1))
    ,fname))

;; (find-code-pdfbackend "zathura-page")
        (code-pdfbackend "zathura-page")

;; (find-zathura-page "~/Coetzee99.pdf")
;; (find-zathura-page "~/Coetzee99.pdf" 3)




#####
#
# mupdf and mutool
# 2021sep23
#
#####

# «mupdf»  (to ".mupdf")
# https://en.wikipedia.org/wiki/MuPDF
# https://mupdf.com/
# https://mupdf.com/docs/ecosystem.html
# https://mupdf.com/docs/manual-mutool-run.html
# https://mujs.com/

# (find-status   "mupdf")
# (find-vldifile "mupdf.list")
# (find-udfile   "mupdf/")
# (find-status   "mupdf-tools")
# (find-vldifile "mupdf-tools.list")
# (find-udfile   "mupdf-tools/")
# (find-man "1 mupdf")
# (find-man "1 mupdf" "KEY BINDINGS")
# (find-man "1 mutool")
# (find-man "1 mutool" "mutool draw [options] file [pages]")
# (find-man "1 mutool" "Comma separated list of page numbers")
# (find-man "1 mutool" "mutool info")
# (find-man "1 mutool" "mutool merge")

# https://www.slant.co/topics/5967/~pdf-viewers-for-linux
# (find-eev "eev-pdflike.el" "find-mupdfpage")

mupdf --help

mupdf ~/Coetzee99.pdf 42

apti mupdf
apti mupdf-tools

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/mutool/
mkdir  /tmp/mutool/
cd     /tmp/mutool/
cp -iv ~/books/__cats/maclane_moerdijk__sheaves_in_geometry_and_logic.pdf \
       /tmp/mutool/in.pdf

mutool draw -o out.pdf in.pdf 21
mutool info    out.pdf

mutool draw -o out.png in.pdf 21

# (find-fline "/tmp/mutool/")

https://stackoverflow.com/questions/2641770/extracting-image-from-pdf-with-ccittfaxdecode-filter
https://stackoverflow.com/questions/39927639/is-it-possible-to-use-libtiff-to-decode-ccitt-encoded-data-when-the-length-is-no?noredirect=1&lq=1
https://blog.idrsolutions.com/2013/03/understanding-the-pdf-file-format-filter-and-decodeparms-objects-for-a-pdf-image/

https://stackoverflow.com/a/47877930/4204372

https://stackoverflow.com/questions/2693820/extract-images-from-pdf-without-resampling-in-python/47877930#47877930

pip3 install pymupdf

* (eepitch-python)
* (eepitch-kill)
* (eepitch-python)
import fitz
os.chdir("/tmp/mutool/")
doc = fitz.open("out.pdf")
for i in range(len(doc)):
    for img in doc.getPageImageList(i):
        xref = img[0]
        pix = fitz.Pixmap(doc, xref)
        if pix.n < 5:       # this is GRAY or RGB
            # pix.writePNG("p%s-%s.png" % (i, xref))
            pix.writePNG("out.png")
        else:               # CMYK: convert to RGB first
            # pix1 = fitz.Pixmap(fitz.csRGB, pix)
            # pix1.writePNG("p%s-%s.png" % (i, xref))
            pix1.writePNG("out.png")
            pix1 = None
        pix = None

# (find-fline "/tmp/mutool/")
# (find-gimp "/tmp/mutool/")

https://lists.gnu.org/archive/html/emacs-devel/2022-09/msg01377.html extract an outline
https://codeberg.org/jao/elibs/src/branch/main/lib/doc/jao-pdf.el#L48 -> jao-pdf-outline
https://codeberg.org/jao/elibs/src/branch/main/lib/doc/jao-doc-view.el#L50 -> jao-doc-view--imenu-create-index




#####
#
# epdfview
# 2022mar24
#
#####

# «epdfview»  (to ".epdfview")

# (find-git-links "https://github.com/JotaRandom/epdfview" "epdfview")
# (code-c-d "epdfview" "~/usrc/epdfview/")
# (find-epdfviewfile "")
# (find-epdfviewfile "INSTALL")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
apti libgtk-3-dev libgtk2.0-dev

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/usrc/epdfview/

git clean -dffx
git reset --hard

./configure --help               |& tee och
./configure --prefix=/usr/local  |& tee oc
make          |& tee om
make check    |& tee omc
sudo make install  |& tee omi
epdfview
epdfview --help
# (find-man "epdfview")




#####
#
# okular
# 2022apr04
#
#####

# «okular»  (to ".okular")
# (find-status   "okular")
# (find-vldifile "okular.list")
# (find-udfile   "okular/")
# (find-man "1 okular")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
apti okular
aptrm okular
sudo apt-get autoremove

;; Based on: (find-eev "eev-pdflike.el" "find-mupdfpage")
;; Test: (find-pdf-like-intro "2. Preparation")
;;       (find-okular-page "~/Coetzee99.pdf" 3)
;;
(defun     find-okular-page (fname &optional page &rest rest)
  (find-bgprocess (ee-find-okular-page fname page)))
(defvar ee-find-okular-page-options '())
(defun  ee-find-okular-page (fname &optional page &rest rest)
  `("okular"
    ,@ee-find-okular-page-options
    ,@(if page `("-p" ,(format "%s" page)))
    ,fname
    ))

;; (find-code-pdfbackend "okular-page")
        (code-pdfbackend "okular-page")




#####
#
# paps
# 2022dec18
#
#####

# «paps»  (to ".paps")
# (find-angg ".emacs.templates" "find-paps-links")
# https://lists.gnu.org/archive/html/help-gnu-emacs/2022-12/msg00535.html Jean Louis
# https://lists.gnu.org/archive/html/help-gnu-emacs/2022-12/msg00790.html JL: options
# https://lists.gnu.org/archive/html/help-gnu-emacs/2023-01/msg00057.html JL: make
# (find-man "1 paps")
# (find-status   "paps")
# (find-vldifile "paps.list")
# (find-udfile   "paps/")




#####
#
# pypdf
# 2023may23
#
#####

# «pypdf»  (to ".pypdf")
# (find-pip3-links "pypdf")
# (find-pip3-links "pypdf2")
# (find-pip3-links "pypdf4")
# https://pybrary.net/pyPdf/
# https://pypi.org/project/pypdf/
# https://pypi.org/project/PyPDF2/
# https://pypi.org/project/PyPDF4/



https://reverseengineering.stackexchange.com/questions/1526/open-source-gui-tool-for-decomposing-a-pdf





# (find-status   "kwayland-data")
# (find-vldifile "kwayland-data:amd64:amd64.list")
# (find-udfile   "kwayland-data/")
# (find-status   "kwayland-integration")
# (find-vldifile "kwayland-integration:amd64.list")
# (find-udfile   "kwayland-integration/")





;; Configure `find-pdf-page':
;; See:  (find-pdf-like-intro "3. Hyperlinks to PDF files")
;;       (find-pdf-like-intro "3. Hyperlinks to PDF files" "If you have xpdf")
;;       (find-eev "eev-pdflike.el" "change-default-viewer")
;; Test: (find-pdf-like-intro "2. Preparation")
;;       (find-pdf-page "~/Coetzee99.pdf" 3)
(defalias 'find-pdf-page 'find-xpdf-page)
(defalias 'find-pdf-page 'find-googlechrome-page)
(defalias 'find-pdf-page 'find-mupdf-page)








"p%s-%s.png" % (22, 444)


# (find-status   "pstoedit")
# (find-vldifile "pstoedit.list")
# (find-udfile   "pstoedit/")



# (find-efile "play/handwrite.el")







http://www.math.ubc.ca/~cass/graphics/manual/

https://github.com/mkottman/PdfCropGUI




# 2007apr06: An irc bot written in postscript
# http://jeffz.name/gs/

https://www.ghostscript.com/doc/9.27/History9.htm#Version9.27

https://news.ycombinator.com/item?id=32629237 PostScript Control Structures (2003) (nedbatchelder.com)
https://news.ycombinator.com/item?id=33646951 Show HN: I am building a new Python library to read/write PDF files (github.com/desgeeko)
https://news.ycombinator.com/item?id=33912786 How PostScript kickstarted desktop publishing (ieee.org)
https://computerhistory.org/blog/postscript-a-digital-printing-press/
https://amccormack.net/2012-01-22-anatomy-of-a-pdf-document.html
https://web.archive.org/web/20190914234428/esec-lab.sogeti.com/pages/origami.html
https://github.com/dzzie/pdfstreamdumper
https://github.com/jduck/file-dissect
https://www.sensible.so/history-of-the-pdf-pdf
https://news.ycombinator.com/item?id=38765627 Stirling-PDF: local web application to perform various operations on PDFs (github.com/frooodle)

https://github.com/dvcoolarun/web2pdf
https://news.ycombinator.com/item?id=39265756 Show HN: CLI for generating PDFs for offline reading (github.com/dvcoolarun)


garrett mcqueen




#  Local Variables:
#  coding:               utf-8-unix
#  modes:                (fundamental-mode emacs-lisp-mode ps-mode)
#  End: