##// END OF EJS Templates
Adding basic append_pdf in OutputArea.
Brian E. Granger -
Show More
@@ -252,6 +252,7 b' var IPython = (function (IPython) {'
252 252 'image/svg+xml',
253 253 'image/png',
254 254 'image/jpeg',
255 'application/pdf',
255 256 'text/plain'
256 257 ];
257 258
@@ -620,6 +621,17 b' var IPython = (function (IPython) {'
620 621 };
621 622
622 623
624 OutputArea.prototype.append_pdf = function (pdf, md, element) {
625 var type = 'application/pdf';
626 var toinsert = this.create_output_subarea(md, "output_pdf", type);
627 var a = $('<a/>').attr('href', 'data:application/pdf;base64,'+pdf);
628 a.attr('target', '_blank');
629 a.text('View PDF')
630 toinsert.append(a);
631 element.append(toinsert);
632 return toinsert;
633 }
634
623 635 OutputArea.prototype.append_latex = function (latex, md, element) {
624 636 // This method cannot do the typesetting because the latex first has to
625 637 // be on the page.
@@ -807,6 +819,7 b' var IPython = (function (IPython) {'
807 819 "image/svg+xml" : "svg",
808 820 "image/png" : "png",
809 821 "image/jpeg" : "jpeg",
822 "application/pdf" : "pdf",
810 823 "text/latex" : "latex",
811 824 "application/json" : "json",
812 825 "application/javascript" : "javascript",
@@ -818,6 +831,7 b' var IPython = (function (IPython) {'
818 831 "svg" : "image/svg+xml",
819 832 "png" : "image/png",
820 833 "jpeg" : "image/jpeg",
834 "pdf" : "application/pdf",
821 835 "latex" : "text/latex",
822 836 "json" : "application/json",
823 837 "javascript" : "application/javascript",
@@ -830,6 +844,7 b' var IPython = (function (IPython) {'
830 844 'image/svg+xml',
831 845 'image/png',
832 846 'image/jpeg',
847 'application/pdf',
833 848 'text/plain'
834 849 ];
835 850
@@ -842,6 +857,7 b' var IPython = (function (IPython) {'
842 857 "text/latex" : OutputArea.prototype.append_latex,
843 858 "application/json" : OutputArea.prototype.append_json,
844 859 "application/javascript" : OutputArea.prototype.append_javascript,
860 "application/pdf" : OutputArea.prototype.append_pdf
845 861 };
846 862
847 863 IPython.OutputArea = OutputArea;
General Comments 0
You need to be logged in to leave comments. Login now