Skip to content

Commit 37123aa

Browse files
committedMar 29, 2018
PDFBOX-3330: add new template for documentation; auto generate toc for documentation
1 parent 386f163 commit 37123aa

File tree

10 files changed

+235
-55
lines changed

10 files changed

+235
-55
lines changed
 

‎content/2.0/commandline.md

+1-15
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
1616
specific language governing permissions and limitations
1717
under the License.
1818

19-
layout: default
19+
layout: documentation
2020
title: Command-Line Tools
2121
---
2222

@@ -27,20 +27,6 @@ PDFBox comes with a series of command-line utilities. They are available as stan
2727
See the [Dependencies](/2.0/dependencies.html) page for instructions on how to set your classpath in order to run
2828
PDFBox tools as Java applications.
2929

30-
**Table of Contents**
31-
- [Decrypt](#decrypt)
32-
- [Encrypt](#encrypt)
33-
- [ExtractImages](#extractimages)
34-
- [ExtractText](#extracttext)
35-
- [OverlayPDF](#overlaypdf)
36-
- [PDFDebugger](#pdfdebugger)
37-
- [PDFMerger](#pdfmerger)
38-
- [PDFSplit](#pdfsplit)
39-
- [PDFToImage](#pdftoimage)
40-
- [PrintPDF](#printpdf)
41-
- [TextToPDF](#texttopdf)
42-
- [WriteDecodedDoc](#writedecodeddoc)
43-
4430
## Decrypt ##
4531

4632
This application will decrypt a PDF document.

‎content/2.0/cookbook/encryption.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
1616
specific language governing permissions and limitations
1717
under the License.
1818

19-
layout: default
19+
layout: documentation
2020
title: Cookbook - Encrypting a File
2121
---
2222

‎content/2.0/dependencies.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
1616
specific language governing permissions and limitations
1717
under the License.
1818

19-
layout: default
19+
layout: documentation
2020
title: Dependencies
2121
---
2222

‎content/2.0/examples.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
1616
specific language governing permissions and limitations
1717
under the License.
1818

19-
layout: default
19+
layout: documentation
2020
title: Examples
2121
---
2222

‎content/2.0/faq.md

+1-30
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,12 @@ license: Licensed to the Apache Software Foundation (ASF) under one
1616
specific language governing permissions and limitations
1717
under the License.
1818

19-
layout: default
19+
layout: documentation
2020
title: Frequently Asked Questions (FAQ)
2121
---
2222

2323
# Frequently Asked Questions
2424

25-
### General Questions
26-
27-
- [I am getting the below Log4J warning message, how do I remove it?](#log4j)
28-
- [Is PDFBox thread safe?](#threadsafe)
29-
- [Why do I get a "Warning: You did not close the PDF Document"?](#notclosed)
30-
31-
### Font Handling
32-
33-
- [I'm getting java.lang.IllegalArgumentException: ... is not available in this font's encoding: WinAnsiEncoding](#fontencoding)
34-
35-
### PDF Creation
36-
37-
- [I'm creating a PDF but my page is empty. Why?](#emptypage)
38-
39-
### Text Extraction
40-
41-
- [Why does the extracted text appear in the wrong sequence?](#textorder)
42-
- [How come I am not getting any text from the PDF document?](#notext)
43-
- [How come I am getting gibberish(G38G43G36G51G5) when extracting text?](#gibberish)
44-
- [What does "java.io.IOException: Can't handle font width" mean?](#fontwidth)
45-
- [Why do I get "You do not have permission to extract text" on some documents?](#permission)
46-
- [Can't we just extract the text without parsing the whole document or extract text as it is parsed?](#partially)
47-
48-
### PDF Rendering
49-
50-
- [I'm getting an OutOfMemoryError. What can I do?](#outofmemoryerror)
51-
- [A drop shadow is missing or at the wrong position when rendering a page](#dropshadow)
52-
- [Why are some texts in poor quality and not antialiased?](#textantialias)
53-
5425
## General Questions
5526

5627
<a name="log4j"></a>

‎content/2.0/getting-started.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
1616
specific language governing permissions and limitations
1717
under the License.
1818

19-
layout: default
19+
layout: documentation
2020
title: Getting Started
2121
---
2222

@@ -53,6 +53,8 @@ https://bugs.openjdk.java.net/browse/JDK-8041125
5353

5454
PDFBox 2.0.4 introduced a new command line setting
5555

56-
``-Dorg.apache.pdfbox.rendering.UsePureJavaCMYKConversion=true``
56+
```
57+
-Dorg.apache.pdfbox.rendering.UsePureJavaCMYKConversion=true
58+
```
5759

5860
which may improve the performance of rendering PDFs on some systems especially if there are a lot of images on a page.

‎content/2.0/migration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ license: Licensed to the Apache Software Foundation (ASF) under one
1616
specific language governing permissions and limitations
1717
under the License.
1818

19-
layout: default
19+
layout: documentation
2020
title: PDFBox 2.0.0 Migration Guide
2121
---
2222

‎content/_includes/toc.html

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{% capture tocWorkspace %}
2+
{% comment %}
3+
Version 1.0.4
4+
https://github.com/allejo/jekyll-toc
5+
6+
"...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe
7+
8+
Usage:
9+
{% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %}
10+
11+
Parameters:
12+
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
13+
14+
Optional Parameters:
15+
* sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
16+
* class (string) : '' - a CSS class assigned to the TOC
17+
* id (string) : '' - an ID to assigned to the TOC
18+
* h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
19+
* h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
20+
* ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list
21+
* item_class (string) : '' - add custom class for each list item; has support for '%level%' placeholder, which is the current heading level
22+
23+
Output:
24+
An ordered or unordered list representing the table of contents of a markdown block. This snippet will only generate the table of contents and will NOT output the markdown given to it
25+
{% endcomment %}
26+
27+
{% capture my_toc %}{% endcapture %}
28+
{% assign orderedList = include.ordered | default: false %}
29+
{% assign minHeader = include.h_min | default: 1 %}
30+
{% assign maxHeader = include.h_max | default: 6 %}
31+
{% assign nodes = include.html | split: '<h' %}
32+
{% assign firstHeader = true %}
33+
34+
{% capture listModifier %}{% if orderedList %}1.{% else %}-{% endif %}{% endcapture %}
35+
36+
{% for node in nodes %}
37+
{% if node == "" %}
38+
{% continue %}
39+
{% endif %}
40+
41+
{% assign headerLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}
42+
43+
{% if headerLevel < minHeader or headerLevel > maxHeader %}
44+
{% continue %}
45+
{% endif %}
46+
47+
{% if firstHeader %}
48+
{% assign firstHeader = false %}
49+
{% assign minHeader = headerLevel %}
50+
{% endif %}
51+
52+
{% assign indentAmount = headerLevel | minus: minHeader | add: 1 %}
53+
{% assign _workspace = node | split: '</h' %}
54+
55+
{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
56+
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
57+
{% assign html_id = _idWorkspace[0] %}
58+
59+
{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
60+
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
61+
62+
{% assign space = '' %}
63+
{% for i in (1..indentAmount) %}
64+
{% assign space = space | prepend: ' ' %}
65+
{% endfor %}
66+
67+
{% unless include.item_class == blank %}
68+
{% capture listItemClass %}{:.{{ include.item_class | replace: '%level%', headerLevel }}}{% endcapture %}
69+
{% endunless %}
70+
71+
{% capture my_toc %}{{ my_toc }}
72+
{{ space }}{{ listModifier }} {{ listItemClass }} [{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}](#{{ html_id }}){% endcapture %}
73+
74+
{% endfor %}
75+
76+
{% if include.class %}
77+
{% capture my_toc %}{:.{{ include.class }}}
78+
{{ my_toc | lstrip }}{% endcapture %}
79+
{% endif %}
80+
81+
{% if include.id %}
82+
{% capture my_toc %}{: #{{ include.id }}}
83+
{{ my_toc | lstrip }}{% endcapture %}
84+
{% endif %}
85+
{% endcapture %}{% assign tocWorkspace = '' %}{{ my_toc | markdownify | strip }}

‎content/_layouts/documentation.html

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<!--
5+
6+
Licensed to the Apache Software Foundation (ASF) under one or more
7+
contributor license agreements. See the NOTICE file distributed with
8+
this work for additional information regarding copyright ownership.
9+
The ASF licenses this file to You under the Apache License, Version 2.0
10+
(the "License"); you may not use this file except in compliance with
11+
the License. You may obtain a copy of the License at
12+
13+
http://www.apache.org/licenses/LICENSE- 2.0
14+
15+
Unless required by applicable law or agreed to in writing, software
16+
distributed under the License is distributed on an "AS IS" BASIS,
17+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
See the License for the specific language governing permissions and
19+
limitations under the License.
20+
-->
21+
22+
{% include head.html %}
23+
24+
<body>
25+
26+
{% include header.html %}
27+
28+
<div class="container documentation">
29+
<nav>
30+
<h1>Documentation</h1>
31+
<ul>
32+
<li><a href="/2.0/migration.html">Migration Guide</a></li>
33+
<li><a href="/2.0/getting-started.html">Getting Started</a></li>
34+
<li><a href="/2.0/examples.html">Examples</a></li>
35+
<li><a href="/2.0/dependencies.html">Dependencies</a></li>
36+
<li class="sidebar-node" id="v2-0-cookbook">
37+
<a href="#">Cookbook</a>
38+
<ul>
39+
<li><a href="/2.0/cookbook/encryption.html">Document Encryption</a></li>
40+
</ul>
41+
</li>
42+
<li><a href="/2.0/commandline.html">Command-Line Tools</a></li>
43+
<li><a href="/2.0/faq.html">FAQ</a></li>
44+
<li><a href="/docs/2.0.8/javadocs/">API Docs</a></li>
45+
</nav>
46+
<section>
47+
{{ content }}
48+
</section>
49+
<aside>
50+
<h1>Table of Contents</h1>
51+
{% include toc.html html=content h_min=2 h_max=3 %}
52+
</aside>
53+
</div>
54+
55+
{% include footer.html %}
56+
{% include footer_scripts.html %}
57+
58+
</body>
59+
60+
</html>

‎content/css/site.css

+80-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ body {
3333
}
3434

3535
body > .container {
36-
padding-top: 20px;
36+
padding-top: 5rem;
3737
}
3838

3939
.main-header {
@@ -168,9 +168,7 @@ code {
168168
* Default styling for the tables copied over from bootstrap
169169
* to get basic styling for tables created through markdown
170170
*/
171-
table {
172-
width: 100%;
173-
}
171+
174172

175173
table th, table td {
176174
padding: 8px;
@@ -249,6 +247,84 @@ table tr:nth-child(even) td, table tr.even td {
249247
content: url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='#0088cc' d='M1.5 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z' transform='translate(1)' /%3E%3C/svg%3E");
250248
}
251249

250+
.documentation {
251+
display: flex;
252+
}
253+
254+
.documentation section h1, .documentation section h2,
255+
.documentation section h3, .documentation section h4,
256+
.documentation section ul,
257+
.documentation section p {
258+
padding-left: 3rem;
259+
padding-right: 1rem;
260+
}
261+
262+
.documentation section table {
263+
margin-left: 3rem;
264+
margin-right: 1rem;
265+
}
266+
267+
.documentation section ul {
268+
padding-left: 5rem;
269+
}
270+
271+
.documentation nav {
272+
min-width: 25rem;
273+
box-shadow: 1px 0 0 rgba(81,88,90,0.17);
274+
}
275+
276+
.documentation nav h1 {
277+
font-size: 1.2rem;
278+
text-transform: uppercase;
279+
}
280+
281+
.documentation nav ul {
282+
list-style: none;
283+
}
284+
285+
.documentation nav > ul {
286+
list-style: none;
287+
padding: 0;
288+
}
289+
290+
.documentation nav li a {
291+
padding: .20em 15px;
292+
}
293+
294+
.documentation nav li a:hover, .documentation nav li a:focus {
295+
background-color: #eee;
296+
text-decoration: none;
297+
}
298+
299+
.documentation aside {
300+
min-width: 22rem;
301+
max-width: 22rem;
302+
padding-left: 2rem;
303+
}
304+
305+
.documentation aside h1 {
306+
font-size: 1.2rem;
307+
text-transform: uppercase;
308+
}
309+
310+
.documentation aside ul {
311+
list-style: none;
312+
padding: 0 1rem;
313+
}
314+
315+
.documentation aside > ul {
316+
list-style: none;
317+
padding: 0;
318+
}
319+
320+
.documentation aside a {
321+
font-size: 13px;
322+
text-decoration: none;
323+
border-radius: 2px;
324+
padding: 4px 5px 4px 23px;
325+
display: block;
326+
}
327+
252328

253329
/*
254330
* Off Canvas

0 commit comments

Comments
 (0)
Please sign in to comment.