scrummy
scrummy

Reputation: 795

HTML Print a Page with JS

I have a problem, with html print function. So my plan is the following. I have a page in the /help-center/ folder as index.html. So I want to do the following: As you can see in the picture there is a "Print" link. So when the user clicks on it, it should print the /help-center/pdf/terms.html file.

This is a code: Print this page

And I want to do that to set the parameters to print the /help-center/terms.html page

The image: https://ibb.co/j59JmcF

Upvotes: 4

Views: 347

Answers (1)

Nads
Nads

Reputation: 109

As i understand this is what you want?

function printPreview(){
  var targetFile= window.open('/path/to/file');
      targetFile.print(); 
}

Upvotes: 2

Related Questions