X
Tap here to go to the mobile version of the site.

Support Forum

Window.print() issue.

Posted

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?
Quote

Additional System Details

Application

  • User Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/604.1

More Information

jscher2000
  • Top 10 Contributor
8507 solutions 69502 answers

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?

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?
Was this helpful to you?
Quote

Question owner

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

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
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
8507 solutions 69502 answers

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?

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?
Was this helpful to you?
Quote

Question owner

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

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

Hi jscher, Please use this link below. it shows my problem. https://codepen.io/Kasun2019/pen/orzPvE
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
8507 solutions 69502 answers

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

I see, window.print() somehow captures the state of the document before the CSS is applied, maybe because it triggers on DOMContentLoaded??
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
8507 solutions 69502 answers

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

By the way, why not use an HTML table for the tabular data?
Was this helpful to you?
Quote

Question owner

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

no i cant use tables on that. can you suggest some patch or some setting on the firefox to overcome the problem??
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
8507 solutions 69502 answers

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...

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...
Was this helpful to you?
Quote

Question owner

Any suggestions for change some settings on firefox?

Any suggestions for change some settings on firefox?
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
8507 solutions 69502 answers

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.

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.
Was this helpful to you?
Quote
Ask a question

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.