PDF export

Hi,

We want to have a pdf export functionality for our wikis.

In order to do this, I have constructed a widget extension that transforms a html string into a pdf, this is called in the export.vm

I parse the wiki and make an ajax call that posts the html string to a export.vm

         //htmlContent - the parsed wiki html
         jQuery.telligent.evolution.post({
            url: '$core_v2_encoding.JavascriptEncode($core_v2_widget.GetExecutedFileUrl('export.vm'))',
            data: {
                w_html: htmlContent
            },
            success: function(response){
                var blob = new Blob([response], {type: "application/pdf"});
                saveAs(blob, "file.pdf");
            }
        });

In the export.vm I call the widget extension that returns a System.Byte[]

#if ($core_v2_page.IsPost)
    #set($html = $core_v2_page.GetFormValue('w_html'))

    ##custom widget extension
    #set($pdf = $sdl_exportToPdf.ExportToPdf($html))

    $pdf

#end

In the ajax call success method above, I try to transform the response into a blob and 

save it using FileSaver.js, but the pdf file cannot open up correctly.

Am I not posting back the $pdf correctly? what am I missing here ?

Regards,

Silviu