This release is a pre-release and may not be stable for production use.
Directions: Copy→Paste→Run 
# Colab2PDF v1.0.0 by Drengskapur (github.com/drengskapur/colab2pdf) (License: GPL-3.0-or-later)
# @title {display-mode:"form"}
# @markdown ⬇️ Download PDF
def colab2pdf():
ENABLE=True # @param {type:"boolean"}
if ENABLE:
import os, datetime, json, pathlib, urllib, requests, werkzeug, nbformat, google, yaml, warnings
NAME = pathlib.Path(werkzeug.utils.secure_filename(urllib.parse.unquote(requests.get(f"http://{os.environ['COLAB_JUPYTER_IP']}:{os.environ['KMP_TARGET_PORT']}/api/sessions").json()[0]["name"])))
TEMP = pathlib.Path("/content/pdfs") / f"{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}_{NAME.stem}"; TEMP.mkdir(parents=True, exist_ok=True)
NB = [cell for cell in nbformat.reads(json.dumps(google.colab._message.blocking_request("get_ipynb", timeout_sec=30)["ipynb"]), as_version=4).cells if "--Colab2PDF" not in cell.source]
warnings.filterwarnings('ignore', category=nbformat.validator.MissingIDFieldWarning)
with (TEMP / f"{NAME.stem}.ipynb").open("w") as nb_copy: nbformat.write(nbformat.v4.new_notebook(cells=NB or [nbformat.v4.new_code_cell("#")]), nb_copy)
if not pathlib.Path("/usr/local/bin/quarto").exists():
!wget -q "https://quarto.org/download/latest/quarto-linux-amd64.deb" -P {TEMP} && dpkg -i {TEMP}/quarto-linux-amd64.deb > /dev/null && quarto install tinytex --update-path --quiet
with (TEMP / "config.yml").open("w") as file: yaml.dump({'include-in-header': [{"text": r"\usepackage{fvextra}\DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaksymbolleft={},showspaces=false,showtabs=false,breaklines,breakanywhere,commandchars=\\\{\}}"}],'include-before-body': [{"text": r"\DefineVerbatimEnvironment{verbatim}{Verbatim}{breaksymbolleft={},showspaces=false,showtabs=false,breaklines}"}]}, file)
!quarto render {TEMP}/{NAME.stem}.ipynb --metadata-file={TEMP}/config.yml --to pdf -M latex-auto-install -M margin-top=1in -M margin-bottom=1in -M margin-left=1in -M margin-right=1in --quiet
google.colab.files.download(str(TEMP / f"{NAME.stem}.pdf"))
colab2pdf()
Metadata
Release files for colab2pdf 1.0.0a14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| colab2pdf-1.0.0a14.tar.gz | 79.4 kB | Without provenance | Details for colab2pdf-1.0.0a14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| colab2pdf-1.0.0a14-py3-none-any.whl | Python 3 | none | any | Details for colab2pdf-1.0.0a14-py3-none-any.whl |
Total release size: 96.2 kB
Release files / colab2pdf-1.0.0a14.tar.gz
| Download URL | colab2pdf-1.0.0a14.tar.gz |
|---|---|
| Size | 79.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95e63e09de95e5ff18313d007f6078a6445648baaad64927e4539cf8acee3ca0
|
|
BLAKE2b-256 checksum How to use checksums |
a70c856eaef3ce240cddfc0825b4cc61441d65bea5e68fff15ff0e906be7d6f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / colab2pdf-1.0.0a14-py3-none-any.whl
| Download URL | colab2pdf-1.0.0a14-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2386cb8eb2bb1ad835a7b483416b04b0f90a394c4ed59c80e56e0474180d9698
|
|
BLAKE2b-256 checksum How to use checksums |
f60db17c3569b1f8d525b1141e7cf80f37852d0b711c9868fce60abf38589b48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for colab2pdf 1.0.0a14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.