[tex4ht] TeX4ht warning --- Cannot determine size of graphic in svg graphics. Does tex4ht support bounding box on svg?

Nasser M. Abbasi nma at 12000.org
Tue May 19 19:21:33 CEST 2015


On 5/19/2015 10:35 AM, Michal Hoftich wrote:

>
> you need to create a .xbb file for each svg file. you can create it
> with `ebb -x` command (I am not sure whether it is installed by
> default with TeX Live.
>

fyi, I get this:

------------------------------------
>extractbb -x flow.svg
   extractbb:warning: Can't handle file type for file named flow.svg

>ebb -x flow.svg
   ebb:warning: Can't handle file type for file named flow.svg

>ebb --version

This is extractbb Version 20140317
A bounding box extraction utility from PDF, PNG, and JPEG.
--------------------------------------

Using TL 2014. May be need to update something.

Thanks for the information below

>
>>
>> Here is the tex file:
>> -------------------------------
>> \documentclass[12pt]{article}
>> \usepackage{graphicx}
>> \begin{document}
>> \includegraphics[width=0.2\paperwidth]{2}
>> \end{document}
>> --------------------------------
>>
>> There is a file called 2.pdf and 2.svg in the folder.
>> pdflatex works fine and the image shows small as expected. But
>> the HTML shows the image as SVG, but not resized due to the
>> above warning.
>>
>
> in this example the image should have width of 1/5 textwidth, original
> image size isn't used at all, so the warning shouldn't matter.
>
>> Here is the .cfg I am using (from your last email)
>>
>> ------------------------------------
>> \Preamble{ext=htm,p-width,pic-align} %work well with something, I forgot
>> what
>> \DeclareGraphicsExtensions{.svg,.png,.jpg}
>> \Configure{Picture}{.svg}
>> \makeatletter
>> \Configure{graphics*}
>> {svg}
>> {
>>    {\Configure{Needs}{File: \Gin at base.svg}\Needs{}}
>>    \Picture[\csname a:GraphicsAlt\endcsname]{\csname
>> Gin at base\endcsname.svg width="\expandafter\the\csname
>> Gin at req@width\endcsname"  height="\expandafter\the\csname
>> Gin at req@height\endcsname"
>> }
>> }
>> \begin{document}
>> \EndPreamble
>> ----------------------------------------
>>
>
> this config file doesn't use image size information from the .xbb
> file. as I said, it doesn't work with explicit setting of image size.
> (error `Package graphics Error: Division by 0.` is produced)
>
>
>> Here is the command I used
>>
>> make4ht foo.tex "nma,htm,charset=utf-8" " -cunihtf -utf8"
>
> you can also use
>
>      make4ht -uc nma.cfg foo.tex htm
>
> instead
>
>
>>
>> also tried
>>
>> htlatex foo.tex "nma,htm"
>>
>> Both give the same warning and the image do not resize.
>
> of course :)
>
> add
>
>       \DeclareGraphicsRule{.svg}{svg}{.xbb}{}
>
> to the .cfg file under \DeclareGraphicsExtensions if you want to use
> original image dimensions. but if you use that with explicit width
> setting, it will fail with `Division by 0` error, as I said earlier.
> It is maybe graphicx bug, because the same error is produced with
> plain LaTeX.
>
>>
>> btw, when one writes \makeatletter  does one need to also add \makeatother
>> at the end? I noticed you did not have \makeatother in the above.
>>
>
> I forgot it :)
>
>> Also, since I got your attention, I am confused about one thing:
>> When using your build system make4ht, does it still use/read the
>> tex4ht.env or does it not need it?  Please let me know if I can
>> try anything. I'd like to use your method above, since it saves
>> me having to make .eps for each image.
>
> it does use it, but you can modify image generation and conversion in
> a build file
>
> Regards,
> Michal
>
>
>
>>
>

regards,
--Nasser



More information about the tex4ht mailing list