浏览代码

Add example for adding ToC option

Oren Cohen 7 年之前
父节点
当前提交
3b2110aad6
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      README.md

+ 4 - 1
README.md

@@ -53,7 +53,7 @@ Pdf pdf = new Pdf();
 pdf.addPageFromString("<html><head><meta charset=\"utf-8\"></head><h1>Müller</h1></html>");
 pdf.addPageFromUrl("http://www.google.com");
 
-// Add a Table of contents
+// Add a Table of Contents
 pdf.addToc();
 
 // The `wkhtmltopdf` shell command accepts different types of options such as global, page, headers and footers, and toc. Please see `wkhtmltopdf -H` for a full explanation.
@@ -61,6 +61,9 @@ pdf.addToc();
 pdf.addParam(new Param("--no-footer-line"), new Param("--header-html", "file:///header.html"));
 pdf.addParam(new Param("--enable-javascript"));
 
+// Add styling for Table of Contents
+pdf.addTocParam(new Param("--xsl-style-sheet", "my_toc.xsl"));
+
 // Save the PDF
 pdf.saveAs("output.pdf");
 ```