-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Browser support #16
Comments
I think I'll have to abandon FileSaver and use https://github.com/dcneiner/Downloadify instead... I'm not sure if this meets the 'performance' milestone though |
The Problem is not only about the missing Blob.js, but mainly, because IE9 doesn't support data: URLs to be opened in new windows or iframes. There is just no way in IE9 to save a File which comes from the client side. At least non that I know of. This is also the reason why FileSaver.js doesn't come with Blob.js included. Only IE9 is missing the Blob implementation but it isn't capable of saving files anyway... |
Do you have some progress/plan on this bug? It works perfectly on Chrome but doesn't work on others. |
Actually it is possible to support it in IE9, I have been doing so using a small library called downloadify which makes use of flash. One can try the following script (any questions, just ask me): $('body').append("<div id='downloadify'></div>");
var pdfOutput;
pdfMake.createPdf(docDefinition).getBase64(function(outDoc) {
pdfOutput = outDoc;
});
$("#downloadify").downloadify({
filename: filename,
dataType: 'base64',
data: pdfOutput,
onComplete: function () {
pdfOutput = null; // cleaning
alert('done');
},
onCancel: function() {
pdfOutput = null; // cleaning
alert('Cancelled');
},
onError: function() {
alert('You must put something in the File Contents or there will be nothing to save!');
},
swf: './downloadify/media/downloadify.swf',
downloadImage: './downloadify/images/download.png', // just a transparant image to put your own button under it, i have a button underneath it of width 110 and height 30,
width: 110,
height: 30,
transparent: true,
append: false
}); |
Thanks for the description @Wabbala. If you want, you could integrate downloadify in a pull request. Would be happy to help out, when you need to create one. |
Hi Wabbala ,
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="libs/SWObject.js"></script>
<script src="libs/Downloadify.js"></script>
<script src="build/pdfmake.min.js"></script>
<script src="build/vfs_fonts.js"></script>
<script>
function clickme() {
var docDefinition = {
content: [
// if you don't need styles, you can use a simple string to define a paragraph
'This is a standard paragraph, using default style',
|
Placed this comment on #229, but hadn't noticed it was closed as a duplicate. Updating here instead: @bpampuch: We're using this library in the angular-ui-grid, thanks for the excellent code. We have a function that downloads csv files in IE, it has a complex set of detection logic and specific functionality for different browsers, but it does allow download of arbitrary browser created content. It'd be nice if pdfMake also offered a similar functionality, as for pdfMake we're currently just calling the The relevant code file is https://github.com/angular-ui/ng-grid/blob/master/src/features/exporter/js/exporter.js, the relevant method is downloadFile at or about line 769. To see it working you can view the tutorial for the export feature: http://ui-grid.info/docs/#/tutorial/206_exporting_data. The basic steps are to click the grid menu (icon top right of the grid), and select "export all data as csv". If it isn't possible to implement the download function, then perhaps you could answer a different question - can I get the rendered pdf from pdfMake and then execute the download myself? |
Thanks for the information that you provided @bpampuch. For those interested, the ui-grid export function is using some rather kludgy code to extract the pdf as a blob, then trigger an IE download of that file, and you could do the same if you had the same need. |
I currently have a working solution for generating a PDF using in IE9+, Chrome, Firefox, etc. I am using:
However, because of the getter/setter problem with IE8, I am not able to generate the pdf. I have the es5 shim and es5 sham, that have helped. Does anyone know how to get to work in IE8, even it it is a roundabout way? Or is there an update on this? :) |
hello ,when i export data,i find it isn't work for chinese.how can i slove this problem? |
floydbear - Your solution is not working, Can you please give more details on how did you implement this for IE ? |
@Wabbala - Do we have any other solution , rather than using downloadify which is a flash solution ? Any help is appreciated. |
@Frank2121 : I was able to get this to work for IE9+. My JS looked like such:
I then created an AJAX endpoint that converted the returned "pdfOutput" into a PDF file. I did this in C# as follows, where PDFFile was just an object I created with the data.
Inside the JS function I submitted a fake form that called this ajax request to then return the file. Hope that helps! |
@floydbear - thanks for your update, but i was most looking at a Client side solution. Doing a HTTP POST will be performance issue. So nothing work at Client side as it works for Chrome and FF ? |
continued here: #800 |
Hi, I've test your library in different navigators :
The text was updated successfully, but these errors were encountered: