[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Convert html (WebBook) to PDF?
- From: sur-behoffski <sur_behoffski@...>
- Date: Wed, 15 Sep 2021 20:06:52 +0930
G'day,
I'm using the IM, CD and IUP PDF documentation (in WebBook form) to
help me exercise code.
However, while HTML file tree (e.g. with "../drv/pptx.c" relative paths)
works well on both the online and downloadable-HTML versions, the PDF
version chokes badly on filesystem-hierarchy links, e.g. (for a
mythical user "x"):
../func/init.html#cdCreateCanvas
generates an error:
Unable to run the command specified. The file or folder /home/x/func/init.html does not exist.
I'm currently in a very-high-latency chat (roughly 3-day round-trip
for a request/response exchange) with Antonio Scuri about one
approach to this: Very briefly (just the portion of URLs that we are
transforming here):
URL = "../func/init.html#cdCreateCanvas"
Path, Target = URL:match("([^#]*)(#.*)")
Path = MakeCanonicalPath(Path)
Sha1sum = sha1sum.sum(Path)
FlattenedURL = Sha1sum .. Target
--
This message is brought on by a desire to explore an alternative
approach, where I do note use "wkhtmltopdf", which appears to be
unsupported, but to parse the documents directly, and perform the
same hash-based URL edits along the way.
Trouble is, I don't know enough about HTML (XHTML? XML? ...?)
parsers for Lua (perhaps a C library delivered by LuaRocks).
I've tried using "luaexpat", but while it works on trivial files,
I cannot get any output from the top-level CD WebBook "doc/index.html"
file.
Any help/pointers would be gratefully received.
Thanks in advance for your consideration,
sur-behoffski (Brenton Hoff)
programmer, Grouse Software