Giter Site home page Giter Site logo

can't print image about react-to-print HOT 15 CLOSED

gregnb avatar gregnb commented on June 25, 2024
can't print image

from react-to-print.

Comments (15)

kumaresan17 avatar kumaresan17 commented on June 25, 2024 1

@TheRogue76 Try background image as base64. Because the app doesn't know whether the image path will be absolute or relative path. for the first time loading it get confused. after it working fine. I tried it's working fine.

from react-to-print.

vademyanchik avatar vademyanchik commented on June 25, 2024

The same problem

from react-to-print.

gregnb avatar gregnb commented on June 25, 2024

What path is provided for the image? is it absolute? Or relative?

My guess is that it is a relative path and I need to fix the package to handle relative paths for images. That was a recent bug in the stylesheets that I should address here regardless

from react-to-print.

zhayes avatar zhayes commented on June 25, 2024

absolute path @gregnb

from react-to-print.

mezzab avatar mezzab commented on June 25, 2024

same problem

from react-to-print.

rafael-cineis avatar rafael-cineis commented on June 25, 2024

Any update? I'm having the same issue when trying to print an image using Edge. Using Chrome, Firefox and IE it works fine. Pressing CTRL+P works fine in Edge.

from react-to-print.

gregnb avatar gregnb commented on June 25, 2024

I just published 1.0.18 and I've added a debug mode. To turn it on add the debug={true} prop like so:

       <ReactToPrint
          trigger={() => <a href="#">Print this out!</a>}
          content={() => this.componentRef}
          debug={true}
        />

What this will do is when you click to print it'll open the print window but it will NOT print and it will NOT close. What I would like is if anyone experiencing issues could open up console and then look for any issues? Also, if they could paste the contents HTML elements like so below:

screen shot 2018-06-05 at 8 08 28 pm

from react-to-print.

ssxv avatar ssxv commented on June 25, 2024

I have an <img src="url" />
url is an Amazon S3 url.
When triggered, and the Print dialog opens,
I see the network tab, it doesn't request for this image, first time.
then I close the dialog.
And open again
this time it fetches the url.

from react-to-print.

ssxv avatar ssxv commented on June 25, 2024

my observations are, on trigger, it does not fetch the image first time.
on second trigger it fetches the image as 'octet-stream' and renders it in print dialog.
on further triggers, the image is not fetched, but is seen in the print dialog.

Hope this helps @gregnb

from react-to-print.

gregnb avatar gregnb commented on June 25, 2024

I would encourage anyone having issues to try the new beta version which is going to rely on an iframe to solve the cross origin issues some people are experiencing.

npm install [email protected]

and let me know the feedback if this solves issues

from react-to-print.

zhayes avatar zhayes commented on June 25, 2024

i have used https://www.npmjs.com/package/rc-print

from react-to-print.

brettkoz avatar brettkoz commented on June 25, 2024

Any update here? I'm having the same issue.

from react-to-print.

saraems avatar saraems commented on June 25, 2024

Hello, It's still not working. I have that issue. contains the img with src or the div with a background but it's not on the print. What is more it does not trigger print-system dialog while contains an image.

from react-to-print.

MatthewHerbst avatar MatthewHerbst commented on June 25, 2024

hello @saraems can you please possibly make a codesandbox showing the problem?

from react-to-print.

TheRogue76 avatar TheRogue76 commented on June 25, 2024

What path is provided for the image? is it absolute? Or relative?

My guess is that it is a relative path and I need to fix the package to handle relative paths for images. That was a recent bug in the stylesheets that I should address here regardless

Hi there. I'm using Electron and React for my project and while i can show the image in the app using import or require, the second i try to print it it vanishes. It's using a relative path for the image src. Calling the absolute path (ex: http://localhost:3000/static/media/logo1.0550988b.png) will work in development and show the image in both the app and the printed file, But this can not be done in production (the webpage files are not available). Any ideas?

from react-to-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.