Bulk Canvas Syllabus To PDF Converter

kyle_cole
Instructure
Instructure
4
879

IMPORTANT DISCLAIMER: This is a homemade solution and is not Instructure supported

 

The syllabus is a pretty important part of any course, right? Well, I've come up with a nifty solution using the Canvas API and Python to make it easy to download the Syllabus page of a Canvas course as a PDF. It's not only handy for keeping an archive but can also come in handy for stuff like accreditation. Plus, I added a feature to let you know if a course doesn't have any text in its Syllabus page. This is something I've been wanting in Canvas for a while, and I finally got around to making it happen. So, go ahead and enjoy!

 

What does it do?

This script converts the syllabus content retrieved from the Canvas API's "Get a Single Course" call, which is in HTML format, into a PDF file. The syllabus content essentially represents the content of the Syllabus page within a course. This means that any links or images present in the syllabus content will be preserved in the PDF. However, please note that the script does not include the course summary located at the end of the syllabus page since it is not included in the API response.

 

What you will need:



To run the script provided, follow these steps, assuming you have Python installed:

 

  1. Install Dependencies:
  • Ensure you have the necessary Python packages installed, which include `requests`, `csv`, and `pdfkit`. You can install them using pip if you haven't already. Additionally, you need to install a tool like `wkhtmltopdf` for `pdfkit` to work. You can download it from the official website: https://wkhtmltopdf.org/downloads.html

 

  1. Edit Configuration:
  • Replace the placeholders (e.g., `canvas_domain`, `auth_token`, `courses_csv`, and `file_path`) in your script with your actual Canvas API information and file paths.

 

  1. Run the Script:
  • Open a terminal or command prompt, navigate to the directory where your script is located, and run the script using the following command: 
  • python your_script_name.py 
  • Replace `your_script_name.py` with the actual name of your script file.

 

  1. Monitor Progress:
  • The script will start processing the data and print messages to the console indicating the progress. It will create PDF files and a "No_syllabus.csv" file for cases where syllabus retrieval fails.

 

  1. Check Output:
    Once the script completes, you can check the generated PDF files in the specified file_path directory and review the "No_syllabus.csv" file for courses with issues. Make sure you've properly configured the script and that your Canvas API credentials are correct before running it. Additionally, ensure that the necessary dependencies are correctly installed, including `wkhtmltopdf` for `pdfkit`.
4 Comments