How to embed a PDF file in a text block ? (or is there a XBlock for PDF ?)

1,023 views
Skip to first unread message

Marceau C.

unread,
Jun 16, 2014, 9:04:54 AM6/16/14
to edx-...@googlegroups.com
Hi,

I saw that PDFJS is used to embed PDF in the Text Book feature. But I found no way to embed a PDF inside a HTML XBlock.

What is the trick to use PDFJS within a HTML XBlock ?
Has someone made a PDF specific XBlock ?

Thanks !

Chris Dodge

unread,
Jun 16, 2014, 9:44:17 AM6/16/14
to edx-...@googlegroups.com
I'm not aware of a PDF viewer xBlock, but I could imagine that it would be a very valuable contribution to the community if one were to take it on.

Marceau C.

unread,
Jun 16, 2014, 11:03:33 AM6/16/14
to edx-...@googlegroups.com
I realised there is a HTML5 way of embeding PDFs :

<object data="my-pdf.pdf" type="application/pdf" width="100%" height="500">
  <p>It appears you don't have a PDF plugin for this browser.
  You can <a href="my-pdf.pdf">click here to
  download the PDF file.</a></p>
</object>

This will use the default PDF player of your browser.


PDFJS is the technology used as the default PDF viewer on Firefox : http://mozilla.github.io/pdf.js/web/viewer.html
This is also the viewer used on OpenEdX for the TextBook.

So it could be nice to have a XBlock, to avoid HTML, as many people are afraid of the raw HTML editor of OpenEdX. I will see if it something that is useful in my case, I'll try to make an XBlock if it is worth it.

Leonardo Salom

unread,
Jun 17, 2014, 4:17:02 AM6/17/14
to edx-...@googlegroups.com
After reading this i made a pdf-xblock, i'll push this morning after checking it works correctly and link the repo here.

Best regards

Leonardo Salom

unread,
Jun 17, 2014, 5:21:01 AM6/17/14
to edx-...@googlegroups.com
Hi all 

I just pushed the pdfXBlock to https://github.com/polimediaupv/pdfXBlock hope is usefull for the community.

Best Regards.

Leonardo Salom

unread,
Jun 17, 2014, 6:06:32 AM6/17/14
to edx-...@googlegroups.com
Last update 

You can check the XBlock working at http://demo.edx.upv.es/courses/UPV/Tests/2014-002/about

Best regards.

Piotr Mitros

unread,
Jun 19, 2014, 1:49:30 PM6/19/14
to edx-...@googlegroups.com
An alternative: 

This is a script which takes a PDF, makes a PNG-per-page, and makes a learning sequence in edXML out of it. The goal was to go ODP/PPT -> edX, for which it works pretty well. It wouldn't be a good UX for one page (which the PDF XBlock does very well), or textbooks (which would be a bit long for a learning sequence). 

Piotr
Reply all
Reply to author
Forward
0 new messages