printing
See original GitHub issueTrying to print an html element’s content using the os print dialog. I have the following code snippet that launches the print dialog with expected content in the device browser.
const printContent = document.getElementById('print-container');
const prtFrame = document.getElementById("iframe_to_print").contentWindow;
prtFrame.document.open();
prtFrame.document.write(printContent.innerHTML);
prtFrame.document.close();
prtFrame.focus();
prtFrame.print();
However nothing just happens within react-native app using the webview.
- webview version: 8.1.0
- react-native: 0.61.5
Looks like something is preventing the system print dialog from showing up in the app.
Is there a step that I’m overlooking or another known way of doing printing in webview?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9
Top Results From Across the Web
Vistaprint US Online Printing: Business Cards, Signage & More
Create and order printed marketing materials, business signs, and promotional products directly from your office. Satisfaction Absolutely Guaranteed.
Read more >Printing & Marketing Services | Staples®
Shop Staples Print Marketing Services for affordable copies, custom business cards, business stationery, promotional items, & more. Fast shipping available.
Read more >Printing - Wikipedia
Printing is a process for mass reproducing text and images using a master form or template. The earliest non-paper products involving printing include ......
Read more >Prints | Order Photo Prints Online - Shutterfly
Prints by Mail or in Minutes. Get your photos as quickly as you need them — place an order for delivery or pick...
Read more >Print on Demand Online Printing - FedEx Office
Use the FedEx Office online printing tool to quickly and easily create, edit, and order custom business cards, posters, brochures, canvas prints and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks!
Unfortunately what I need to do is printing a PDF file shown inside web view.
Doesn’t seem possible to fetch its data from web view using messaging. Because it’s a PDF, not HTML content.
I probably need to download the PDF and use some sort of library to display it separately from web view, and print it out. But so far I could only find some commercial solutions without even pricing announced. I’m currently researching this approach but no clear solution yet.
I can’t even open PDF inside OS browser because it requires some specific authentication cookies to be set before PDF can be served to a user 😦
Would’ve been nice to just be able to have a print command 🤷♂️
I had tip: I used postMessage event of react-native-webview to send data to native app, then used react-native-print lib to print as desired