简体   繁体   English

使用Pechkin html到pdf创建目录

[英]create table of contents with Pechkin html to pdf

I'm currently working with the Pechkin library for creating pdf-files based on html. 我目前正在与Pechkin库一起使用,以基于html创建pdf文件。 It all works great. 一切都很好。

But I want to add one thing, a table of contents (TOC). 但我想添加一件事,即目录(TOC)。 But I can't get this working. 但是我无法正常工作。 With only wkhtmltopdf it's easy to do: 仅使用wkhtmltopdf即可轻松实现:

wkhtmltopdf toc --xsl-style-sheet toc.xsl index.html index.pdf

But with Pechkin it won't work. 但是使用Pechkin它将无法正常工作。 I have already a bookmark (which works in Adobe Reader), but it's not a real TOC what I want. 我已经有一个书签(可在Adobe Reader中使用),但我并不是真正的TOC。 I've tried to add 我尝试添加

ObjectConfig().SetTocXsl("tocXslStyleSheetUri")

But it seems to have no effect. 但这似乎没有效果。

I also tried to work with: 我还尝试与:

ObjectConfig().SetCreateToc(true);

This will create an empty pdf because this function is obsolete. 这将创建一个空的pdf,因为此功能已过时。

So I get a nice pdf-result, but only without a Table of Content. 因此,我得到了一个不错的pdf结果,但没有目录。 Does anyone of you know how I get the TOC appear in my pdf-file? 你们中有人知道我的TOC如何出现在我的pdf文件中吗?

I also asked this question as an issue on github, but because they're not always that quick with reacting, or doesn't react at all, I also asked the question here. 我在github上也把这个问题当作一个问题,但是因为他们的反应并不总是那么快,或者根本没有反应,所以我也在这里问了这个问题。

What if you create the table of contents on a seperate page and give its url to the ObjectConfig object . 如果您在单独的页面上创建目录并将其网址提供给ObjectConfig对象,该怎么办? I can show you the code if required. 如果需要,我可以向您显示代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM