Hi!
I dont know if I am doing something wrong with this.
I am using TypeScript in a SharePoint context.
myComponent to be printed has it owns css (as _name_.module.scss). If I render the component in the render of React works fine, but when I use the ref into the
Someone can help me?
<ReactToPrint
trigger={() => <p>Printer Fn </p>}
content={() => this.testTitleRef1.current}
copyStyles={false}
onBeforeGetContent={()=> this.onBeforeGetContent()}
onBeforePrint={() => this.onBeforePrint()}
onAfterPrint={() => this.onAfterPrint()}
onPrintError={(el, e) => this.onPrintError(el, e)}
/>
// the component to print (a functional component)
<div ref={props.refComp} className={styles["body-page"]}>
<h1>{props.count}</h1>
<p className={styles["text"]}>Texto</p>
</div>;
Hello. Can you please post a working (codesandbox or equivalent) code example so we can see exactly what the problem is? Thank you
Yes of course
https://codesandbox.io/s/friendly-davinci-pdpn3?fontsize=14&hidenavigation=1&theme=dark
another question. Where I can find the full documentation of the reacto-to-print
UPDATE:
I realized that the problem is the " copyStyles={true}" accessory.
My apologies.
I updated the codeSandBox for Class component and Functional component
Great module!
Does not exist any problem. Set prop copyStyles = true to maintain styles from component itself
Most helpful comment
Does not exist any problem. Set prop copyStyles = true to maintain styles from component itself