Bulk Canvas Syllabus To PDF Converter

kyle_cole
Instructure
Instructure
5
1566

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`.
5 Comments
anl2126
Community Member

This sounds fantastic and what we have been looking for. I was wondering, is the export an accessible PDF or just a PDF? 

Bindupen
Community Member

Hi Kyle,

I've just started my Canvas Journey. Am trying to download CD2 files - quiz submissions for analysis. I am trying to use the new DAPClient module. Can you help me with the Python API call for getting this file?

TIA !

jerry_nguyen
Community Contributor

@Bindupen 

You can follow the guide here to download flat file from CD2: https://community.canvaslms.com/t5/Admin-Guide/How-do-I-use-the-Canvas-Data-2-Command-Line-Interface...

Please note, quiz submissions only contain data for classic quizzes. 

If you need help, feel free to send me a PM.

DCG_1980
Community Member

I'm wondering how this would work in my case, where I have a created a syllabus module that has 25 pages. So far: the only solution I've found is to save each individual page as a PDF and then combine them all into a single PDF. That's gonna take A LOT of work and time I need to prep and grade. So I was hoping I could find a way to quickly save all 25 pages in the module as a PDF at once. 

 

cgaudreau
Community Contributor

@kyle_cole - Your sharing this out is incredibly appreciated. Fills a giant "how are we going to do this?!" hole in a massive project. Many, many thanks.