-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
onclone callback removed? #1434
Comments
Any news on that topic? |
@niklasvh This looks promising, thank you very much! I'll give it a shot and I'll get back at you. |
Updated to 1.0.0-alpha.10 but still not working for me. Am I doing something wrong, here? html2canvas(this.exportSlide, {
canvas: this.exportCanvas,
logging: false,
width: 1080,
height: 1080,
scale: 1,
onclone: function(doc) {
console.log('onclone fired');
}
}).then(() => {
this.exportAnchor.href = this.exportCanvas.toDataURL();
this.exportAnchor.download = "SlideExport";
this.exportAnchor.click();
}); Trying to use the solution in #1448 |
Also no worky for me. Onclone doesn't seem to do anything. |
@JasonTheAdams , @moettinger I've looked into my code and it works just fine with version 1.0.0-alpha.10. |
Hi @markokoleznik! Sorry, which part, exactly, are we wrapping in a timeout? The entire html2canvas call or just the onclone function? |
But If I modify the element inside the onclone, it never reflects in the generated PDF. I am not using html2canvas directly, I am using it through html2pdf which uses jsPDF and html2canvas inside. I am not sure how to make it work. |
@agiratech-vigneshm and others who might find this useful. I have been digging around to find a solution to this and was disappointed that I could find none. Here is my solution after going through html2pdf code. Unfortunately they don't document the lib very concisely and this is why we are glob-trotting looking for answers like this. import $ from 'jquery';
html2pdf()
.set({
margin: [10, 10],
filename: `blah.pdf`,
// don't use html2canvas onclone here
})
.from('source')
.toContainer()
.then(()=>{
const doc = $('.html2pdf__container');
doc.find('.remove-on-export').remove();
doc.find('.hide-on-export').hide();
doc.find('.show-on-export').show();
})
.save(); This enables me to manipulate the document however I like as you would in onclone. |
Thank you for answer it helped me a lot. And you are right about docs. |
Has the
onclone
callback removed? If yes, what's the recommended way of manipulating the cloned document?JSFiddle: http://jsfiddle.net/w8woox8c/3/
Specifications:
The text was updated successfully, but these errors were encountered: