{"id":15014833,"url":"https://github.com/brpy/colab-pdf","last_synced_at":"2025-04-09T19:23:19.648Z","repository":{"id":50777608,"uuid":"261097663","full_name":"brpy/colab-pdf","owner":"brpy","description":"Simple script to download your colab ipynb as a pdf using nbconvert","archived":false,"fork":false,"pushed_at":"2022-09-21T04:40:34.000Z","size":43,"stargazers_count":87,"open_issues_count":8,"forks_count":40,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T21:22:16.028Z","etag":null,"topics":["colab-notebook","colaboratory","google-drive","ipython","ipython-magic","nbconvert","pdf","python","xelatex"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brpy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-04T06:31:48.000Z","updated_at":"2025-03-14T22:59:40.000Z","dependencies_parsed_at":"2023-01-18T15:55:21.489Z","dependency_job_id":null,"html_url":"https://github.com/brpy/colab-pdf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brpy%2Fcolab-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brpy%2Fcolab-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brpy%2Fcolab-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brpy%2Fcolab-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brpy","download_url":"https://codeload.github.com/brpy/colab-pdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248095909,"owners_count":21046941,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["colab-notebook","colaboratory","google-drive","ipython","ipython-magic","nbconvert","pdf","python","xelatex"],"created_at":"2024-09-24T19:46:09.310Z","updated_at":"2025-04-09T19:23:19.620Z","avatar_url":"https://github.com/brpy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Usage \n\n\nPaste and run this in your colab notebook in the last cell.\n```ipython\n!wget -nc https://raw.githubusercontent.com/brpy/colab-pdf/master/colab_pdf.py\nfrom colab_pdf import colab_pdf\ncolab_pdf('pandas-assignment.ipynb')\n```\nEnter the the full file name as shown above, within quotes. The pdf will be saved on your Google Drive.\n\nFor better quality plots use:\n```python\nfrom IPython.display import set_matplotlib_formats\nset_matplotlib_formats('pdf', 'svg')\n```\nin the first cell of the notebook.\n___\n\n\n#### I want to hide output\nThe outputs can be long as a lot of commands are run in the background. You can use `%%capture` magic to hide the cell output.\n```\n%%capture\n!wget -nc https://raw.githubusercontent.com/brpy/colab-pdf/master/colab_pdf.py\nfrom colab_pdf import colab_pdf\ncolab_pdf('pandas-assignment.ipynb')\n```\n *Note:* This will also hide pdf creation, pdf save logs. So check your Google Drive for the pdf.\n\n#### Google Drive Access\nThis 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.\n\n\n#### Printing from browser works for me, why use this?\nIf 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.\n\n\n#### Too slow\nUbuntu 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.\n\n\n#### Browser download works ony half the time\nDue 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.\n\n\n#### Error in nbcovert or xelatex\nnbconvert 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 -\u003e Print  method.\n___\n\n\nThanks to Google Colab for helping the community.\nGoogle Colaboratory is a product of Google.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrpy%2Fcolab-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrpy%2Fcolab-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrpy%2Fcolab-pdf/lists"}