Difference between revisions of "Google Colab"

From PrattWiki
Jump to navigation Jump to search
(Created page with "== 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. * S...")
 
(Printing to PDF)
Line 5: Line 5:
 
* 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
** Go to [https://colab.research.google.com/drive/1YhFLX4S8l3E_Pl_7DAYc-IuNA7e0OY1y?usp=sharing ToHTML_local.ipynb]  
+
** 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
+
** 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
+
** Navigate to where the .ipynb file is that you want to print and upload it to local storageRepeat 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]])
** 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
+
** Run the one cell in the ToHTML_local.ipynb - this will make an HTML version of any .ipynb files in the runtimeOnce 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
+
** 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]])
** 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
+
** 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]])
** Hover over the HTML version of the file(s) you want, click the menu button that comes up (three dots), and then choose download
+
** There may be a great deal of extra space between cells - for this class that will be fine.
** Open the HTML version of the files you want in a browser, then use the browser's print comm end to create a PDF
 

Revision as of 19:44, 28 January 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
    • 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)
    • 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.