Difference between revisions of "Google Colab"
Jump to navigation
Jump to search
(→Printing to PDF) |
|||
Line 4: | Line 4: | ||
* Sometimes using the File->Print command with a PDF-based destination will work fine! Check out the preview to see if it does. Be careful though - the issues might not creep up until deep within the notebook. Take a look at particularly large output formatted output cells. | * Sometimes using the File->Print command with a PDF-based destination will work fine! Check out the preview to see if it does. Be careful though - the issues might not creep up until deep within the notebook. Take a look at particularly large output formatted output cells. | ||
* If that doesn't work, try this (note: this assumes that you have the Google Drive app installed such that your file system can directly see your Google Drive): | * If that doesn't work, try this (note: this assumes that you have the Google Drive app installed such that your file system can directly see your Google Drive): | ||
− | ** Make sure that you have run and saved the notebook(s) that you want to your Google Drive and that you know where they are | + | ** Make sure that you have run and saved the notebook(s) that you want to your Google Drive and that you know where they are; also - '''make sure your file name has no spaces in it''' (if it does, you can rename it at a later step) |
** Go to [https://colab.research.google.com/drive/1YhFLX4S8l3E_Pl_7DAYc-IuNA7e0OY1y?usp=sharing ToHTML_local.ipynb] ([[:File:ToPDF01.png|picture]]) | ** Go to [https://colab.research.google.com/drive/1YhFLX4S8l3E_Pl_7DAYc-IuNA7e0OY1y?usp=sharing ToHTML_local.ipynb] ([[:File:ToPDF01.png|picture]]) | ||
** Open the local files panel by clicking the folder icon at left (bottom icon) and wait for the runtime to connect - there should be a '''''sample_data''''' folder when this is done. ([[:File:ToPDF02.png|picture]]) | ** Open the local files panel by clicking the folder icon at left (bottom icon) and wait for the runtime to connect - there should be a '''''sample_data''''' folder when this is done. ([[:File:ToPDF02.png|picture]]) | ||
** Click the "Upload to session storage" icon (first icon of the four above the file list; piece of paper with an up arrow) | ** Click the "Upload to session storage" icon (first icon of the four above the file list; piece of paper with an up arrow) | ||
− | ** Navigate to where the .ipynb file is that you want to print and upload it to local storage. Repeat this for any notebooks that you want to print (you can shift-click to get multiple files from the same folder). This will make local copies in the current runtime. ([[:File:ToPDF03.png|picture]]) | + | ** Navigate to where the .ipynb file is that you want to print and upload it to local storage. Repeat this for any notebooks that you want to print (you can shift-click to get multiple files from the same folder). This will make local copies in the current runtime. ([[:File:ToPDF03.png|picture]]). '''This is where you will need to make absolutely sure your file names have no spaces''' |
** Run the one cell in the ToHTML_local.ipynb - this will make an HTML version of any .ipynb files in the runtime. Once you have done that for all the files, you can click the Refresh icon (second icon of the four above the file list; folder with a circular arrow); you can also just wait for the list to refresh itself. ([[:File:ToPDF04.png|picture]]) | ** Run the one cell in the ToHTML_local.ipynb - this will make an HTML version of any .ipynb files in the runtime. Once you have done that for all the files, you can click the Refresh icon (second icon of the four above the file list; folder with a circular arrow); you can also just wait for the list to refresh itself. ([[:File:ToPDF04.png|picture]]) | ||
** Hover over the HTML version of the file(s) you want, click the menu button that comes up (three dots), and then choose Download. ([[:File:ToPDF05.png|picture]]) | ** Hover over the HTML version of the file(s) you want, click the menu button that comes up (three dots), and then choose Download. ([[:File:ToPDF05.png|picture]]) | ||
** Open the HTML version of the files you want in a browser, then use the browser's print command to create a PDF. ([[:File:ToPDF06.png|picture]]) | ** Open the HTML version of the files you want in a browser, then use the browser's print command to create a PDF. ([[:File:ToPDF06.png|picture]]) | ||
** There may be a great deal of extra space between cells - for this class that will be fine. | ** There may be a great deal of extra space between cells - for this class that will be fine. |
Revision as of 21:59, 1 February 2023
Printing to PDF
Pre-script: The second, more complicated method below generally comes up with much better PDFs than the first one... It just takes more work.
- Sometimes using the File->Print command with a PDF-based destination will work fine! Check out the preview to see if it does. Be careful though - the issues might not creep up until deep within the notebook. Take a look at particularly large output formatted output cells.
- If that doesn't work, try this (note: this assumes that you have the Google Drive app installed such that your file system can directly see your Google Drive):
- Make sure that you have run and saved the notebook(s) that you want to your Google Drive and that you know where they are; also - make sure your file name has no spaces in it (if it does, you can rename it at a later step)
- Go to ToHTML_local.ipynb (picture)
- Open the local files panel by clicking the folder icon at left (bottom icon) and wait for the runtime to connect - there should be a sample_data folder when this is done. (picture)
- Click the "Upload to session storage" icon (first icon of the four above the file list; piece of paper with an up arrow)
- Navigate to where the .ipynb file is that you want to print and upload it to local storage. Repeat this for any notebooks that you want to print (you can shift-click to get multiple files from the same folder). This will make local copies in the current runtime. (picture). This is where you will need to make absolutely sure your file names have no spaces
- Run the one cell in the ToHTML_local.ipynb - this will make an HTML version of any .ipynb files in the runtime. Once you have done that for all the files, you can click the Refresh icon (second icon of the four above the file list; folder with a circular arrow); you can also just wait for the list to refresh itself. (picture)
- Hover over the HTML version of the file(s) you want, click the menu button that comes up (three dots), and then choose Download. (picture)
- Open the HTML version of the files you want in a browser, then use the browser's print command to create a PDF. (picture)
- There may be a great deal of extra space between cells - for this class that will be fine.