Giter VIP home page Giter VIP logo

Comments (12)

gregnb avatar gregnb commented on July 19, 2024

Could you paste the exact code you used?

from react-to-print.

lanhnguyen2010 avatar lanhnguyen2010 commented on July 19, 2024

I follow exactly your example.

return (  
            <div className='animated fadeIn'>  
              <ReactToPrint
                trigger={() => <a href="#">Print this out!</a>}
                content={() => this.componentRef}
              />
                <div className='email-app mb-4' ref={el => (this.componentRef = el)}>
                    <main className='message'>
                        <div className='details'>
                            <div className='title'>{email ? email.subject : ''}</div>
                            {/*TODO get user avatar*/}
                            <div className='header'><img className='avatar' alt='avatar' src='/img/avatars/1.jpg' />
                                <div className='from'>
                                    <span>{email.contact.firstName || email.contact.lastName ? email.contact.firstName + ' ' + email.contact.lastName : ''}</span>
                                    {email.contact.email ? email.contact.email : null}
                                </div>
                                <div
                                    className='date'>{email ? moment(email.createdAt).format('MMMM Do YYYY, h:mm:ss a') : null}</div>
                            </div>
                            <div className='content'>
                                <p>{email ? ReactHtmlParser(entities.decode(email.content)) : null}</p>
                            </div>
                            <span>Characters: <Badge color={'info'} style={{ fontSize: 12 }}>{characters}</Badge></span>{' '}
                            <span>Attachments: <Badge color={'info'} style={{ fontSize: 12 }}>{attachments}</Badge></span>{' '}
                            <span>Total Coins: <Badge id={'totalCoins'} color={'success'} style={{
                                fontSize: 14,
                                cursor: 'pointer'
                            }}>{calculateCoins(characters, attachments, true)}</Badge></span>{' '}
                            <Tooltip placement="top" style={{width: 250}} isOpen={this.state.toolTipCoin}
                                     target="totalCoins" toggle={this.toggleToolTipCoin.bind(this)}>
                                <p>How we calculate coin???</p>
                                <p>3000 chars = 1 page</p>
                                <p>1 Attachment = 1 page</p>
                                <p>3 page = 1 coin</p>
                                <p>inside Canada = total coin x 1 coin</p>
                            </Tooltip>
                        </div>
                    </main>
                </div>
            </div>
        )```

from react-to-print.

gregnb avatar gregnb commented on July 19, 2024

Ok thank you. I will look into this

from react-to-print.

lanhnguyen2010 avatar lanhnguyen2010 commented on July 19, 2024

Thank you.
Btw, Can you share an example in that we can preview image so that I can follow it.

Thanks

from react-to-print.

gregnb avatar gregnb commented on July 19, 2024

Sure I'll work on that. Thanks for the feedback

from react-to-print.

gregnb avatar gregnb commented on July 19, 2024

Try the latest version 1.0.5 this should be addressed

from react-to-print.

lanhnguyen2010 avatar lanhnguyen2010 commented on July 19, 2024

thanks, I tried that. New problem:
The app open and print homepage instead of the current page when clicking on the link?

from react-to-print.

gregnb avatar gregnb commented on July 19, 2024

Ah boy, alright I'll take a look at that too. Sorry!

from react-to-print.

gregnb avatar gregnb commented on July 19, 2024

@lanhnguyen2010 Can you please try 1.0.6 ? Just made another update. My tests so far are stable but noticing some inconsistencies in Chrome sometimes. Would love your feedback

from react-to-print.

gregnb avatar gregnb commented on July 19, 2024

@lanhnguyen2010 did that help?

from react-to-print.

lanhnguyen2010 avatar lanhnguyen2010 commented on July 19, 2024

I already did it by myself using css, @media print. I will try your component later. Thanks a lot.

from react-to-print.

gregnb avatar gregnb commented on July 19, 2024

No problem

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.