Giter Site home page Giter Site logo

Comments (7)

ShawnKoga avatar ShawnKoga commented on June 25, 2024 5

@gregnb The repo seems to be working fairly well for me, but I have a component that gets split to multiple pages when I go to print. I am having an issue with the margins on the pages, when printed, cut off some information. Is there a way to account for this in my code to make sure everything is printed correctly? I think the sides can be accounted for easily enough by adding padding, but the repo seems to automatically split the component into multiple pages, so with no real way to know where the page breaks will be is there a way to account for the top and bottom dead space?

from react-to-print.

gregnb avatar gregnb commented on June 25, 2024

Thanks for the feedback! I'm not entirely sure about the issue can you provide a codesandbox to this example? I'll look into it

from react-to-print.

404sand808s avatar 404sand808s commented on June 25, 2024

Sure, I'm not sure it's even necessarily related to my implementation or even react-to-print. But here it is:

      <ReactToPrint
          trigger={() => <a href="#">Print this out!</a>}
          content={() => this.componentRef}
      />
      <div ref={el => (this.componentRef = el)}>
        <Label pre={this.props.pre} />
      </div>

It's pretty simple. The label itself is a simple component that doesn't have any special margins. Actually, what I've tested is putting multiple components within the targeted div and it prints them each out on a separate page perfectly. Only the first has a top margin of 8px I believe, the following ones don't. Thanks!

from react-to-print.

gregnb avatar gregnb commented on June 25, 2024

Ok I'll try to look into this. Thanks!

from react-to-print.

BrittMcDanel avatar BrittMcDanel commented on June 25, 2024

I am having the same issue as ShawnKoga, components will split in an ugly way over multiple pages. Is there a way to determine a page break. Even manually setting one would be good. Something like:

<Content>
   <div>Page one</div>
   <PageBreak />
   <div>Page two</div>
   <PageBreak />
   <div>Page three</div>
<Content>

I realize this is probably hard to do. Overall react-to-print is very good and is working well for me also.

from react-to-print.

simonschllng avatar simonschllng commented on June 25, 2024

One can control page breaks with CSS: https://www.w3schools.com/cssref/pr_print_pageba.asp

from react-to-print.

BrittMcDanel avatar BrittMcDanel commented on June 25, 2024

Thanks simon I was not aware of this.

from react-to-print.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.