GithubHelp home page GithubHelp logo

jonguenther / preziscraper Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 4.0 38 KB

Scrape and convert Prezi presentations to PDF

JavaScript 100.00%
prezi scrape prezi2pdf webscraper images2pdf nodejs puppeteer

preziscraper's Introduction

preziscraper

This is a little tool written in Node.JS to download and convert a Prezi presentation into a pdf.

Why create this?

One of my lecturers created his lecture in Prezi and I wanted to work with it on my iPad. Unfortunetaly, Prezi won't let you download their slide sets as PDF unless you have a Pro Account which is ridiculous and way too expensive.

So I created this Prezi scraper that lets me download the Prezi slides and convert them into a single PDF file.

Requirements

You need a chromium browser (e.g. Google Chrome) installation on your pc.

Alternatively you can change puppeteer-core to puppeteer in [preziscraper.js](preziscraper.js)

Installation

Simply clone this package and run npm install.

Using this tool

Currently, the tool is split into two scripts. [preziscraper.js](preziscraper.js) contains the scraper, while [imgtopdf.js](imgtopdf.js) contains the pdf creation tool, to make a pdf out of the scraped Prezi slides.

If I find the time, I will merge them into one script.

Scrape Prezis

To scrape a Prezi and save them as images, simply run node preziscraper.js --url [PREZI URL]

Additional options are:

  • --width to set the width [default is 595]
  • --height to set the height [default is 842]
  • --out to set the output folder of the scraped Prezi slides [default is img in the repo folder]
  • --chromePath to set the path to the chromium executable [default is C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe for windows and /usr/bin/google-chrome for everything else]

Transform Prezi Slides to PDF

To transformt the scraped Prezi to PDF, run node imgtopdf.js.

Additional options are:

  • --in to set the input folder [default is ./img in the repo folder]
  • --out to set the output path [default is ./prezi.pdf in the repo folder]
  • --del add this flag to delete all previously scraped images after the convertion is done

How it works

The script uses puppeteer to control chromium, in order to access the Prezi. It will then go over each slide and take a screenshot.

In the end the images of the Prezi slides can be converted to a single PDF file.

Issues

Transition

Currently the script does not detect when a transition is done. I therefore hardcoded a timeout of 1200 ms in [preziscraper.js](preziscraper.js). However, there is a chance that if the transition takes to long, e.g. when transitioning from an overview to a slide, the screenshot will be taken while the actual slide is not yet zoomed in.

Full Screen

When [preziscraper.js](preziscraper.js) is being run in headless mode, it will not go into full screen mode for some reason. Needs to be investigated.

preziscraper's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.