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

Why is page-break-before:always not working in Edge / Webview2 #3715

Closed
ajtruckle opened this issue Aug 16, 2023 · 1 comment
Closed

Why is page-break-before:always not working in Edge / Webview2 #3715

ajtruckle opened this issue Aug 16, 2023 · 1 comment

Comments

@ajtruckle
Copy link

I also asked this on StackOverflow.

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>
          Assignment Slips
        </title>
    <style type="text/css">
          @import url('s-89-eng.css');
        </style>
  </head>
  <body>
    <div class="containerPage">
      <div class="containerSlip">
        <img alt="s89" width="323px" height="429px" src="s-89-eng.jpg" />
        <div class="fieldName">xxx</div>
        <div class="fieldAssisant">
        </div>
        <div class="fieldDate">Thursday 6 July 2023</div>
        <div class="fieldCounsel">#5 Accurate Reading</div>
        <div class="checkBibleReading">✓</div>
        <div class="checkMainHall">✓</div>
      </div>
    </div>
    <div class="containerPage" style="page-break-before: always">
      <div class="containerSlip">
        <img alt="s89" width="323px" height="429px" src="s-89-eng.jpg" />
        <div class="fieldName">xxx</div>
        <div class="fieldAssisant">xxx</div>
        <div class="fieldDate">Thursday 6 July 2023</div>
        <div class="fieldCounsel">1st: #1 Effective Introduction</div>
        <div class="checkInitialCall">✓</div>
        <div class="fieldInitialCallIndex">1</div>
        <div class="checkMainHall">✓</div>
      </div>
    </div>
    <div class="containerPage" style="page-break-before: always">
      <div class="containerSlip">
        <img alt="s89" width="323px" height="429px" src="s-89-eng.jpg" />
        <div class="fieldName">xxx</div>
        <div class="fieldAssisant">xxx</div>
        <div class="fieldDate">Thursday 6 July 2023</div>
        <div class="fieldCounsel">2nd: #9 Appropriate Use of Visual Aids</div>
        <div class="checkInitialCall">✓</div>
        <div class="fieldInitialCallIndex">2</div>
        <div class="checkMainHall">✓</div>
      </div>
    </div>
  </body>
</html>

CSS

<style type="text/css">
body {
    font-family: 'Arial Unicode MS';
    font-size: 10pt;
}
.containerPage {
}
.containerSlip{
    float:left;
    position: relative; 
    margin: 3mm;
}
.fieldName {
    position: absolute;
    left: 69px; top: 55px;  width: 232px;
}
.fieldAssisant {
    position: absolute;
    left: 98px; top: 86px;  width: 208px;
}
.fieldInitialCallIndex {
    
    position: absolute;
    left: 55px; top: 215px; width: 100px;
    background-color:yellow;
    font-size: 7pt;
}
.fieldReturnVisitIndex {
    position: absolute;
    left: 55px; top: 244px; width: 100px;
    background-color:yellow;
    font-size: 7pt;
}
.fieldDate {
    position: absolute;
    left: 62px; top: 118px; width: 239px;
}
.fieldCounsel {
    position: absolute;
    left: 15px; top: 145px; width: 295px;
    background-color:yellow;
}
.fieldOther {
    position: absolute;
    left: 245px; top: 215px; width: 53px;
    font-size: 8pt;
}
.checkBibleReading {
    position: absolute;
    left: 35px; top: 182px; width: 15px;
}
.checkInitialCall {
    position: absolute;
    left: 35px; top: 195px; width: 15px;
}
.checkReturnVisit {
    position: absolute;
    left: 35px; top: 225px; width: 15px;
}
.checkBibleStudy {
    position: absolute;
    left: 190px; top: 182px; width: 15px;
}
.checkTalk {
    position: absolute;
    left: 190px; top: 196px; width: 15px;
}
.checkOther {
    position: absolute;
    left: 190px; top: 210px; width: 15px;
}
.checkMainHall {
    position: absolute;
    left: 35px; top: 280px; width: 15px;
}
.checkAuxClass1 {
    position: absolute;
    left: 35px; top: 295px; width: 15px;
}
.checkAuxClass2 {
    position: absolute;
    left: 35px; top: 309px; width: 15px;
}
</style>

Image

s-89-eng

Why is it that in Edge / Webview2 that trying to print this to PDF is not respecting the page-break-before?

In my application I let the user specify how many items to have on a page, at which point it inserts the break. Why is this not working and how to resolve?

@ajtruckle
Copy link
Author

This can be closed. If you click the StackOverflow link you'll see the solution.

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

1 participant