shithub: neatpost

Download patch

ref: 3a912712527c7c749cdc090d0c66917ad116ddbc
parent: 91a48e11ca156dd5c8c5cd6a9401763c6aac7635
author: Ali Gholami Rudi <ali@rudi.ir>
date: Mon Jan 13 12:32:22 EST 2020

pdf: handle bookmarks that start from level one

--- a/pdf.c
+++ b/pdf.c
@@ -769,11 +769,11 @@
 	obj_beg(pdf_outline);
 	pdfout("<<\n");
 	for (i = 0; i < n; i++)
-		if (level[i] == 0)
+		if (level[i] == level[0])
 			cnt++;
 	pdfout("  /Count %d\n", cnt);
 	pdfout("  /First %d 0 R\n", objs[0]);
-	for (i = n - 1; i > 0 && level[i] > 0; i--)
+	for (i = n - 1; i > 0 && level[i] > level[0]; i--)
 		;
 	pdfout("  /Last %d 0 R\n", objs[i]);
 	pdfout(">>\n");