From 18a177320a7cc9b51c4f510a56f52cdcc92ea5a7 2013-07-15 23:15:32 From: Jonathan Frederic Date: 2013-07-15 23:15:32 Subject: [PATCH] base64 encode PDF before writing back to the nb structure --- diff --git a/IPython/nbconvert/transformers/convertsvg.py b/IPython/nbconvert/transformers/convertsvg.py index 02bebbc..35b9447 100644 --- a/IPython/nbconvert/transformers/convertsvg.py +++ b/IPython/nbconvert/transformers/convertsvg.py @@ -64,7 +64,8 @@ class ConvertSvgTransformer(ConvertFiguresTransformer): #Read output from drive if os.path.isfile(output_filename): - with open(output_filename) as f: - return f.read() + with open(output_filename, 'rb') as f: + return f.read().encode("base64") #PDF is a nb supported binary + #data type, so base64 encode. else: return TypeError("Inkscape svg to png conversion failed")