I branch from "PDF image files and htlatex" as advised by michal.h21.

I use myxhtml.cfg as follows

    \Needs{"convert      \csname Gin@base\endcsname.pdf  
                         \csname Gin@base\endcsname.png"}%  
    \Picture[pict]      {\csname Gin@base\endcsname.png}%  
    \special{t4ht+@File: \csname Gin@base\endcsname.png}

Then test.tex


and pdf file 1fig2dev.pdf is quite small

5 0 obj
x­S»R^C1^Lìý^UªS^HKgëñ^EÔ   ^E^_¤H      ^Tü>ò½^RrÇ^LEæ
¥´ëµ/ ·o\÷çô´S8|¥KÊ@Y2SK^R³Ýüô©S:&Ò¬(^E:,^BNjJAá^Z(R¤^A©£gi^Qñ^NÕ^Cc¨äë^QUBV jQ\úÈïYmþë^F>^Rc×&}÷T3ì^S^G^GaR:4­A«@^E+g^T30«(ÊP      ­zôä@y»OTX0Ì^@áU¢^PU¼^X­èÖâØ^Eñ}zIÛ pX=^U¹÷âÞ7+Â^^Õü^XtÿíñØÏã,\|Ù;êQmðxpÝ«`^V¹é^X¯Á"00÷^RgìtÃ|tuxôS¢ýÞ:Fåä&å\yrsÚ^Ý^A£PhvÓ»¸¢.£«Âï)/T-4^OêÔ\B^Aukâ^T+^S÷oíóm^Bã^_éÒ¦±
6 0 obj
4 0 obj
/Contents 5 0 R
3 0 obj
1 0 obj
7 0 obj
8 0 obj
9 0 obj

fig2dev Version 3.2 Patchlevel 5e


2 0 obj
0 10
0000000000 65535 f 
0000000646 00000 n 
0000002219 00000 n 
0000000587 00000 n 
0000000456 00000 n 
0000000015 00000 n 
0000000437 00000 n 
0000000710 00000 n 
0000000751 00000 n 
0000000780 00000 n 

all residing in the same folder.

Now i type htlatex test.tex myxhtml but this does not work:

! LaTeX Error: Cannot determine size of graphic in 1fig2dev.pdf (no BoundingBox

See the LaTeX manual or LaTeX Companion for explanation.
Type  H   for immediate help.

l.7 \includegraphics{1fig2dev.pdf}

It seems as if the pdf is not replaced. I tried convert 1fig2dev.pdf 1fig2dev.png manually and verified with gwenview 1fig2dev.png... seems to be fine.

What went wrong????

ok, partial answer: The problem disappears if i remove the picture environment. Is this a bug in htlatex????

  • 1
    Please post a full question. – Heiko Oberdiek Oct 17 '16 at 19:01
  • 1
    should be ok now, sorry – user2609605 Oct 17 '16 at 19:24

contents of picture environment is converted to image using some dvi to image converter. tex4ht configurations are suppressed inside it, so the configuration for graphics* in not executed at all, the PDF file is inserted as it is. If you try to run your document with latex, you would get exactly the same error.

If you move the \includegraphics outside the picture environment, the graphics* configuration will take an effect and the PDF picture will be included. If you really want to include image in the picture environment, you need to use eps format, which is supported in the DVI mode.

I would use following method:

Prepare the images in all needed formats (pdf, png, eps), declare which extensions should LaTeX use in particular mode, remove extensions from \includegraphics command and let LaTeX decide which one it should use.

You modified document:



As you can see, \DeclareGraphicsExtensions command is used to define extensions, which should be tried when image is included. These will be used in the PDF mode. Now you need to modify the .cfg file:



\Configure{picture} is used to declare that eps images should be used inside picture environment, png,jpg or gif should be used otherwise.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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