HTML ASP Classic How to remove empty page2 when Printing












0














I am trying to print my records arranging it using basic HTML table. I manage to arrange everything accordingly. I have also run a loop to insert some empty lines to fill the gap if the records are less. This will push the footer to the bottom of the page. The problem is when I click Print. It always gives me 2 sheets with sheet 2 being completely empty. I have tried to reduce the number of records and make sure it is only one page. But after hitting Print, it still shows 2 pages with page 2 being empty. Anyway to remove page 2, Please help



<html>
<body>
<center>
<%
call pageHeader()

dTotNet_Amt = 0

do while not rstERSLS1.eof

record = record + 1

dNet_Amt = rstERSLS1("NET_AMT")

dTotNet_Amt = dTotNet_Amt + dNet_Amt

response.write "<tr>"
response.write "<td align=left width=50><font face='Arial' size=2>" & record & "</td>"
response.write "<td align=left width=600 ><font face='Arial' size=2>" & rstERSLS1("PART") & "</td>"
response.write "<td align=left width=100 ><font face='Arial' size=2>" & rstERSLS1("SERIALNO") & "</td>"
response.write "<td align=right width=100 ><font face='Arial' size=2>" & pFormatDec(dNet_Amt,2) & "</td>"
response.write "</tr>"

rstERSLS1.movenext
'=== recordPerPage = 30
if record >= recordPerPage and not rstERSLS1.eof then
record = 0
sPage = sPage + 1

response.write"</table>"
response.write "<br/>"
response.write "<font face='Arial' size=1>"
response.Write"Continue Next Page..."
response.Write"<p style='page-break-before: always'></p>"

call pageHeader()

elseif rstERSLS1.eof then
'==== Fill the empty space and drag the footer to the bottom
do until record >= recordPerPage
record = record + 1
response.write "<td colspan=4 >&nbsp;&nbsp;</td>"
response.write "</tr>"
loop

end if

Loop
pCloseTables(rstERSLS1)

%>

'==== Footer
<table width="850">
<tr>
<td colspan=3 align=left width=700><font face="Arial" size=2>RINGGIT MALAYSIA : <%= ConvertCurrencyToEnglish(pFormatDec(dTotNet_Amt,2))%></td>
</tr>
<tr>
<td colspan="5">
<hr color=black style="margin-top:0px;margin-bottom:0px" size=1>
</td>
</tr>
</table>
<table width="850">
<tr>
<td colspan="3" align=left width=600><font face="Arial" size=2></font>E & OE</td>
<td align=left width=100><font face="Arial" size=2><b>Total (RM) : </b></font></td>
<td align=right width=100><font face="Arial" size=2><b>RM <%=pFormatDec(dTotNet_Amt,2)%></b></></font></td>

</tr>
<tr>
<td colspan="3" align=left width=600></td>
<td colspan="2">
<hr color=black style="margin-top:0px;margin-bottom:0px" size=2>
</td>
</tr>
<tr>
<td colspan="3"width=600></td>
<td colspan=2 align=left width=100><font face="Arial" size=1>Lorry Number : </font></td>
</tr>
<tr>
<td align=left width=250>______________________________</td>
<td align=left width=50></td>
<td align=left width=250>______________________________</td>
<td colspan=2 align=left width=100><font face="Arial" size=1>Driver Signature : </font></td>
</tr>
<tr>
<td align=left width=250><font face="Arial" size=2>&nbsp;&nbsp;&nbsp;&nbsp;AUTHORISED SIGNATURE(S)</font></td>
<td align=left width=50></td>
<td align=left width=250><font face="Arial" size=2>&nbsp;&nbsp;&nbsp;&nbsp;RECIPIENT'S CHOP & SIGNATURE</font></td>
<td colspan="2" align="left" width=100><font face="Arial" size=1>Store Keeper: </font></td>
</tr>
</table>
<p style='page-break-after: always'></p> '=== This doesn't work
</center>
</body>
</html>


Always empty one extra page



Always Page 2










