Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Can we just have one single page for the pdf? #33

Open
alinscodes opened this issue Sep 28, 2021 · 4 comments
Open

Question: Can we just have one single page for the pdf? #33

alinscodes opened this issue Sep 28, 2021 · 4 comments

Comments

@alinscodes
Copy link

I am using this library which is great, but it doesn't make sense that it would split into 2 pages after a very long page. Why not have the option to just have 1 page? Is that simple to do?

@betatim
Copy link
Owner

betatim commented Sep 28, 2021

How long are your pages? Until you reach (close to) a magic number of 200 inches you should only get one page. Otherwise I think that would mean there is a bug somewhere (if yes, can you post the notebook and PDF?).

We start a new page if the first page is close to or longer than 200inches. This seems to be the longest page Acrobat Reader will display. Pages longer (and I guess also wider) than this somehow run into "who would ever want a page longer than that" bugs in Acrobat.

This means it would be easier to have just one page, but in practice it makes it harder to view.

@alinscodes
Copy link
Author

The page is 127.126 inches long then it creates another page. Unfortunately I can't share the notebook or pdf as it has private data.

The page is that long or a little bit longer, because there are a lot of plots that I have, and it would be nice to have everything on one single page (would never print this) as it is nice to view and when the next page is created it looks weird as the split doesn't always happen nicely.

I just can't see why this would create another page after 200 inches. I would've thought it was all one single page which is what I liked about this library.

@betatim
Copy link
Owner

betatim commented Sep 28, 2021

The split into two pages happens because one of the most popular PDF viewers can't display pages beyond a certain length. This is annoying but such is life.

It does sound odd that the first page is only ~127in long. Can you make a similar notebook that reproduces this without the private data? Without that it is a bit tricky to debug :-/

@alinscodes
Copy link
Author

I understand. It would still be nice to have the option of selecting one page. Or even splitting to next page at a specific part of the notebook.

I just created a random plot and multiplied it. Converting it to pdf gave me a 150 inch (3,810 mm) pdf pages.
test.zip

jupyterlab==2.2.10
nbconvert==6.2.0
pandas==1.3.3
matplotlib==3.4.3
pymavlink==2.4.16
mysql-connector-python==8.0.26
codaio==0.6.8
notebook-as-pdf==0.5.0
pyppeteer==0.2.6 # to convert to pdf it requires the pyppeteer chromium automation library
numpy==1.21.2
python-dotenv==0.15.0
jupyter-contrib-nbextensions==0.5.1
black==21.9b0

I have these installed in a python venv. Using Python 3.9.7

Command that I run is:

jupyter-nbconvert --ExecutePreprocessor.timeout=1800 --execute test.ipynb --to pdfviahtml --TemplateExporter.exclude_input=True --output test --output-dir=whatever-you-want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants