Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7990325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:58:30+00:00 2026-06-04T12:58:30+00:00

( This is through Grease/Tampermonkey ). Here’s a print function for a kiosk using

  • 0

( This is through Grease/Tampermonkey ).

Here’s a print function for a kiosk using the Chrome beta browser:

$("#autoCheckOrder button").click ( function () {
    var newWin      = window.open (""); 
    newWin.document.write ( "<!DOCTYPE html>" );
    newWin.document.write( "<html>" );
    newWin.document.write( "<head>" );
    newWin.document.write( "<title>" );
    newWin.document.write( "</title>" );
    newWin.document.write( "<style>" );
    newWin.document.write( "@media print { " );
    newWin.document.write( "body { " );
    newWin.document.write( "background-color: white;" );
    newWin.document.write( "width: 55mm;" );
    newWin.document.write( "position: absolute;" );
    newWin.document.write( "top: 0;" );
    newWin.document.write( "left: 0;" );
    newWin.document.write( "padding: 0px;" );
    newWin.document.write( "font-size: 14px;" );
    newWin.document.write( "line-height: 18px;" );
    newWin.document.write( "}" );
    newWin.document.write( "}" );
    newWin.document.write( "</style>" );
    newWin.document.write( "</head>" );
    newWin.document.write( "<body>" );
    newWin.document.write ( loanHTML ); 
    newWin.document.write( "</body>" );
    newWin.document.write( "</html>" );
    if(newWin.print()) {
        newWin.close();
    } else {
        newWin.close();
    }
});

It grabs a table from the a page listing all items, then creates a
‘receipt’. The receipt is then printed. This worked perfectly for a while, now it only prints the first item.

I have tried the following with absolutely no results:

  • Using page-break-after: always
  • Placing receipt in div with the above CSS rule
  • Reinstalling the printer
  • Paper reduction settings for printer

The crazy thing is that it used to print all items flawlessly and now it doesn’t. I even re-installed the script from a backup just to be sure.

No idea where to go from here. All content shows in print preview, but only the first item prints. ‘Header and footer’ setting only makes things worse, not better.

UPDATE

I changed the HTML sent to the printer and it works. Still not sure if it’s entirely valid but it’s printing. I’ll know what to fix if it stops printing. Thanks for the input!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:58:32+00:00Added an answer on June 4, 2026 at 12:58 pm

    The only plausible explanation I can see is that your loanHTML variable is empty or undefined.

    Demo: http://jsfiddle.net/waitinforatrain/bMzUt/2/

    Comment out the var loanHTML line and run again, and you’ll see what I mean.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running through this tutorial found here: http://vb.net-informations.com/crystal-report/vb.net_crystal_report_from_multiple_tables.htm which teaches how to pass a
I am working through this tutorial https://developers.google.com/cloud-print/docs/android for google cloud print. I am trying
Using a general regular expression replacement (for me, I'm doing this through TextMate) is
I am currently testing out using OSGi. I am running this through Eclipse. I
I know I can do this through code using myClient.ClientCredentials.UserName.UserName = User; myClient.ClientCredentials.UserName.Password =
Cant really find any useful information on this through Google so hope someone here
The way this function will work: 1) The user clicks the button with ID
I probably just haven't thought this through, or perhaps I'm simply unaware of an
I'm surprised I can't find this through googling, but I have a Viewbox in
I can't for the life of me find any answer to this through conventional

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.