derhuerst / print-any-html

Let the browser print any HTML string.
http://derhuerst.github.io/print-any-html/example.html
ISC License
0 stars 2 forks source link

wait for iframe load event before printing #1

Open Rehan1579 opened 7 years ago

Rehan1579 commented 7 years ago

Hi.

I'm using your plugin and it works great and very simple to use but I'm having a problem with it. It does not show page-break in the preview. I tried printing the doc, but still it was only 1 page. I've attached my html, might be somthing wrong in my html.

myHTML.txt

Kindly, help me.

derhuerst commented 7 years ago

In Safari 11 as well as Chromium 56, I got two pages, the table is on the second. Can you tell me specifically how to reproduce the problem?

Rehan1579 commented 7 years ago

I'm working on a Angular-Ionic project. Following are the steps which i followed.

1- Installed your plugin using npm install --save print-any-html. 2- Imported {print} from "html-to-printer" in my desired class 3- passed the following html in your print()

9/28/2017

Your trigger emotion is "Hope"

 
Indifferent Feelings
Reserved Neutral Nonchalant
Afraid Feelings
Suspicious Anxious Alarmed Panic
Nervous

I've checked it in Chrome, FireFox and Safari but still i'm getting only 1 page.

image

derhuerst commented 7 years ago

Oh. This seems to be because the image hasn't been loaded before by the browser. I remember that I had a similar effect. After cancelling and clicking "print" again, there were two pages.

This might be something that print-any-html can fix by listening for the load event on the hidden iframe. edit: you might want to use script-onload for this.