Coder Social home page Coder Social logo

Comments (11)

melloware avatar melloware commented on June 9, 2024 1

OK the real issue is that jQuery.clone does not clone canvas elements. See: https://stackoverflow.com/questions/41239428/jquery-clone-does-not-clone-content-of-canvas

from jquery.print.

CitizenOfRome avatar CitizenOfRome commented on June 9, 2024 1

v1.6.1: Added full canvas support - https://doersguild.github.io/jQuery.print/demo/
Thanks!

from jquery.print.

mostafa-zahran avatar mostafa-zahran commented on June 9, 2024

I had the same issue but while investigating it I found that barcode is rendered as canvas
just render it as img tag and it should work fine

var image_div = $('{{NEW_IMAGE_TAG}}');
var canvas_div = $('{{BARCODE_CANVAS_ID}}');
if (image_div.length > 0 && canvas_div.length > 0) {
  image_div.html("<img src='" + canvas_div.children()[0].toDataURL("image/png") + "' alt='from canvas'/>");
}

from jquery.print.

prem-kumar-e avatar prem-kumar-e commented on June 9, 2024

But I am using CSS for barcode Rendering

from jquery.print.

CitizenOfRome avatar CitizenOfRome commented on June 9, 2024

Could you kindly check with the latest version v1.5.0 and let me know if the issue persists?
Also kindly experiment with larger timeouts to see if they help. Similarly try the iframe: false mode
Thanks!

from jquery.print.

guncebektas avatar guncebektas commented on June 9, 2024

+1 same issue

from jquery.print.

 avatar commented on June 9, 2024

any update ? i'm getting the same problem

from jquery.print.

CitizenOfRome avatar CitizenOfRome commented on June 9, 2024

@touqeer-wal Does setting a larger timeout or using the iframe: false mode make any difference?

Thanks!

from jquery.print.

touqeershafi avatar touqeershafi commented on June 9, 2024

I've set globalStyle option to false which fixed the issue. I think its due to bootstrap css which I'm using in my project. Iframe false does not solve this issue.

from jquery.print.

CitizenOfRome avatar CitizenOfRome commented on June 9, 2024

@touqeershafi, that makes sense.

The plugin works by putting your selected element and other attached globalStyles in a new, hidden iframe (or window) before printing it.

It would appear that the print is getting triggered while bootstrap and other dependencies are still being downloaded.

So, as an alternative to avoiding loading them completely with the globalStyles: false option, setting a larger timeout like timeout: 1500, and caching and minifying your printable dependencies so that they load faster should help

(Note: WIth v1.5.0, the timeout option now works as a fallback for when $(frameWindow).on("load", callPrint); fails to trigger soon enough)

from jquery.print.

melloware avatar melloware commented on June 9, 2024

I am using a canvas to try and print ChartsJS charts and have tried print({globalStyles:false,timeout:1500, iframe: false}); and none of it works. Changing my canvas to an image is not an option.

from jquery.print.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.