Giter Club home page Giter Club logo

colab-pdf's Introduction

Usage

Paste and run this in your colab notebook in the last cell.

!wget -nc https://raw.githubusercontent.com/brpy/colab-pdf/master/colab_pdf.py
from colab_pdf import colab_pdf
colab_pdf('pandas-assignment.ipynb')

Enter the the full file name as shown above, within quotes. The pdf will be saved on your Google Drive.

For better quality plots use:

from IPython.display import set_matplotlib_formats
set_matplotlib_formats('pdf', 'svg')

in the first cell of the notebook.


I want to hide output

The outputs can be long as a lot of commands are run in the background. You can use %%capture magic to hide the cell output.

%%capture
!wget -nc https://raw.githubusercontent.com/brpy/colab-pdf/master/colab_pdf.py
from colab_pdf import colab_pdf
colab_pdf('pandas-assignment.ipynb')

Note: This will also hide pdf creation, pdf save logs. So check your Google Drive for the pdf.

Google Drive Access

This requires that you have already mounted your google drive in your notebook. If not, this will attempt to Mount your drive, which may ask for your auhtentication.

Printing from browser works for me, why use this?

If you are satisfied with browser's pdf, this might not be for you. This uses jupyter's nbconvert which is the recommended way to convert .ipynb to .pdf and may produce better results.

Too slow

Ubuntu repos are updated and xelatex packages are downloaded in the background. This takes upto 90% of the time as these packages are large and can consume time.

Browser download works ony half the time

Due to some reason or the way google.colab.files is implemented, browser download fails for the first time. This has been mitigated by putting it in a try block. If you run it second time the file can be downloaded from the browser itself.

Error in nbcovert or xelatex

nbconvert and xelatex are not perfect and might fail to convert your file to pdf. In such case try to debug using output logs or use browser's File -> Print method.


Thanks to Google Colab for helping the community. Google Colaboratory is a product of Google.

colab-pdf's People

Contributors

argoopjmc avatar brpy avatar yashgoenka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

colab-pdf's Issues

Language issue

This method doesn't work for foreign language output. For me its russian language that does not appear.

Can't use image

I'm trying download the pdf file from a Cobab with a image. I've tried insert the image directly, insert using markdown, html, but nothing works. I can see the image in colab notebook page, but not in pdf.

A code this way in colab text cell:

<img src="https://uploaddeimagens.com.br/images/003/877/446/original/metodos_numericos_semanaiii.PNG?1653215884" alt="My Image" width=700>

Doesn't export full notebook

Other users on youtube are also having this issue. It's on the last few pages, where it doesn't print everything.

However, I don't believe it's fully your fault. If I try to print out of the browser, the same problem happens (and with ugly print). I don't know

blocked by access code

when executing block code, an authorization code is now required and I cannot access the functionality of this repo

Output not being saved

I see no output from the exports when either running

!wget -nc https://raw.githubusercontent.com/brpy/colab-pdf/master/colab_pdf.py
from colab_pdf import colab_pdf
colab_pdf('path-to-notebook.ipynb')
  • As the last cell after manual run
  • As the last cell (using restart kernel and run all)
  • As the first cell of a new notebook that points to the path

I have confirmed that Colab is saving the output, if I download the file to my local machine and open it on jupyter notebook, I see the output just fine (and I can CTRL+P).

Any help appreciated!

not saving any pdf

Hey there and thanks for the share!
I tried used it as you instructed. Everything executed and the log says the pdf saved in drive but I can not see any new file on my drive. I would like to hear what is that I do wrong.
Thanks in advance, Sagi :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.