Paste number 1308: pdf export hack for Acclaim

Index of paste annotations: 1

Paste number 1308: pdf export hack for Acclaim
Pasted by: mgr
When:10 years, 6 months ago
Share:Tweet this! | http://paste.lisp.org/+10C
Channel:#lisp
Paste contents:
Raw Source | XML | Display As
I did some test on generating pdf's of Acclaim slides
without cl-pdf hacking. If you do just screenshots, convert them to
ps, concatenate these files and convert the resulting ps to pdf, you
get a quite usable pdf with a reasonable size, of course only if you
don't use a background picture (just call (setf
acclaim::*show-bg-image* nil)). I got a 223068 bytes file for 10 pages.
I think that this is okay. Here is the recipe:

- Install scrot (apt-get install scrot on debian, else go to
  http://linuxbrit.co.uk/scrot/),
- add this near the end of acclaim.lisp (i.e. just before (t nil)):

  (#\s (sb-ext:run-program "/usr/bin/scrot"
          (list (format nil "~a/slide-~3,'0d.pnm"
               "/home/mgr/daten/coding/lisp/acclaim/pdf/tmp"
                        number)))
        nil)

  (modifying of course the specified path),
- call (acclaim:start) and press #\s (as in screenshot) for each slide,
- open up a terminal and go the the specified directory and
  fire up something like the following (in bash):

  for i in slide*pnm; do pnmtops $i ; done | ps2pdf - > slides.pdf

- Voila.

Perhaps this is not as elegant as using cl-pdf, but at least the pdf
will look exactly like the Acclaim slides..

---
errata:

Use something like

for i in slide-*.pnm; do \
   pnmtops -dpi 75 -scale=1.0 -width 16 -setpage $i ; \
done | ps2pdf14 - > all-tmp.pdf; pdfopt all-tmp.pdf all.pdf

instead. This makes a non-scaled version of the slides (without
changing the file size), with perhaps a slightly better pdf because of
the pdfopt. The value of width=16 resembles my screen width of
1152 pixels (calculation: (ceiling (/ 1152 75))). This results in a
385 kB PDF for Christophe's slides (without background image, if he used
one anyway).

Annotations for this paste:

Annotation number 1: deadlyfist
Pasted by: white553
When:8 years, 1 day ago
Share:Tweet this! | http://paste.lisp.org/+10C/1
Paste contents:
Raw Source | Display As
   1: I did some test on generating pdf's of Acclaim slides
   2: without cl-pdf hacking. If you do just screenshots, convert them to
   3: ps, concatenate these files and convert the resulting ps to pdf, you
   4: get a quite usable pdf with a reasonable size, of course only if you
   5: don't use a background picture (just call (setf
   6: acclaim::*show-bg-image* nil)). I got a 223068 bytes file for 10 pages.
   7: I think that this is okay. Here is the recipe:
   8: 
   9: - Install scrot (apt-get install scrot on debian, else go to
  10:   http://linuxbrit.co.uk/scrot/),
  11: - add this near the end of acclaim.lisp (i.e. just before (t nil)):
  12: 
  13:   (#\s (sb-ext:run-program "/usr/bin/scrot"
  14:           (list (format nil "~a/slide-~3,'0d.pnm"
  15:                "/home/mgr/daten/coding/lisp/acclaim/pdf/tmp"
  16:                         number)))
  17:         nil)
  18: 
  19:   (modifying of course the specified path),
  20: - call (acclaim:start) and press #\s (as in screenshot) for each slide,
  21: - open up a terminal and go the the specified directory and
  22:   fire up something like the following (in bash):
  23: 
  24:   for i in slide*pnm; do pnmtops $i ; done | ps2pdf - > slides.pdf
  25: 
  26: - Voila.
  27: 
  28: Perhaps this is not as elegant as using cl-pdf, but at least the pdf
  29: will look exactly like the Acclaim slides..
  30: 
  31: ---
  32: errata:
  33: 
  34: Use something like
  35: 
  36: for i in slide-*.pnm; do \
  37:    pnmtops -dpi 75 -scale=1.0 -width 16 -setpage $i ; \
  38: done | ps2pdf14 - > all-tmp.pdf; pdfopt all-tmp.pdf all.pdf
  39: 
  40: instead. This makes a non-scaled version of the slides (without
  41: changing the file size), with perhaps a slightly better pdf because of
  42: the pdfopt. The value of width=16 resembles my screen width of
  43: 1152 pixels (calculation: (ceiling (/ 1152 75))). This results in a
  44: 385 kB PDF for Christophe's slides (without background image, if he used
  45: one anyway).
  46: 

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.