Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controlling window properties (fullscreen, toolbar etc.) #37

Closed
codesignist opened this issue Jul 20, 2018 · 1 comment
Closed

Controlling window properties (fullscreen, toolbar etc.) #37

codesignist opened this issue Jul 20, 2018 · 1 comment

Comments

@codesignist
Copy link

Can we control all of the window parameters? I think this will be useful.
Actually I only need fullscreen property but controlling the other properties could be good.

https://github.com/gregnb/react-to-print/blob/f03aa02caf9a871b9cbf90e9a3c5d1a09fa4f144/src/index.js#L59

I think we could make an object property (windowParams) and override it.

class Example extends React.Component {
  render() {
    return (
      <div>
        <ReactToPrint
          windowParams={{
            fullscreen: 'yes',
          }}
          trigger={() => <a href="#">Print this out!</a>}
          content={() => this.componentRef}
        />
        <ComponentToPrint ref={el => (this.componentRef = el)} />
      </div>
    );
  }
}

And we could convert this object to string.
index.js

const windowParameters = {
  status: 'no',
  toolbar: 'no',
  scrollbar: 'yes',
  ...windowParams
}
//Need a good stringify algorithm or npm project
let printWindow = window.open("", "Print", windowParameters.stringifyProperly(), "false");

What do you think?

@gregnb
Copy link
Collaborator

gregnb commented Jul 21, 2018

@codesignist It sounds reasonable but I am hoping to get away from the older implementation done via a window popup and rely on the iframe one i created in the beta release. A lot of people have cross origin issues I would love to resolve with that

@gregnb gregnb closed this as completed Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants