diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-01-23 11:02:16 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2018-01-23 22:15:01 +0000 |
commit | 787b93fd071e1537b33e8d2f894bbc3cc0ed5595 (patch) | |
tree | 8fac31366ccc4a0789e85d5e695fa63e7169d795 | |
parent | 6605d844afa3d804da89970ee46845cfa986994b (diff) | |
download | wireshark-787b93fd071e1537b33e8d2f894bbc3cc0ed5595.tar.gz wireshark-787b93fd071e1537b33e8d2f894bbc3cc0ed5595.tar.bz2 wireshark-787b93fd071e1537b33e8d2f894bbc3cc0ed5595.zip |
Docbook: Generate one PDF paper size.
Generate a single PA4-sized PDF. PA4 is the approximate intersection of
A4 and Letter[1]. This gives us one less file to build and distribute.
If you're printing out hard copies of the guides this wastes a few pages
compared to an A4-sized PDF, but if you're printing out hard copies of
the guides you've already made a strong commitment to waste paper.
Page counts:
Guide Size Pages
WSDG A4 203
WSDG Letter 217
WSDG PA4 217
WSUG A4 192
WSUG Letter 204
WSUG PA4 205
[1] https://en.wikipedia.org/wiki/Paper_size#PA4_or_L4
Change-Id: If43d4b19947c77a51b3943a2b329dbab45025d79
Reviewed-on: https://code.wireshark.org/review/25438
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r-- | cmake/modules/FindXSLTPROC.cmake | 5 | ||||
-rw-r--r-- | docbook/CMakeLists.txt | 69 | ||||
-rw-r--r-- | docbook/Makefile.am | 63 | ||||
-rw-r--r-- | docbook/custom_layer_pdf.xsl | 10 |
4 files changed, 34 insertions, 113 deletions
diff --git a/cmake/modules/FindXSLTPROC.cmake b/cmake/modules/FindXSLTPROC.cmake index 7ca119e56d..62d71af846 100644 --- a/cmake/modules/FindXSLTPROC.cmake +++ b/cmake/modules/FindXSLTPROC.cmake @@ -173,7 +173,7 @@ ENDMACRO(XML2HTML) # custom_layer_pdf.xsl # A4 or letter #) -MACRO(XML2PDF _target_dep _output _dbk_source _stylesheet _paper) +MACRO(XML2PDF _target_dep _output _dbk_source _stylesheet) # We depend on the docbook target to avoid parallel builds. SET(_dbk_dep ${_target_dep}_docbook) file(RELATIVE_PATH _img_relative_path ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) @@ -184,12 +184,9 @@ MACRO(XML2PDF _target_dep _output _dbk_source _stylesheet _paper) ${_output}.fo COMMAND ${XSLTPROC_EXECUTABLE} --path "${_xsltproc_path}" - --stringparam paper.type ${_paper} --stringparam img.src.path ${_img_relative_path}/ --stringparam use.id.as.filename 1 - --stringparam admon.graphics 1 --stringparam admon.graphics.path ${_img_relative_path}/common_graphics/ - --stringparam admon.graphics.extension .svg --nonet --output ${_output}.fo ${_stylesheet} diff --git a/docbook/CMakeLists.txt b/docbook/CMakeLists.txt index bfde3c0019..18f38b3b2c 100644 --- a/docbook/CMakeLists.txt +++ b/docbook/CMakeLists.txt @@ -428,39 +428,22 @@ endif() if(ENABLE_PDF_GUIDES) # To do: - # - Merge A4 and letter into the smallest dimension of each format. - # Use --stringparam page.height <letter-height>mm --stringparam page.width <at-width>mm - # Test the effect of this on letter and a4 printers first (ps and non-ps). - # - Generate PDFs using AsciiDoc. + # - Generate PDFs using AsciiDoctor. XML2PDF( user_guide - user-guide-a4.pdf + user-guide.pdf user-guide.xml custom_layer_pdf.xsl - A4 ) - XML2PDF( - user_guide - user-guide-us.pdf - user-guide.xml - custom_layer_pdf.xsl - letter - ) add_custom_target( - user_guide_pdf_a4 + user_guide_pdf DEPENDS - user-guide-a4.pdf + user-guide.pdf ) - set_target_properties(user_guide_pdf_a4 PROPERTIES FOLDER "Docbook") - add_custom_target( - user_guide_pdf_us - DEPENDS - user-guide-us.pdf - ) - set_target_properties(user_guide_pdf_us PROPERTIES FOLDER "Docbook") - add_dependencies(user_guides user_guide_pdf_a4 user_guide_pdf_us) + set_target_properties(user_guide_pdf PROPERTIES FOLDER "Docbook") + add_dependencies(user_guides user_guide_pdf) endif() if(ENABLE_CHM_GUIDES) @@ -505,32 +488,18 @@ endif() if(ENABLE_PDF_GUIDES) XML2PDF( developer_guide - developer-guide-a4.pdf + developer-guide.pdf developer-guide.xml custom_layer_pdf.xsl - A4 ) - XML2PDF( - developer_guide - developer-guide-us.pdf - developer-guide.xml - custom_layer_pdf.xsl - letter - ) add_custom_target( - developer_guide_pdf_a4 + developer_guide_pdf DEPENDS - developer-guide-a4.pdf + developer-guide.pdf ) - set_target_properties(developer_guide_pdf_a4 PROPERTIES FOLDER "Docbook") - add_custom_target( - developer_guide_pdf_us - DEPENDS - developer-guide-us.pdf - ) - set_target_properties(developer_guide_pdf_us PROPERTIES FOLDER "Docbook") - add_dependencies(developer_guides developer_guide_pdf_a4 developer_guide_pdf_us) + set_target_properties(developer_guide_pdf PROPERTIES FOLDER "Docbook") + add_dependencies(developer_guides developer_guide_pdf) endif() if(ENABLE_CHM_GUIDES) @@ -545,7 +514,7 @@ if(ENABLE_CHM_GUIDES) add_dependencies(developer_guides developer_guide_chm) endif() -# release_notes: release-notes.html release-notes.txt release-notes-a4.pdf release-notes-us.pdf +# release_notes: release-notes.html release-notes.txt add_custom_target( release_notes_html DEPENDS ws.css release-notes.html ) set_target_properties(release_notes_html PROPERTIES FOLDER "Docbook") @@ -583,20 +552,6 @@ if( ASCIIDOC_FOUND ) ) endif() -#ASCIIDOC2PDF( -# release-notes-a4.pdf -# release-notes.asciidoc -# "${ASCIIDOC_CONF_FILES}" -# A4 -#) - -#ASCIIDOC2PDF( -# release-notes-us.pdf -# release-notes.asciidoc -# "${ASCIIDOC_CONF_FILES}" -# letter -#) - # # Editor modelines - http://www.wireshark.org/tools/modelines.html # diff --git a/docbook/Makefile.am b/docbook/Makefile.am index c4af2096d4..08093f977e 100644 --- a/docbook/Makefile.am +++ b/docbook/Makefile.am @@ -370,12 +370,12 @@ all-local: $(docbook_all_local_targets) all-html: wsug wsdg release-notes -all-pdf: wsug-pdf wsdg-pdf release-notes-pdf +all-pdf: wsug-pdf wsdg-pdf # Wireshark User Guide wsug: wsug_html_chunked wsug_html -wsug-pdf: wsug user-guide-a4.pdf user-guide-us.pdf +wsug-pdf: wsug user-guide.pdf user-guide.xml: user-guide.asciidoc $(WSUG_FILES) $(WSUG_TOOLS_HELP_FILES) $(A2X) --verbose \ @@ -414,19 +414,11 @@ wsug_html_chunked/index.html: $(WSUG_SOURCE) $(WSUG_XSLTPROC_ARGS) $(CHUNKED_XSLTPROC_ARGS) $< -chmod -R og+rX wsug_html_chunked -# create pdf file (through XSL-FO), portrait pages on US letter paper -# you will get lot's of errors, but that's ok -user-guide-us.fo: $(WSUG_SOURCE) custom_layer_pdf.xsl - @ echo --- WSUG - PDF US PAPER --- - $(XSLTPROC) --stringparam paper.type letter \ - $(COMMON_XSLTPROC_ARGS) $(WSUG_PDF_XSLTPROC_ARGS) \ - --nonet $(srcdir)/custom_layer_pdf.xsl $< > $@ - -# create pdf file (through XSL-FO), portrait pages on A4 paper -# you will get lot's of errors, but that's ok -user-guide-a4.fo: $(WSUG_SOURCE) custom_layer_pdf.xsl - @ echo --- WSUG - PDF A4 PAPER --- - $(XSLTPROC) --stringparam paper.type A4 \ +# create pdf file (through XSL-FO), portrait pages on PA4 (210 x 280 mm) "paper" +# you will get lots of errors, but that's ok +user-guide.fo: $(WSUG_SOURCE) custom_layer_pdf.xsl + @ echo --- WSUG - PDF PA4 PAPER --- + $(XSLTPROC) \ $(COMMON_XSLTPROC_ARGS) $(WSUG_PDF_XSLTPROC_ARGS) \ --nonet $(srcdir)/custom_layer_pdf.xsl $< > $@ @@ -439,7 +431,7 @@ wsluarm: make-wsluarm.pl $(WSLUA_MODULES) # Wireshark Developer Guide wsdg: wsdg_html_chunked wsdg_html -wsdg-pdf: wsdg developer-guide-a4.pdf developer-guide-us.pdf +wsdg-pdf: wsdg developer-guide.pdf developer-guide.xml: developer-guide.asciidoc $(WSDG_FILES) wsluarm $(A2X) --verbose \ @@ -481,20 +473,11 @@ wsdg_html_chunked/index.html: $(WSDG_SOURCE) $(WSDG_XSLTPROC_ARGS) $(CHUNKED_XSLTPROC_ARGS) $< -chmod -R og+rX wsdg_html_chunked -# create pdf file (through XSL-FO), portrait pages on US letter paper +# create pdf file (through XSL-FO), portrait pages on PA4 (210 x 280 mm) "paper" # you will get lot's of errors, but that's ok -developer-guide-us.fo: $(WSDG_SOURCE) custom_layer_pdf.xsl - @ echo --- WSDG - PDF US PAPER --- - $(XSLTPROC) --stringparam paper.type letter \ - $(COMMON_XSLTPROC_ARGS) $(WSDG_PDF_XSLTPROC_ARGS) \ - --path .:wsluarm_src:$(srcdir) \ - --nonet $(srcdir)/custom_layer_pdf.xsl $< > $@ - -# create pdf file (through XSL-FO), portrait pages on A4 paper -# you will get lot's of errors, but that's ok -developer-guide-a4.fo: $(WSDG_SOURCE) custom_layer_pdf.xsl - @ echo --- WSDG - PDF A4 PAPER --- - $(XSLTPROC) --stringparam paper.type A4 \ +developer-guide.fo: $(WSDG_SOURCE) custom_layer_pdf.xsl + @ echo --- WSDG - PDF PA4 PAPER --- + $(XSLTPROC) \ $(COMMON_XSLTPROC_ARGS) $(WSDG_PDF_XSLTPROC_ARGS) \ --path .:wsluarm_src:$(srcdir) \ --nonet $(srcdir)/custom_layer_pdf.xsl $< > $@ @@ -506,8 +489,6 @@ else release-notes: release-notes.html endif -release-notes-pdf: release-notes release-notes-a4.pdf release-notes-us.pdf - # create html single page file release-notes.html: $(RELEASE_NOTES_SOURCE) @ echo --- RELEASE NOTES - HTML --- @@ -528,26 +509,6 @@ news: release-notes.txt cp release-notes.txt ../NEWS -cp release-notes.txt $(top_srcdir)/NEWS -# Apparently we can only run one instance of a2x at a time. -.NOTPARALLEL: release-notes-us.pdf release-notes-a4.pdf -# create pdf file, portrait pages on US letter paper -release-notes-us.pdf: $(RELEASE_NOTES_SOURCE) custom_layer_pdf.xsl - @ echo --- RELEASE NOTES - PDF US LETTER PAPER --- - $(A2X) --format=pdf $(A2X_HTML_OPTS) --fop \ - --xsltproc-opts "--stringparam paper.type letter --nonet" \ - --xsl-file=$(srcdir)/custom_layer_pdf.xsl \ - --destination-dir=$(builddir) \ - $(srcdir)/release-notes.asciidoc - -# create pdf file, portrait pages on A4 paper -release-notes-a4.pdf: $(RELEASE_NOTES_SOURCE) custom_layer_pdf.xsl - @ echo --- RELEASE NOTES - PDF A4 PAPER --- - $(A2X) --format=pdf $(A2X_HTML_OPTS) --fop \ - --xsltproc-opts "--stringparam paper.type A4 --nonet" \ - --xsl-file=$(srcdir)/custom_layer_pdf.xsl \ - --destination-dir=$(builddir) \ - $(srcdir)/release-notes.asciidoc - install-data-local: if BUILD_USER_GUIDE $(MKDIR_P) $(DESTDIR)$(docdir)/guides diff --git a/docbook/custom_layer_pdf.xsl b/docbook/custom_layer_pdf.xsl index 1a3a7355e7..94a6512309 100644 --- a/docbook/custom_layer_pdf.xsl +++ b/docbook/custom_layer_pdf.xsl @@ -5,8 +5,16 @@ <!-- import the main stylesheet --> <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/> +<!-- page size --> +<!-- Create PA4 (210 × 280mm) pages: https://en.wikipedia.org/wiki/Paper_size#PA4_or_L4 + This is the approximate intersection of A4 (210 × 297mm) and U.S. + Letter (216 × 279mm). +--> +<xsl:param name="paper.type">PA4</xsl:param> +<xsl:param name="page.width.portrait">210mm</xsl:param> +<xsl:param name="page.height.portrait">280mm</xsl:param> + <!-- create pdf bookmarks --> -<!-- Disable this since FOP 0.93 doesn't handle them, yet --> <xsl:param name="fop1.extensions" select="1"/> <!-- don't use the draft mode (no loading of image from the web) --> |