Coder Social home page Coder Social logo

mgp2pdf's Introduction

mgp2pdf

This is a quick-and-dirty MagicPoint to PDF converter.

It supports only a subset of MagicPoint, specifically, the subset I've used in my slides so far. If you send me your slide decks, I'll make mgp2pdf handle them too.

SUPPORT.rst has a list of supported and unsupported features.

BUGS.rst has a list of known bugs.

Installation

pip install mgp2pdf

Usage

mgp2pdf [-v] [--unsafe] slides.mgp [-o output.pdf]
mgp2pdf [-v] [--unsafe] slides.mgp ... [-o directory]
mgp2pdf [-h|--help]

Why another converter?

I used mgp to produce slides for a Python course I taught at Vilnius University. However, since most of the students are not (yet) Linux users, they couldn't use MagicPoint to view my slides at home. There are some converters from MagicPoint to PostScript/HTML, but the result either looks ugly, or doesn't support Unicode characters. MagicPoint itself can produce a number of bitmaps (by taking screenshots), but those are big, and the conversion process is inconvenient (you cannot use your machine while mgp is busy rendering slides and taking screenshots).

I wrote a Python program to interpret MagicPoint commands and produce a PDF file using ReportLab. It can handle my slides (Lithuanian), but otherwise it is probably incomplete. Feel free to give it a try. File bugs for missing features, and I'll see what I can do.

Resources

There's a web page, of sorts, at https://mg.pov.lt/mgp2pdf

The source code can be found at https://github.com/mgedmin/mgp2pdf.

Report bugs at https://github.com/mgedmin/mgp2pdf/issues.

Licence: GPL v2 or v3 (https://www.gnu.org/copyleft/gpl.html)

https://github.com/mgedmin/mgp2pdf/workflows/build/badge.svg?branch=master https://ci.appveyor.com/api/projects/status/github/mgedmin/mgp2pdf?branch=master&svg=true https://coveralls.io/repos/mgedmin/mgp2pdf/badge.svg?branch=master

mgp2pdf's People

Contributors

aureliojargas avatar mgedmin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mgp2pdf's Issues

PyPy support?

$ tox -e pypy
GLOB sdist-make: /home/mg/src/mgp2pdf/setup.py
pypy create: /home/mg/src/mgp2pdf/.tox/pypy
pypy installdeps: mock
pypy inst: /home/mg/src/mgp2pdf/.tox/dist/mgp2pdf-0.10.1.dev0.zip
pypy installed: cffi==0.8.6,funcsigs==0.4,greenlet==0.4.5,mgp2pdf==0.10.1.dev0,mock==1.3.0,pbr==1.8.0,Pillow==2.9.0,readline==6.2.4.1,reportlab==3.2.0,six==1.9.0,wheel==0.24.0
pypy runtests: PYTHONHASHSEED='2316777835'
pypy runtests: commands[0] | python tests.py
....E.................................
======================================================================
ERROR: test_conversion (__main__.SmokeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 53, in test_conversion
    p.makePDF(pdf)
  File "/home/mg/src/mgp2pdf/mgp2pdf.py", line 1057, in makePDF
    s.drawOn(canvas, self.pageSize)
  File "/home/mg/src/mgp2pdf/mgp2pdf.py", line 261, in drawOn
    self.wordWrap(canvas, w, h)
  File "/home/mg/src/mgp2pdf/mgp2pdf.py", line 244, in wordWrap
    new_lines += line.split(canvas, w, h)
  File "/home/mg/src/mgp2pdf/mgp2pdf.py", line 362, in split
    cw, ch = chunk.size(canvas, w, h)
  File "/home/mg/src/mgp2pdf/mgp2pdf.py", line 555, in size
    textwidth += canvas.stringWidth(run, self.font, fontSize)
  File "/home/mg/src/mgp2pdf/.tox/pypy/site-packages/reportlab/pdfgen/canvas.py", line 1644, in stringWidth
    (fontSize,self._fontsize)[fontSize is None])
  File "/home/mg/src/mgp2pdf/.tox/pypy/site-packages/reportlab/pdfbase/pdfmetrics.py", line 707, in stringWidth
    return getFont(fontName).stringWidth(text, fontSize, encoding=encoding)
  File "/home/mg/src/mgp2pdf/.tox/pypy/site-packages/reportlab/pdfbase/pdfmetrics.py", line 358, in stringWidth
    return instanceStringWidthT1(self, text, size, encoding=encoding)
SystemError: Bad internal call!

----------------------------------------------------------------------
Ran 38 tests in 0.837s

FAILED (errors=1)
ERROR: InvocationError: '/home/mg/src/mgp2pdf/.tox/pypy/bin/python tests.py'
----------------------------------------------------------------------
_________________________________ summary _________________________________
ERROR:   pypy: commands failed

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.