-
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
open function won't work in a callback #587
Comments
please post some line of code |
Same issue here.
$.post(site_url, form_data, function(json) {
var pdfContent = {
content:[
"First paragraph",
"Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines"
]
};
pdfMake.createPdf(pdfContent).open();
}, "json"); But it is working outside of the ajax callback function. |
Works only |
This is a temporary solution:
Usage
|
@raky291 Did you submit a pull request? I would love to have this in the official release. |
Implemented by commit 5f4076f.
$scope.generatePdf = function() {
// create the window before the callback
var win = window.open('', '_blank');
$http.post('/someUrl', data).then(function(response) {
// pass the "win" argument
pdfMake.createPdf(docDefinition).open({}, win);
});
};
$scope.generatePdf = function() {
// create the window before the callback
var win = window.open('', '_blank');
$http.post('/someUrl', data).then(function(response) {
// pass the "win" argument
pdfMake.createPdf(docDefinition).print({}, win);
});
}; |
Is it true that this solution can not be used unless application is powered by AngularJS? This is the only solution to this issue i've found yet. |
No., Used framework/technology for async process is not related to pdfmake and It is important at begin of action create/open new window and then pass this parameter to pdfmake |
not work I used new version. I read |
I can't seem to use the open function after any callback. I tried to use the function after an ajax call and after using SVG.toDataURL, in both cases i get "undefined is not an object (evaluating 'e.location')"
The text was updated successfully, but these errors were encountered: