##// 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 'image/svg+xml',
252 'image/svg+xml',
253 'image/png',
253 'image/png',
254 'image/jpeg',
254 'image/jpeg',
255 'application/pdf',
255 'text/plain'
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 OutputArea.prototype.append_latex = function (latex, md, element) {
635 OutputArea.prototype.append_latex = function (latex, md, element) {
624 // This method cannot do the typesetting because the latex first has to
636 // This method cannot do the typesetting because the latex first has to
625 // be on the page.
637 // be on the page.
@@ -807,6 +819,7 b' var IPython = (function (IPython) {'
807 "image/svg+xml" : "svg",
819 "image/svg+xml" : "svg",
808 "image/png" : "png",
820 "image/png" : "png",
809 "image/jpeg" : "jpeg",
821 "image/jpeg" : "jpeg",
822 "application/pdf" : "pdf",
810 "text/latex" : "latex",
823 "text/latex" : "latex",
811 "application/json" : "json",
824 "application/json" : "json",
812 "application/javascript" : "javascript",
825 "application/javascript" : "javascript",
@@ -818,6 +831,7 b' var IPython = (function (IPython) {'
818 "svg" : "image/svg+xml",
831 "svg" : "image/svg+xml",
819 "png" : "image/png",
832 "png" : "image/png",
820 "jpeg" : "image/jpeg",
833 "jpeg" : "image/jpeg",
834 "pdf" : "application/pdf",
821 "latex" : "text/latex",
835 "latex" : "text/latex",
822 "json" : "application/json",
836 "json" : "application/json",
823 "javascript" : "application/javascript",
837 "javascript" : "application/javascript",
@@ -830,6 +844,7 b' var IPython = (function (IPython) {'
830 'image/svg+xml',
844 'image/svg+xml',
831 'image/png',
845 'image/png',
832 'image/jpeg',
846 'image/jpeg',
847 'application/pdf',
833 'text/plain'
848 'text/plain'
834 ];
849 ];
835
850
@@ -842,6 +857,7 b' var IPython = (function (IPython) {'
842 "text/latex" : OutputArea.prototype.append_latex,
857 "text/latex" : OutputArea.prototype.append_latex,
843 "application/json" : OutputArea.prototype.append_json,
858 "application/json" : OutputArea.prototype.append_json,
844 "application/javascript" : OutputArea.prototype.append_javascript,
859 "application/javascript" : OutputArea.prototype.append_javascript,
860 "application/pdf" : OutputArea.prototype.append_pdf
845 };
861 };
846
862
847 IPython.OutputArea = OutputArea;
863 IPython.OutputArea = OutputArea;
General Comments 0
You need to be logged in to leave comments. Login now