The answer given here pdf-image-files-and-htlatex works very well when the pdf file has one page only.
tex4ht will convert the pdf page to a png and load it into the HTML OK.
But it does not work for a PDF file with multiple pages.
I will show an MWE with PDF file that contains one page only
\documentclass[11pt]{article}%
\usepackage{graphicx}
\begin{document}
\includegraphics[]{one_page}%has one page only
\end{document}
Compiled using this make4ht command
make4ht -ulm default -c ./nma.cfg foo_one.tex
Where nma.cfg is
\Preamble{xhtml,p-width}
\Configure{VERSION}{}
\Configure{DOCTYPE}{\HCode{<!DOCTYPE html>\Hnewline}}
\Configure{HTML}{\HCode{<html>\Hnewline}}{\HCode{\Hnewline</html>}}
\Configure{@HEAD}{}
\Configure{@HEAD}{\HCode{<meta charset="UTF-8" />\Hnewline}}
\Configure{@HEAD}{\HCode{<link
rel="stylesheet" type="text/css"
href="\expandafter\csname aa:CssFile\endcsname" />\Hnewline}}
\DeclareGraphicsExtensions{.svg,.png,.pdf}
%see https://tex.stackexchange.com/questions/46156/pdf-image-files-and-htlatex
\Configure{graphics*}
{pdf}
{\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}
}
\begin{document}
\EndPreamble
Here comes the problem. If the PDF file contains more than page, then I use a loop to iterate over each page, using includegraphics to include each page. THis works with lualatex, but it stops working with make4ht. Here is a MWE, where now the pdf file all.pdf has 6 pages in it. And I want each page to show as an image.
\documentclass[11pt]{article}%
\usepackage{graphicx}
\usepackage{pgffor}
\begin{document}
%\pdfximage{all.pdf} %for pdflatex
\saveimageresource{all.pdf} %for lualatex
%\foreach \n in {1,...,\the\pdflastximagepages} %for pdflatex
\foreach \n in {1,...,\lastsavedimageresourcepages} % for lualatex
{
\ifdefined\HCode
\includegraphics[page=\n]{all.pdf}
\else
\noindent\makebox[\textwidth]{%
\includegraphics[width=1.3\textwidth,page=\n]{all}
}
\fi
}
\end{document}
The above compiles and works with lualatex foo.tex but when compiling with make4ht using same .cfg and same command as shown above, it does not work. No images are displayed in the HTML.
The strange thing, is that make4ht does actually generate .png image for each page successfully.

But the generated HTML code is not correctly including these pages

The HTML generated is
<!DOCTYPE html>
<html>
<head> <title></title>
<meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" href="foo.css" />
</head><body
>
<!--l. 8--><p class="noindent" >all.pdf <img
src="all.png" alt="pict"
/>
</p><!--l. 20--><p class="indent" > <img
src="all.png" alt="pict"
/>
</p>
</body>
</html>
But there is NO all.png file anywhere in the folder. That is why the HTML web page show the above. There are only all-0.png and all-1.png and so on files in the folder, generated from the loop above.
So the problem is that it works when the PDF contains only one page, but it does not work when the pdf file contains more than one page, even though make4ht did actually generate the png images for each page.
Question is: Is it possible to fix the HTML generated code to make it use the png images generated correctly?
If it helps, I've put a small zip file with all the above files. Here it is relax.zip
Using TL 2018