share|improve this question






















  • Are you sure it's not the page-break-after: always that is causing the extra page?
    – johna
    Nov 14 '18 at 21:24










  • its I deleted the 'page-break-after: always' it is still the same. Where was the link that someone just posted earlier?
    – Hanz Cheah
    Nov 15 '18 at 4:53










  • this one? how to avoid extra blank page at end while printing?
    – SearchAndResQ
    Nov 15 '18 at 5:10










  • I have follow this stackoverflow.com/questions/1763639/… But still when the records is only 1 page, it will always give me an empty 2nd page but if the records is more than 1 page, everything is fine meaning I don't get an extra empty page?
    – Hanz Cheah
    Nov 15 '18 at 6:25
















0














I am trying to print my records arranging it using basic HTML table. I manage to arrange everything accordingly. I have also run a loop to insert some empty lines to fill the gap if the records are less. This will push the footer to the bottom of the page. The problem is when I click Print. It always gives me 2 sheets with sheet 2 being completely empty. I have tried to reduce the number of records and make sure it is only one page. But after hitting Print, it still shows 2 pages with page 2 being empty. Anyway to remove page 2, Please help



<html>
<body>
<center>
<%
call pageHeader()

dTotNet_Amt = 0

do while not rstERSLS1.eof

record = record + 1

dNet_Amt = rstERSLS1("NET_AMT")

dTotNet_Amt = dTotNet_Amt + dNet_Amt

response.write "<tr>"
response.write "<td align=left width=50><font face='Arial' size=2>" & record & "</td>"
response.write "<td align=left width=600 ><font face='Arial' size=2>" & rstERSLS1("PART") & "</td>"
response.write "<td align=left width=100 ><font face='Arial' size=2>" & rstERSLS1("SERIALNO") & "</td>"
response.write "<td align=right width=100 ><font face='Arial' size=2>" & pFormatDec(dNet_Amt,2) & "</td>"
response.write "</tr>"

rstERSLS1.movenext
'=== recordPerPage = 30
if record >= recordPerPage and not rstERSLS1.eof then
record = 0
sPage = sPage + 1

response.write"</table>"
response.write "<br/>"
response.write "<font face='Arial' size=1>"
response.Write"Continue Next Page..."
response.Write"<p style='page-break-before: always'></p>"

call pageHeader()

elseif rstERSLS1.eof then
'==== Fill the empty space and drag the footer to the bottom
do until record >= recordPerPage
record = record + 1
response.write "<td colspan=4 >&nbsp;&nbsp;</td>"
response.write "</tr>"
loop

end if

Loop
pCloseTables(rstERSLS1)

%>

'==== Footer
<table width="850">
<tr>
<td colspan=3 align=left width=700><font face="Arial" size=2>RINGGIT MALAYSIA : <%= ConvertCurrencyToEnglish(pFormatDec(dTotNet_Amt,2))%></td>
</tr>
<tr>
<td colspan="5">
<hr color=black style="margin-top:0px;margin-bottom:0px" size=1>
</td>
</tr>
</table>
<table width="850">
<tr>
<td colspan="3" align=left width=600><font face="Arial" size=2></font>E & OE</td>
<td align=left width=100><font face="Arial" size=2><b>Total (RM) : </b></font></td>
<td align=right width=100><font face="Arial" size=2><b>RM <%=pFormatDec(dTotNet_Amt,2)%></b></></font></td>

</tr>
<tr>
<td colspan="3" align=left width=600></td>
<td colspan="2">
<hr color=black style="margin-top:0px;margin-bottom:0px" size=2>
</td>
</tr>
<tr>
<td colspan="3"width=600></td>
<td colspan=2 align=left width=100><font face="Arial" size=1>Lorry Number : </font></td>
</tr>
<tr>
<td align=left width=250>______________________________</td>
<td align=left width=50></td>
<td align=left width=250>______________________________</td>
<td colspan=2 align=left width=100><font face="Arial" size=1>Driver Signature : </font></td>
</tr>
<tr>
<td align=left width=250><font face="Arial" size=2>&nbsp;&nbsp;&nbsp;&nbsp;AUTHORISED SIGNATURE(S)</font></td>
<td align=left width=50></td>
<td align=left width=250><font face="Arial" size=2>&nbsp;&nbsp;&nbsp;&nbsp;RECIPIENT'S CHOP & SIGNATURE</font></td>
<td colspan="2" align="left" width=100><font face="Arial" size=1>Store Keeper: </font></td>
</tr>
</table>
<p style='page-break-after: always'></p> '=== This doesn't work
</center>
</body>
</html>


