Skip to content

Commit e1ec18e

Browse files
use wkhtmltopdf
1 parent 574f5ac commit e1ec18e

File tree

2 files changed

+36
-40
lines changed

2 files changed

+36
-40
lines changed

docs/stylesheets/extra.css

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,26 @@
2121
}
2222

2323
@media print {
24-
.md-container {
25-
display: block;
26-
padding-top: 0;
27-
}
28-
29-
.md-main {
30-
display: block;
31-
height: inherit;
32-
}
33-
34-
.md-main__inner {
35-
height: inherit;
36-
padding-top: 0;
37-
}
3824

39-
.md-typeset .codehilitetable .linenos {
25+
/* disable menu */
26+
.md-md-header {
4027
display: none;
4128
}
4229

43-
.md-typeset .footnote-ref {
44-
display: inline-block;
45-
}
30+
/* disable scrollbar */
31+
.md-typeset__scrollwrap, .md-typeset table:not([class]), .md-typeset .md-typeset__table table, .md-container,
32+
.md-main, html {
33+
overflow-x: hidden;
34+
-webkit-overflow-scrolling: hidden
35+
}
4636

47-
.md-typeset .admonition {
48-
display: block;
37+
/* table-header-group leads to overlap with content */
38+
thead {
39+
display: table-row-group;
4940
}
5041

51-
.md-typeset a::after {
52-
color: inherit;
53-
content: none;
42+
tr {
43+
page-break-inside: avoid;
5444
}
5545

5646
h1 {
@@ -62,15 +52,3 @@
6252
}
6353
}
6454

65-
@page {
66-
size: A4;
67-
margin-top: 1.0cm;
68-
margin-right: 1.0cm;
69-
margin-bottom: 2.0cm;
70-
margin-left: 1.0cm;
71-
72-
@bottom-center {
73-
content: "Page " counter(page) " of " counter(pages);
74-
font-family: "Roboto","Helvetica Neue",Helvetica,Arial,sans-serif;
75-
}
76-
}

tools/genpdf-in-container.sh

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,40 @@ function write_text(){
2525

2626
function write_guidelines(){
2727
DIR=$1
28-
FIRST_HEADER=$2
28+
HEADER=$2
2929
for f in ${DATA_DIR}/docs/${DIR}/g-*.md
3030
do
3131
echo "" >> ${TARGET_DIR}/docs/index.md
32-
sed -e "s|# |${FIRST_HEADER} |g" $f >> ${TARGET_DIR}/docs/index.md
32+
sed -e "s|# |${HEADER} |g" $f >> ${TARGET_DIR}/docs/index.md
3333
done
3434
}
3535

36+
function get_version(){
37+
VERSION="$(grep site_version ${DATA_DIR}/mkdocs.yml | awk '{print $2}')"
38+
echo ${VERSION}
39+
}
40+
3641
function convert_to_pdf(){
3742
cd ${TARGET_DIR}
3843
mkdocs build
3944
cd site
40-
weasyprint index.html ${DATA_DIR}/plsql.pdf
45+
wkhtmltopdf --javascript-delay 3000 \
46+
--outline-depth 6 \
47+
--print-media-type \
48+
--margin-top 10 \
49+
--margin-right 10 \
50+
--margin-bottom 20 \
51+
--margin-left 10 \
52+
--footer-spacing 10 \
53+
--footer-font-name "Roboto" \
54+
--footer-font-size 8 \
55+
--footer-left "Version $(get_version)" \
56+
--footer-right "Page [page] of [topage]" \
57+
toc --toc-header-text "PL/SQL and SQL Coding Guidelines" \
58+
index.html ${DATA_DIR}/PLSQL-and-SQL-Coding-Guidelines.pdf
4159
}
4260

43-
DATA_DIR="$(cd "$(dirname "${0}")" && pwd)"
61+
DATA_DIR="$(cd "$(dirname "${0}")/.." && pwd)"
4462
TARGET_DIR=${DATA_DIR}/work-pdf
4563

4664
create_target_dir
@@ -70,4 +88,4 @@ write_file "5-complexity-analysis/complexity-analysis.md"
7088
write_file "6-code-reviews/code-reviews.md"
7189
write_file "7-tool-support/tool-support.md"
7290
write_file "9-appendix/appendix.md"
73-
#convert_to_pdf
91+
convert_to_pdf

0 commit comments

Comments
 (0)