Вопрос

I am combining the contents of multiple html files to produce a single PDF using wkhtmltopdf e.g.

wkhtmltopdf page1.html page2.html page3.html output.pdf

The generated PDF starts a new page after each of the html pages that I add. I want to be able to control this e.g. in the example above I might want a page break between page1 and page2, but not between page2 and page3. So the contents of page3 would be appended to page2. I know that I could achieve this by concatenating the html for pages 2 and 3 into a single html file before sending them to wkhtml2pdf. However I do not want to do this as I want to be able to pass page specific options for each page - particularly the option to exclude a particular page from the TOC and/or outline. So I might want to include the contents of page2 in the TOC/outline but exclude the contents of page3 from the TOC/outline.

How can I maintain the ability to pass options for each page but control which pages have breaks after/before?

Это было полезно?

Решение 2

I ended up buying the Essential Objects PDF components to enable me to achieve what I wanted. The work very well.

Другие советы

I don't think wkhtmltopdf has the ability to do what you're asking. You can use the PDFtk toolkit to get what you want. Take a look at the examples, and the documentation for cat argument.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top