Always empty one extra page



Always Page 2










share|improve this question






















  • Are you sure it's not the page-break-after: always that is causing the extra page?
    – johna
    Nov 14 '18 at 21:24










  • its I deleted the 'page-break-after: always' it is still the same. Where was the link that someone just posted earlier?
    – Hanz Cheah
    Nov 15 '18 at 4:53










  • this one? how to avoid extra blank page at end while printing?
    – SearchAndResQ
    Nov 15 '18 at 5:10










  • I have follow this stackoverflow.com/questions/1763639/… But still when the records is only 1 page, it will always give me an empty 2nd page but if the records is more than 1 page, everything is fine meaning I don't get an extra empty page?
    – Hanz Cheah
    Nov 15 '18 at 6:25














0












0








0







I am trying to print my records arranging it using basic HTML table. I manage to arrange everything accordingly. I have also run a loop to insert some empty lines to fill the gap if the records are less. This will push the footer to the bottom of the page. The problem is when I click Print. It always gives me 2 sheets with sheet 2 being completely empty. I have tried to reduce the number of records and make sure it is only one page. But after hitting Print, it still shows 2 pages with page 2 being empty. Anyway to remove page 2, Please help



<html>
<body>
<center>
<%
call pageHeader()

dTotNet_Amt = 0

do while not rstERSLS1.eof

record = record + 1

dNet_Amt = rstERSLS1("NET_AMT")

dTotNet_Amt = dTotNet_Amt + dNet_Amt

response.write "<tr>"
response.write "<td align=left width=50><font face='Arial' size=2>" & record & "</td>"
response.write "<td align=left width=600 ><font face='Arial' size=2>" & rstERSLS1("PART") & "</td>"
response.write "<td align=left width=100 ><font face='Arial' size=2>" & rstERSLS1("SERIALNO") & "</td>"
response.write "<td align=right width=100 ><font face='Arial' size=2>" & pFormatDec(dNet_Amt,2) & "</td>"
response.write "</tr>"

rstERSLS1.movenext
'=== recordPerPage = 30
if record >= recordPerPage and not rstERSLS1.eof then
record = 0
sPage = sPage + 1

response.write"</table>"
response.write "<br/>"
response.write "<font face='Arial' size=1>"
response.Write"Continue Next Page..."
response.Write"<p style='page-break-before: always'></p>"

call pageHeader()

elseif rstERSLS1.eof then
'==== Fill the empty space and drag the footer to the bottom
do until record >= recordPerPage
record = record + 1
response.write "<td colspan=4 >&nbsp;&nbsp;</td>"
response.write "</tr>"
loop

end if

Loop
pCloseTables(rstERSLS1)

%>

'==== Footer
<table width="850">
<tr>
<td colspan=3 align=left width=700><font face="Arial" size=2>RINGGIT MALAYSIA : <%= ConvertCurrencyToEnglish(pFormatDec(dTotNet_Amt,2))%></td>
</tr>
<tr>
<td colspan="5">
<hr color=black style="margin-top:0px;margin-bottom:0px" size=1>
</td>
</tr>
</table>
<table width="850">
<tr>
<td colspan="3" align=left width=600><font face="Arial" size=2></font>E & OE</td>
<td align=left width=100><font face="Arial" size=2><b>Total (RM) : </b></font></td>
<td align=right width=100><font face="Arial" size=2><b>RM <%=pFormatDec(dTotNet_Amt,2)%></b></></font></td>

</tr>
<tr>
<td colspan="3" align=left width=600></td>
<td colspan="2">
<hr color=black style="margin-top:0px;margin-bottom:0px" size=2>
</td>
</tr>
<tr>
<td colspan="3"width=600></td>
<td colspan=2 align=left width=100><font face="Arial" size=1>Lorry Number : </font></td>
</tr>
<tr>
<td align=left width=250>______________________________</td>
<td align=left width=50></td>
<td align=left width=250>______________________________</td>
<td colspan=2 align=left width=100><font face="Arial" size=1>Driver Signature : </font></td>
</tr>
<tr>
<td align=left width=250><font face="Arial" size=2>&nbsp;&nbsp;&nbsp;&nbsp;AUTHORISED SIGNATURE(S)</font></td>
<td align=left width=50></td>
<td align=left width=250><font face="Arial" size=2>&nbsp;&nbsp;&nbsp;&nbsp;RECIPIENT'S CHOP & SIGNATURE</font></td>
<td colspan="2" align="left" width=100><font face="Arial" size=1>Store Keeper: </font></td>
</tr>
</table>
<p style='page-break-after: always'></p> '=== This doesn't work
</center>
</body>
</html>


