Comments (12)
Could you paste the exact code you used?
from react-to-print.
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.
Ok thank you. I will look into this
from react-to-print.
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.
Sure I'll work on that. Thanks for the feedback
from react-to-print.
Try the latest version 1.0.5 this should be addressed
from react-to-print.
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.
Ah boy, alright I'll take a look at that too. Sorry!
from react-to-print.
@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.
@lanhnguyen2010 did that help?
from react-to-print.
I already did it by myself using css, @media print. I will try your component later. Thanks a lot.
from react-to-print.
No problem
from react-to-print.
Related Issues (20)
- codesandbox examples are not loading HOT 2
- onAfterPrint is called before print iframe appears HOT 1
- On mobile devices are not truncated accordingly ref HOT 1
- Add Border to every Page HOT 4
- Add dynamic colors to print function HOT 1
- How to check that the user click on Save in `onAfterPrint`? HOT 2
- getting Supplied Data is not a valid base64-String jsPDF.convertStringToImageData erorr while directly downloading image HOT 1
- Border top and bottom HOT 1
- Save as PDF hangs in print view HOT 1
- Blank PDF when trying to generate in production. HOT 2
- How should i handle large data to print? HOT 8
- Why does it render different content when in im browsing in mobile HOT 3
- Blank Page while printing after a certain period of time HOT 9
- How to add style using PageStyle prop, without it overriding component’s style HOT 5
- Warning: findDOMNode is deprecated outside StrictMode. HOT 10
- Unhandled error when trying to print not fully loaded canvas elements HOT 3
- HTML doctype declaration is displaying on top of the print dialog window HOT 10
- Print datatables HOT 4
- CSS "break-before" (replacing "page-break-before") not supported HOT 3
- '.brf' file : Change the save directory. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-to-print.