question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onclone callback removed?

See original GitHub issue

Has the onclone callback removed? If yes, what’s the recommended way of manipulating the cloned document?

JSFiddle: http://jsfiddle.net/w8woox8c/3/

Specifications:

  • html2canvas version tested with: 1.0.0-alpha.9
  • Browser & version: Chrome 63
  • Operating system: Windows 8, Ubuntu 17.10

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:9

github_iconTop GitHub Comments

13reactions
agiratech-vigneshmcommented, Apr 24, 2018

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.

3reactions
emahunicommented, Jul 18, 2020

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

onClose callback - MicroAPL
The default handler for a Close event is to close and delete the object, but doing this would make it impossible for your...
Read more >
Callback functions - Vanilla Embed Library - Typeform's APIs
The onClose callback will execute after a respondent closes the modal window the typeform is embedded in. The event is sent regardless of...
Read more >
bpopup onClose callback event not working - Stack Overflow
It looks like your code actually triggers the pop twice. Try this: $('.flipvideowrap').bind('click', function(e) { e.
Read more >
How to separate callback function from MessageBox.
Hello, I am trying to create a function to delete data after user press delete button on MessageBox of confirmation.
Read more >
Callbacks - Argyle Docs
This callback function provides accountId , userId , and linkItemId . onClose, func optional, A callback function invoked immediately after the user closes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found