OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Subject: DOCBOOK-APPS: Re: Getting images into PDF

This is the process that I went through (sort of):

1. Decide on document output formats

  - It is too hard to juggle every permutation of image/document format, 
  - HTML for "on-line"
  - PDF for "paper"

2. Decide on Image formats
  - Too hard to cope with every image format at the same time
  - Choose PNG for bitmapped/ HTML images
  - Choose Encapsulated PDF for scalable images

3. Why PNG?
  - It is "politically correct" w.r.t to GIF
  - It can contain density information so that it works reliably in PDF files
  - the downside is that old browsers (IE3.0, Netscape 3.0 do not support it) 
[I decided that this was no longer a pratical objection for me]

4. Why EPDF?
  - EPS doesn't work with pdftex.
  - EPDF has a bounding box

5. Preparing images:
   - Assume we have a scalable picture in EPS format (simage.eps) and a 
bitmapped in PNG format (bimage.png)
   - Use ImageMagick to convert to EPDF
         convert simage.eps simage.epdf
   - Rename the file so that it ends in pdf - pdftex wants this!
         mv simage.epdf simage.pdf
   - Use Ghostscript to add density information for the bitmapped file (this 
is needed to make bitmapped images work "correctly" in PDF files - it is a 
topic in its own right so I'll skip over this for the moment - 150 is a good 
         convert -density 150 bimage.png bimage.eps
         eps2png -res 150 bimage.eps bimage.png

    - Finally for HTML output we don't want an PDF file so make sure we have 
a PNG representation
         convert simage.eps simage.png

(of  course, if your bitmapped image was BMP or TIFF you can use ImageMagick 
to convert)
[I'm also making an assumption that your book has either diagrams (scalable) 
or screendumps (bitmapped) and NOT photographs - hence my complete ignoring 
of JPEG]

    - This gives the images we want to use (simage.{pdf,png} and bimage.png}
       The intention is to use the PDF scalable and PNG bitmapped images in 
the PDF file, with the two PNG representations in the HTML.

5. Representation in DocBook Markup
   - Choose between the (becoming obsolete) <graphic> and the more flexible 
   [I'll only discuss <graphic> as that is a bit simpler!]
   - Omit the file extension when using graphic

      <graphic fileref="simage">
      <graphic fileref="bimage">

6. Make sure that the stylesheets understand PDF.
   - Currently (or last time I looked) PDF and/or PNG as an image format was 
not recognised by the stylesheets - so put the following in your print 
"driver" stylesheet

(define %graphic-extensions%
;; List of graphic filename extensions
'("pdf" "eps" "epsf" "gif" "tif" "tiff" "jpg" "jpeg" "png"))

;; A default graphic extension is confusing! 
(define %graphic-default-extension% #f)
(define preferred-mediaobject-notations
  (list "PDF" "EPS" "PS" "JPG" "JPEG" "PNG" "linespecific"))
(define preferred-mediaobject-extensions
  (list "pdf" "eps" "ps" "jpg" "jpeg" "png"))

7. Make sure that pdftex knows to choose PDF if it is available rather than 
PNG so that for our scalable image the PDF image will be choosen over the PNG 
image. Jade will ignore the PDF and choose the PNG for the HTML

Add this to your jadetex.cfg file in the current directory (or create one)

This means that pdftex will look for the .pdf before a .png etc.

8 Process with jade and pdfjadetex
    - If you have a slow enough computer (or look at the log file) you should 
see that the PDF file is included in the run of pdfjadetex. Inspect the HTML 
and it should include a reference to the PNG file.

9. Admire your handiwork.

10. If you really want PostScript instead of PDF then don't change anything - 
just run acroread on the PDF file

    acroread -toPostScript [options] <pdffile>

Hope that helps!




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Powered by eList eXpress LLC