zhaoterryy / mkdocs-pdf-export-plugin

An MkDocs plugin to export content pages as PDF files
MIT License
318 stars 42 forks source link

Empty page prepended to pdf output #89

Open nihiluis opened 4 years ago

nihiluis commented 4 years ago

I have a test.md with this content: https://jaspervdj.be/lorem-markdownum/markdown.txt

the pdf export prepends one empty site to the actual page.

I'm using the material theme and downloaded mkdocs today. is this a known issue? can someone please check if it appears for him as well?

codetricity commented 4 years ago

I have the same problem. I don't have a solution at the moment. If you find one, please post.

timvink commented 4 years ago

Checkout mkdocs-print-site-plugin as an alternative. Full disclosure: I'm the author.

m09 commented 3 years ago

Issue seems to be that you don't have an index.md file. Adding one will populate the first page.

EricDuminil commented 3 years ago

@m09 I can reproduce this bug, even with one single markdown file called index.md.

Here's the longest markdown file which gets converted to a single page pdf on my computer:

# Just a title

1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A # Just one page

Here's the shortest markdown file which gets converted to 2-pages pdf, with a blank first page:

# Just a title

1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A
1. A # Just one page
1. A # 2 pages, with first page empty.

Here are the resulting pdfs : index_just_one_page.pdf & index_two_pages.pdf.

If it helps, the corresponding mkdocs.yml is:

site_name: PDF Test
theme:
  name: material

plugins:
  - pdf-export:
      media_type: print

And requirements.txt is:

Babel==2.9.0
beautifulsoup4==4.9.3
cairocffi==1.2.0
CairoSVG==2.5.0
cffi==1.14.4
click==7.1.2
cssselect2==0.4.1
defusedxml==0.6.0
future==0.18.2
gitdb==4.0.5
GitPython==3.1.11
html5lib==1.1
htmlmin==0.1.12
importlib-metadata==3.3.0
Jinja2==2.11.2
joblib
jsmin==2.2.2
livereload==2.6.3
lunr==0.5.8
Markdown==3.3.3
markdown-inline-graphviz-extension==1.1
MarkupSafe==1.1.1
mkdocs==1.1.2
mkdocs-awesome-pages-plugin==2.5.0
mkdocs-git-revision-date-localized-plugin==0.8
mkdocs-localsearch==0.7.0
mkdocs-markdownextradata-plugin==0.2.0
mkdocs-material==6.2.3
mkdocs-material-extensions==1.0.1
mkdocs-minify-plugin==0.3.0
mkdocs-pdf-export-plugin==0.5.8
nltk==3.5
Pillow==8.0.1
pycparser==2.20
Pygments==2.7.3
pymdown-extensions==8.1
Pyphen==0.10.0
pytz==2020.5
PyYAML==5.3.1
regex==2020.11.13
six==1.15.0
smmap==3.0.4
soupsieve==2.1
tinycss2==1.1.0
tornado==6.1
tqdm==4.55.0
WeasyPrint==52.2
webencodings==0.5.1
zipp

On Linux Mint 19.3.

zhanenkui commented 3 years ago

I have the same problem. I don't have a solution at the moment.Anybody know? Please share your solutions

pingvinen commented 3 years ago

If I select all the text in one of those seemingly empty pages, I actually find a link saying Skip to content.

timd19 commented 3 years ago

Any updates to this? Same issue here - I also found if you select all the white space you can see Skip to content. Then, if you hover over the invisible words, it hyperlinks to the next page.

It seems that this is a table of contents in the PDF... but with no formatting.

brospars commented 3 years ago

If you are using mkdocs-material I've fork and made my own plugin without using weasyprint but pyppeteer. I have got better results and more control over the exported files. However I do not support combined for now.

tomkat-cr commented 2 months ago

Checkout mkdocs-print-site-plugin as an alternative. Full disclosure: I'm the author.

Four years later, mkdocs-print-site-plugin made my day. Thanks @timvink