On 10/18/2017 3:25 AM, Michal Hoftich wrote:
It is not in TL yet, I've just updated the sources. So you can't use
the \Configure{PdfConvert} in your config file yet.
Thanks. It was not clear from your message if it was or not, so
I did full update before trying. Any idea when your changes
will be in TL so one can do full update again to pick it up?
Anyway, testing your TeX document, I've found some issues. First of
all, you can't use \pdfximage and \pdflastximagepages with tex4ht,
because these commands aren't available in the DVI mode.
I see. But that is the main reason I was interested in trying whatever
changes you made. I have lots of PDF files which I include
into the document using \pdfximage and then loop
\foreach \n in {1,...,\the\pdflastximagepages}
\includegraphics[width=0.95\textwidth,page=\n]{foo}
to load each page to the latex document. Since the above now
does not work in tex4ht, I do this
\ifdefined\HCode
\href{foo}{PDF file}
\else
.... use \pdfximage etc.. as shown above
\fi
And I was hoping your changes will let me get rid of this
conditions and convert the PDF pages on the fly to SVG and
have them show in the HTML itself.
I think there
is nothing we could do about this. Second, you should replace \else
after \usepackage[utf8]{luainputenc} with \fi. I don't even think that
you need to use luainputenc anymore, utf8 should work out of the box
with LuaLaTeX.
The biggest issue is that page selection seems to be unsupported by
Inkscape. It converts the first page every time. So other conversion
method should be used. I've found pdf2svg script, which is included in
Fedora or Ubuntu repos, so I think it should be widely available on
Linux, I am not sure about Windows.
Yes, I know about pdf2svg, but this requires one to break the PDF
manually into separate pages each time into smaller PDF files,
where each file now contain one page. So right now, I just
use \href{}{} to link to the PDF file when I compile to HTML.
Another possibility might be ImageMagick, but the default result seems
to be of low quality.
Anyway, here is a config file for testing:
\Preamble{xhtml}
\NewConfigure{PdfConvert}{2}
\makeatletter
\catcode`\:=11
\Configure{PdfConvert}{svg}{"pdf2svg '\[email protected]'
'\Gin@base-\Gin@page.\a:PdfConvert' \Gin@page"}
\Configure{graphics*}
{pdf}
{\Needs{\b:PdfConvert}%
\edef\svg:filename{\Gin@base-\Gin@page.\a:PdfConvert}
{\Configure{Needs}{File: \svg:filename}\Needs{}}%
\Picture[\a:GraphicsAlt]{{\svg:filename}\csname a:Gin-dim\endcsname
}}
\catcode`\:=12
\makeatother
\begin{document}
\EndPreamble
Best regards,
Michal
Thanks for the above .cfg template file. That helps alot.
All these commands are magic to me, so it is always good
to have a template to use as reference.
--Nasser