Always empty one extra page



Always Page 2










share|improve this question













I am trying to print my records arranging it using basic HTML table. I manage to arrange everything accordingly. I have also run a loop to insert some empty lines to fill the gap if the records are less. This will push the footer to the bottom of the page. The problem is when I click Print. It always gives me 2 sheets with sheet 2 being completely empty. I have tried to reduce the number of records and make sure it is only one page. But after hitting Print, it still shows 2 pages with page 2 being empty. Anyway to remove page 2, Please help



<html>
<body>
<center>
<%
call pageHeader()

dTotNet_Amt = 0

do while not rstERSLS1.eof

record = record + 1

dNet_Amt = rstERSLS1("NET_AMT")

dTotNet_Amt = dTotNet_Amt + dNet_Amt

response.write "<tr>"
response.write "<td align=left width=50><font face='Arial' size=2>" & record & "</td>"
response.write "<td align=left width=600 ><font face='Arial' size=2>" & rstERSLS1("PART") & "</td>"
response.write "<td align=left width=100 ><font face='Arial' size=2>" & rstERSLS1("SERIALNO") & "</td>"
response.write "<td align=right width=100 ><font face='Arial' size=2>" & pFormatDec(dNet_Amt,2) & "</td>"
response.write "</tr>"

rstERSLS1.movenext
'=== recordPerPage = 30
if record >= recordPerPage and not rstERSLS1.eof then
record = 0
sPage = sPage + 1

response.write"</table>"
response.write "<br/>"
response.write "<font face='Arial' size=1>"
response.Write"Continue Next Page..."
response.Write"<p style='page-break-before: always'></p>"

call pageHeader()

elseif rstERSLS1.eof then
'==== Fill the empty space and drag the footer to the bottom
do until record >= recordPerPage
record = record + 1
response.write "<td colspan=4 >&nbsp;&nbsp;</td>"
response.write "</tr>"
loop

end if

Loop
pCloseTables(rstERSLS1)

%>

'==== Footer
<table width="850">
<tr>
<td colspan=3 align=left width=700><font face="Arial" size=2>RINGGIT MALAYSIA : <%= ConvertCurrencyToEnglish(pFormatDec(dTotNet_Amt,2))%></td>
</tr>
<tr>
<td colspan="5">
<hr color=black style="margin-top:0px;margin-bottom:0px" size=1>
</td>
</tr>
</table>
<table width="850">
<tr>
<td colspan="3" align=left width=600><font face="Arial" size=2></font>E & OE</td>
<td align=left width=100><font face="Arial" size=2><b>Total (RM) : </b></font></td>
<td align=right width=100><font face="Arial" size=2><b>RM <%=pFormatDec(dTotNet_Amt,2)%></b></></font></td>

</tr>
<tr>
<td colspan="3" align=left width=600></td>
<td colspan="2">
<hr color=black style="margin-top:0px;margin-bottom:0px" size=2>
</td>
</tr>
<tr>
<td colspan="3"width=600></td>
<td colspan=2 align=left width=100><font face="Arial" size=1>Lorry Number : </font></td>
</tr>
<tr>
<td align=left width=250>______________________________</td>
<td align=left width=50></td>
<td align=left width=250>______________________________</td>
<td colspan=2 align=left width=100><font face="Arial" size=1>Driver Signature : </font></td>
</tr>
<tr>
<td align=left width=250><font face="Arial" size=2>&nbsp;&nbsp;&nbsp;&nbsp;AUTHORISED SIGNATURE(S)</font></td>
<td align=left width=50></td>
<td align=left width=250><font face="Arial" size=2>&nbsp;&nbsp;&nbsp;&nbsp;RECIPIENT'S CHOP & SIGNATURE</font></td>
<td colspan="2" align="left" width=100><font face="Arial" size=1>Store Keeper: </font></td>
</tr>
</table>
<p style='page-break-after: always'></p> '=== This doesn't work
</center>
</body>
</html>


