TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a long LaTeX document with lots of figures that were included using commands of the form


Everything compiles fine with pdfLaTeX. I planned to convert the document into HTML using TeX4ht, but it seems that TeX4ht does not understand the page= attributes in \includegraphics.

Are there any easy solutions? Ideally, I would prefer to keep my main Latex source unmodified and just tweak the preamble.

share|improve this question

Sorry for being late. Following code is likely to help the Jukka:


    pdftops -eps -f \GPT@page\space -l \GPT@page\space \Gin@base.pdf \Gin@base-\GPT@page.eps"
    convert \Gin@base-\GPT@page.eps \Gin@base-\GPT@page.png

\Includegraphics[10]{foo.pdf} should work now both with pdfLaTeX and TeX4ht.

share|improve this answer
We are glad to have you here in TeX.SX. A warm welcome to you. – Harish Kumar Sep 15 '12 at 6:44
Thanks, Harish. Glad to meet you here. – CV Radhakrishnan Sep 16 '12 at 9:55

TeX4ht does not use pdfTeX in PDF mode, but dvips instead. However dvips can neither read PDF files nor multipage files. Page 10 can be extracted and converted to eps with epstopdf of xpdf:

epstopdf -eps -f 10 -l 10 foo.pdf foo-10.eps

Or ghostscript can be used, e.g.:

gs -dFirstPage=10 -dLastPage=10 -sDEVICE=epswrite -dBATCH -dNOPAUSE -sOutputFile=foo-10.eps foo.pdf

Then in the source:


And package ifpdf is needed in the preamble:

share|improve this answer
Something along these lines certainly works, but it requires changes in the body of the Latex document. I wonder if I could easily redefine \includegraphics; moreover, perhaps I could have Latex run gs automatically to when needed? – Jukka Suomela Aug 28 '12 at 18:02
It could be done, looking at package epstopdf that support external conversion programs for pdfTeX in PDF mode, I would expect several hundred lines of code. – Heiko Oberdiek Aug 28 '12 at 20:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.