Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Vanwege onderhoudswerkzaamheden die uw ervaring zouden moeten verbeteren, heeft deze website beperkte functionaliteit. Als een artikel uw probleem niet verhelpt en u een vraag wilt stellen, kan onze ondersteuningsgemeenschap u helpen in @FirefoxSupport op Twitter en /r/firefox op Reddit.

Zoeken in Support

Vermijd ondersteuningsscams. We zullen u nooit vragen een telefoonnummer te bellen, er een sms naar te sturen of persoonlijke gegevens te delen. Meld verdachte activiteit met de optie ‘Misbruik melden’.

Meer info

Deze conversatie is gearchiveerd. Stel een nieuwe vraag als u hulp nodig hebt.

Window.print() issue.

more options

I have used window.print() and window.close() functions for my application to load html page and once it is print, the window close automatically. But with new version (67) the printing details breaks into pieces and align to the left. How to solve that issue?

I have used window.print() and window.close() functions for my application to load html page and once it is print, the window close automatically. But with new version (67) the printing details breaks into pieces and align to the left. How to solve that issue?

Alle antwoorden (10)

more options

Hi Dilum2019, what do you mean by "the printing details"? If you view the page in Print Preview, does it show the same problem, or is it specific to the window.print() script function?

more options

Hi Jscher2000 , printing details means the content which I want to print. Preview comes right. But prints gonna align left and break in to words. That issue comes because of the windows.print() not gonna support in newer version

more options

Hi Dilum2019, I'm puzzled why you get a different result between Print Preview and window.print() on the identical content. Can you provide a link to a page demonstrating the problem?

more options

Hi jscher, Please use this link below. it shows my problem.

https://codepen.io/Kasun2019/pen/orzPvE

more options

I see, window.print() somehow captures the state of the document before the CSS is applied, maybe because it triggers on DOMContentLoaded??

more options

By the way, why not use an HTML table for the tabular data?

more options

no i cant use tables on that. can you suggest some patch or some setting on the firefox to overcome the problem??

more options

I think you need to find a way to defer window.print() running until document.load. Maybe in an external script file?

Or the user can print it themselves...

more options

Any suggestions for change some settings on firefox?

more options

Sorry, I looked at the CSS preferences, but nothing leaped out at me as being responsible for whether the script runs before or after the CSS is applied. Maybe you'll see something if you experiment.