cordova-plugin-printer icon indicating copy to clipboard operation
cordova-plugin-printer copied to clipboard

Variable Data not Printing

Open hatrain opened this issue 6 years ago • 1 comments

I created an HTML app with a print button that uses this plugin. It is mostly working, and looks great! The issue though is that variable data assigned to the textcontent of a div does not print. The page loads with "dummy text", it is then replaced with the real data after some JS code runs.

The new data shows up in the actual application just fine, but when printing the "dummy text" is displayed. I have tried printing the document using , innerHTML, location.href, and elementID. ElementID and innerHTML will pull variable data, but the QR code is missing, and all of the formatting in CSS is gone. Location.href prints with all formatting, but no variable data or QR code either.

Print function attached to button:

function print() { var page = document.getElementById("bblock"); cordova.plugins.printer.print(page, { name: 'Document'}); }

Using https://github.com/davidshimjs/qrcodejs for QR code:

QR creation code: new QRCode(pubQr, {text: pubKey, width: 128, height: 128}); pubQr is a variable attached to a div ID.

Any help would be greatly appreciated!!!

hatrain avatar Nov 19 '19 14:11 hatrain

@hatrain Can you post what you will get from this -document.getElementById("bblock")?

vishwas097 avatar Dec 13 '19 06:12 vishwas097