git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[Patch 5/5] Create pdf from all html files

From
Thomas Ackermann <th.acker66@arcor.de>
Date
Oct 6, 2012, 15:58 UTC
Message-ID
<1206625172.269796.1349539081024.JavaMail.ngmail@webmail08.arcor-online.net>
In-Reply-To
<505841759.269631.1349538675925.JavaMail.ngmail@webmail08.arcor-online.net>
- use wkhtmltopdf to combine all html files into a single pdf file "git-doc.pdf"
- provide make target "fullpdf" to create "git-doc.pdf"
Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
---
 Documentation/.gitignore      |  1 +
 Documentation/Makefile        |  9 +++++++++
 Documentation/footerend.txt   |  4 ++++
 Documentation/footerstart.txt |  7 +++++++
 Documentation/makedocpdf.sh   | 25 +++++++++++++++++++++++++
 Makefile                      |  6 ++++++
 6 files changed, 52 insertions(+)
 create mode 100644 Documentation/footerend.txt
 create mode 100644 Documentation/footerstart.txt
 create mode 100644 Documentation/makedocpdf.sh
diff --git a/Documentation/.gitignore b/Documentation/.gitignore
index d62aebd..fba4730 100644
--- a/Documentation/.gitignore
+++ b/Documentation/.gitignore
@@ -10,3 +10,4 @@ howto-index.txt
 doc.dep
 cmds-*.txt
 manpage-base-url.xsl
+docfiles.txt
diff --git a/Documentation/Makefile b/Documentation/Makefile
index abd27b5..c4c2a30 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -189,6 +189,9 @@ info: git.info gitman.info
 
 pdf: user-manual.pdf
 
+fullpdf: pdf all
+	./makedocpdf.sh
+
 install: install-man
 
 install-man: man
@@ -213,6 +216,10 @@ install-pdf: pdf
 	$(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
 	$(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir)
 
+install-fullpdf: fullpdf install-pdf
+	$(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir)
+	$(INSTALL) -m 644 git-doc.pdf $(DESTDIR)$(pdfdir)
+
 install-html: html
 	'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
 
@@ -252,6 +259,8 @@ clean:
 	$(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
 	$(RM) *.texi *.texi+ *.texi++ git.info gitman.info
 	$(RM) *.pdf
+	$(RM) docfiles.txt
+	$(RM) RelNotes/*.html
 	$(RM) howto-index.txt howto/*.html doc.dep
 	$(RM) technical/*.html technical/api-index.txt
 	$(RM) $(cmds_txt) *.made
diff --git a/Documentation/footerend.txt b/Documentation/footerend.txt
new file mode 100644
index 0000000..ed16923
--- /dev/null
+++ b/Documentation/footerend.txt
@@ -0,0 +1,4 @@
+    </td>
+  </tr>
+</table>
+</body></html>
diff --git a/Documentation/footerstart.txt b/Documentation/footerstart.txt
new file mode 100644
index 0000000..a2746ef
--- /dev/null
+++ b/Documentation/footerstart.txt
@@ -0,0 +1,7 @@
+<html>
+<head></head>
+<body style="border:0; margin: 0;" onload="subst()">
+<table style="border-top: 1px solid black; width: 100%">
+  <tr>
+    <td class="section"></td>
+    <td style="text-align:center">
diff --git a/Documentation/makedocpdf.sh b/Documentation/makedocpdf.sh
new file mode 100644
index 0000000..fd9f5bb
--- /dev/null
+++ b/Documentation/makedocpdf.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+rm -f git-doc.pdf
+
+cat /dev/null >docfiles.txt
+
+ls gittutorial.html      >>docfiles.txt
+ls gittutorial-2.html    >>docfiles.txt
+ls everyday.html         >>docfiles.txt
+ls gitworkflows.html     >>docfiles.txt
+ls git-*.html            >>docfiles.txt
+ls git[acdghikmnr]*.html >>docfiles.txt
+ls gitweb*.html          >>docfiles.txt
+ls howto-index.html      >>docfiles.txt
+ls howto/*.html          >>docfiles.txt
+ls technical/*.html      >>docfiles.txt
+ls RelNotes/*.html       >>docfiles.txt
+
+cat /dev/null >footer.html
+
+cat footerstart.txt      >>footer.html
+cat ../GIT-VERSION-FILE  >>footer.html
+cat footerend.txt        >> footer.html
+
+cat docfiles.txt | xargs cat | wkhtmltopdf --book --footer-html footer.html --disable-external-links - git-doc.pdf
diff --git a/Makefile b/Makefile
index 8413606..2ddb3c9 100644
--- a/Makefile
+++ b/Makefile
@@ -2485,6 +2485,9 @@ info:
 pdf:
 	$(MAKE) -C Documentation pdf
 
+fullpdf:
+	$(MAKE) -C Documentation fullpdf
+
 XGETTEXT_FLAGS = \
 	--force-po \
 	--add-comments \
@@ -2796,6 +2799,9 @@ install-info:
 install-pdf:
 	$(MAKE) -C Documentation install-pdf
 
+install-fullpdf:
+	$(MAKE) -C Documentation install-fullpdf
+
 quick-install-doc:
 	$(MAKE) -C Documentation quick-install
 
-- 
1.7.11.msysgit.1
Previous: Thomas AckermannNext: Jeff King
Message 15 of 23 in “Create single PDF for all HTML files”
  1. 0/5 Create single PDF for all HTML filesThomas Ackermann, Oct 6, 2012
  2. 1/5 Fix some asciidoc layout problemsThomas Ackermann, Oct 6, 2012
  3. Junio C HamanoOct 6, 2012
  4. Jeff KingOct 6, 2012
  5. Aw: Re: [Patch 1/5] Fix some asciidoc layout problemsThomas Ackermann, Oct 7, 2012
  6. 2/5 Create html documents for all files in Documentation/technicalThomas Ackermann, Oct 6, 2012
  7. Philip OakleyOct 6, 2012
  8. 3/5 Create html documents for all files in Documentation/RelNotesThomas Ackermann, Oct 6, 2012
  9. Philip OakleyOct 6, 2012
  10. Jeff KingOct 6, 2012
  11. Junio C HamanoOct 7, 2012
  12. Michael J GruberOct 15, 2012
  13. Junio C HamanoOct 15, 2012
  14. 4/5 Create html documents for all files in Documentation/howtoThomas Ackermann, Oct 6, 2012
  15. 5/5 Create pdf from all html filesThomas Ackermann, Oct 6, 2012
  16. Jeff KingOct 6, 2012
  17. Jeff KingOct 6, 2012
  18. Aw: Re: [Patch 0/5] Create single PDF for all HTML filesThomas Ackermann, Oct 7, 2012
  19. Jeff KingOct 7, 2012
  20. Michael J GruberOct 15, 2012
  21. Jeff KingOct 15, 2012
  22. Philip OakleyOct 8, 2012
  23. Junio C HamanoOct 7, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.