Always empty one extra page



Always Page 2







html printing html-table asp-classic






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 8:43









Hanz CheahHanz Cheah

122219




122219












  • Are you sure it's not the page-break-after: always that is causing the extra page?
    – johna
    Nov 14 '18 at 21:24










  • its I deleted the 'page-break-after: always' it is still the same. Where was the link that someone just posted earlier?
    – Hanz Cheah
    Nov 15 '18 at 4:53










  • this one? how to avoid extra blank page at end while printing?
    – SearchAndResQ
    Nov 15 '18 at 5:10










  • I have follow this stackoverflow.com/questions/1763639/… But still when the records is only 1 page, it will always give me an empty 2nd page but if the records is more than 1 page, everything is fine meaning I don't get an extra empty page?
    – Hanz Cheah
    Nov 15 '18 at 6:25


















  • Are you sure it's not the page-break-after: always that is causing the extra page?
    – johna
    Nov 14 '18 at 21:24










  • its I deleted the 'page-break-after: always' it is still the same. Where was the link that someone just posted earlier?
    – Hanz Cheah
    Nov 15 '18 at 4:53










  • this one? how to avoid extra blank page at end while printing?
    – SearchAndResQ
    Nov 15 '18 at 5:10










  • I have follow this stackoverflow.com/questions/1763639/… But still when the records is only 1 page, it will always give me an empty 2nd page but if the records is more than 1 page, everything is fine meaning I don't get an extra empty page?
    – Hanz Cheah
    Nov 15 '18 at 6:25
















Are you sure it's not the page-break-after: always that is causing the extra page?
– johna
Nov 14 '18 at 21:24




Are you sure it's not the page-break-after: always that is causing the extra page?
– johna
Nov 14 '18 at 21:24












its I deleted the 'page-break-after: always' it is still the same. Where was the link that someone just posted earlier?
– Hanz Cheah
Nov 15 '18 at 4:53




its I deleted the 'page-break-after: always' it is still the same. Where was the link that someone just posted earlier?
– Hanz Cheah
Nov 15 '18 at 4:53












this one? how to avoid extra blank page at end while printing?
– SearchAndResQ
Nov 15 '18 at 5:10




this one? how to avoid extra blank page at end while printing?
– SearchAndResQ
Nov 15 '18 at 5:10












I have follow this stackoverflow.com/questions/1763639/… But still when the records is only 1 page, it will always give me an empty 2nd page but if the records is more than 1 page, everything is fine meaning I don't get an extra empty page?
– Hanz Cheah
Nov 15 '18 at 6:25




I have follow this stackoverflow.com/questions/1763639/… But still when the records is only 1 page, it will always give me an empty 2nd page but if the records is more than 1 page, everything is fine meaning I don't get an extra empty page?
– Hanz Cheah
Nov 15 '18 at 6:25












1 Answer
1






active

oldest

votes


















0














Manage to fix it with following



<style type="text/css">

html, body {
margin: 0 !important;
padding: 0 !important;

}
</style>





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53276983%2fhtml-asp-classic-how-to-remove-empty-page2-when-printing%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Manage to fix it with following



    <style type="text/css">

    html, body {
    margin: 0 !important;
    padding: 0 !important;

    }
    </style>





    share|improve this answer


























      0














      Manage to fix it with following



      <style type="text/css">

      html, body {
      margin: 0 !important;
      padding: 0 !important;

      }
      </style>





      share|improve this answer
























        0












        0








        0






        Manage to fix it with following



        <style type="text/css">

        html, body {
        margin: 0 !important;
        padding: 0 !important;

        }
        </style>





        share|improve this answer












        Manage to fix it with following



        <style type="text/css">

        html, body {
        margin: 0 !important;
        padding: 0 !important;

        }
        </style>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 15 '18 at 6:38









        Hanz CheahHanz Cheah

        122219




        122219






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53276983%2fhtml-asp-classic-how-to-remove-empty-page2-when-printing%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Bressuire

            Vorschmack

            Quarantine