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 7906915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:11:01+00:00 2026-06-03T11:11:01+00:00

I have a kiosk with the following Greasemonkey (Tampermonkey) code on the page to

  • 0

I have a kiosk with the following Greasemonkey (Tampermonkey) code on the page to enable receipt printing:

$("input").css("font-size", "xx-large");
$("#newcheckout").append ('<div id="autoCheckOrder"></div>');
$("#autoCheckOrder").append ('<button>Print Receipt?</button>');

var loanTable = $("#loanTable")
var loanHTML  = loanTable.html().replace(/(\d{2}\/\d{2}\/\d{4})/g, "<br><b>$1</b>");

$("#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( "height: 100%;" );
    newWin.document.write( "width: 60mm;" );
    newWin.document.write( "position: fixed;" );
    newWin.document.write( "top: 0;" );
    newWin.document.write( "left: 0;" );
    newWin.document.write( "margin: 0;" );
    newWin.document.write( "padding: 15px;" );
    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();
    }
} );

This works fine in Firefox — not in Chrome beta 19. Just updated it today. You press the ‘print’ button, the print preview appears and says:

Print Preview Failed, Please Use system dialog.

UPDATE

See Brock Adam’s answer below, then the following working code below ( CSS only for brevity ):

@media print {
    body {
        background-color: white;
        width: 55mm;
        position: absolute;
        top: 0;
        left: 0;
        padding: 0;

…etc.

  • 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-03T11:11:05+00:00Added an answer on June 3, 2026 at 11:11 am

    The problem is the CSS. You’ve got:

    position: fixed;
    top: 0;
    left: 0;
    margin: 0;
    

    — which tries to put the content at the extreme top left of the page, which is not allowed for whatever printer you are using (or just about any physical printer).

    Change any one of those 4 CSS parameters to put the start of the printout within whatever margins your printer accepts.
    If you comment out the auto-print and auto-close parts of the Greasemonkey script, you can use Chrome’s DOM tools to see that the print-preview fails and then adjust the CSS until it works.

    Obviously, Chrome is more persnickety, whereas Firefox defaults to moving and sizing the printout as necessary. There might be a setting you can set for Chrome, maybe. (I don’t know and refuse to invest too much effort into Grab-All™ products.)

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

Sidebar

Related Questions

I have the following ItemsControl page... <Page x:Class=Kiosk.View.ItemListView xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:d=http://schemas.microsoft.com/expression/blend/2008 xmlns:Converter=clr-namespace:Kiosk.Converter mc:Ignorable=d
I have a WPF application that is a fullscreen kiosk app. It's actually a
Have you ever obfuscated your code before? Are there ever legitimate reasons to do
Have you ever created or encountered a self modifying code in Java? If yes,
I have built a Air 2/Flex 4 kiosk application with Flash Builder 4. Currently
I am building a single HTML page for use in a touch-screen kiosk. I
I have a kiosk app and want to run it at startup. The problem
I have a program on a kiosk with an associated service that updates the
I have a web application running in a kiosk, which is set up with
We're building a kiosk app that will have a fairly wide deployment. The app

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.