[IPython-dev] Export notebook to image >>> not editable print view

Damián Avila damianavila at gmail.com
Fri Apr 20 19:12:09 EDT 2012

El 20/04/12 19:42, Thomas Kluyver escribió:
> Immediate thought: not as an image, please. Documents saved as images
> are inefficient and unhelpful (want to copy some text? hard luck!). If
> we're going to use the browser in a way like that, I'm pretty sure
> it's possible to export a PDF, which at least keeps text as text. See
> e.g. http://code.google.com/p/wkhtmltopdf/ , which uses QWebkit for a
> similar purpose.
> Also, I don't think this is an alternative to a real static HTML
> export. The notebook shouldn't depend on having PyQt/PySide installed
> on either the server or the client. It could be useful as a temporary
> measure while we work out the details of producing static HTML,
> though.
> Thanks,
> Thomas
> On 20 April 2012 19:31, Damián Avila<damianavila at gmail.com>  wrote:
>> Working in a ipython notebook plugin for an ide, I realize that the print
>> view of the notebook is functional notebook, and hence, it is editable.
>> For a print view, it would be a better options to get an non-editable
>> notebook. There was a little discussion in github around this topic
>> (https://github.com/ipython/ipython/issues/1292). Brian propose to generate
>> a static html for the print view. Then, I proposed another way, so I bring
>> the discussion here:
>> We can capture the notebook into a png (and other format) images using
>> qwebkit inside PyQt (we have the last one as dependency for Qt console). In
>> this way, first, we can support another ways of export the notebook, such as
>> images...
>> Then, we can import this notebook images inside PyQt objects and displayed
>> into the javascript enviroment...
>> I wrote a little script to capture a complete image of the notebook and show
>> the image inside a web browser and it is displaying great, like the notebook
>> itself.
>> Another way to have a non editable print view would be an export to a raw
>> html (https://github.com/ipython/ipython/issues/860), but we have to deal
>> with MathJax, CodeMirror and Markdown.
>> What do you think about the "image" way to generate a non-editable view of
>> the notebook? I think it would be easy to implement.
>> Regards.
>> Damián.
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

Thanks for your answer Thomas...

Regarding what you have pointed out, I have also captured the notebook 
as a pdf (with qwebkit)... now I am writing the script to insert it into 
a Qwebkit object to show it properly in the browser...

I am agree with the idea that, finally, the static html is the way to do 
it... this would be a temporary solution (quick and easy to implement), 
and maybe another way to get an virtually non-modifiable (read-only) 
view of the notebook...

The PyQt dependency is not a problem for the user that install the 
complete IPython "suite", but it is a great drawback, like you said, in 
others client/servers relationships (and I presume that the notebook - 
and the project - is going to this way).



More information about the IPython-dev mailing list