CHM 或 HTML -> PDF,保留 HTML 链接?

发布于 2024-12-10 09:17:35 字数 312 浏览 0 评论 0原文

我们拥有专有的在线书籍/手册生成系统,可以从数据库创建编译的帮助文件 (CHM) 以及 HTML 版本的内容。

这工作得很好,我们已经使用该系统好几年了,没有进行重大修改。

现在,我们还想从同一来源生成 PDF。我看过一些 CHM 到 PDF 和 HTML 到 PDF 转换器,但我一直无法找到一个能够正确处理超链接的转换器,尽管这里已经多次提出类似的问题,但它并没有找到一个可以正确处理超链接的转换器。似乎没有人找到一个好的解决方案(或者至少他们没有费心发布任何有关它的信息)。

有什么建议吗?当该领域已经完成了如此多的工作时,我不想编写一个 PDF 生成器。

We have a proprietary on-line book/manual generation system that creates compiled help files (CHM) as well as HTML versions of content from a database.

This works very well, and we've been using the system without significant modifications for several years.

Now, we'd also like to generate PDFs from the same source. I've looked at a few CHM-to-PDF and HTML-to-PDF converters, but I haven't been able to find one that handles hyperlinks correctly and, despite the number of times similar questions have been asked here, it doesn't seem that anyone's found a good solution (or at least they haven't bothered to post any information about it).

Any suggestions? I'd hate to have to write a PDF generator when so much work has already been done in that area.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只为一人 2024-12-17 09:17:35

通常,您从抽象源生成所有这些。 HTML 作为一个标准是如此广泛,创建一个通用的 HTML 到非 html 的转换器是非常非常困难的,输入可能几乎是所有东西。 CHM 似乎与 MSIE 一样支持 HTML(阅读:很多)

因此,最明智的做法可能是确定用于实现基本格式的 HTML 子集,并尝试从中生成一些内容。考虑尝试通过编辑(批量替换)和脚本来简化 html,然后以最小的格式(并以某种抽象形式)提取大部分内容

用于一般情况 html 的转换器 -> 某些内容非常困难或不理想(想想将渲染内容的图片放入 PDF 中),因此您总是在谈论子集。

Usually you generate all of these from an abstract source. HTML as a standard is so expansive, it is very,very hard to create a generic HTML to something converter to something that isn't html, the input could be just about everything. And CHM seems to support HTML pretty much as far as MSIE does (read: a lot)

So probably the smartest thing is to determine the HTML subset you use to implement the base format, and try to generate something from that. Consider trying to simplify the html by editing (mass-replace) and scripts, and then extract the bulk of the content with minimal formatting (and in some abstract form)

A converter for a general case html->something is very hard or unoptimal (think putting pictures of rendered content in PDF), so you are always talking about subsets.

怪异←思 2024-12-17 09:17:35

我是一家将 html 转换为 pdf 的公司的合伙人:Docraptor。

这是一个我认为演示了超链接的“正确”处理的示例。也就是说,外部链接被发送到默认的网络浏览器,哈希链接跳转到PDF中“测试!”的相关位置。出现。您可以在此处查看此示例的 PDF 输出。

<html>
  <head>
    <style type="text/css">
      hr {page-break-after:always;}
    </style>
  <body>
    <a href="http://www.google.com">Google</a>
    <a href="#test">Test?</a>
    <hr />
    <h1 id="test">Test!</h1>
  </body>
</html>

此示例中的 hr 样式只是为了让我可以有两页文本,以便链接能够演示功能。

I am part owner in a business that converts html to pdf: Docraptor.

Here is an sample that I believe demonstrates "correct" handling of hyperlinks. That is, the external link is sent to the default web browser, and the hash link jumps to the relevant place in the PDF where “Test!” appears. You can check out the PDF output of this sample here.

<html>
  <head>
    <style type="text/css">
      hr {page-break-after:always;}
    </style>
  <body>
    <a href="http://www.google.com">Google</a>
    <a href="#test">Test?</a>
    <hr />
    <h1 id="test">Test!</h1>
  </body>
</html>

The hr style in this sample is just so I could have two pages of text so the link would demonstrate functionality.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文