323

Windows.print () Creating a blank page before pages

 3 years ago
source link: https://www.codesd.com/item/windows-print-creating-a-blank-page-before-pages.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Windows.print () Creating a blank page before pages

advertisements

I'm using the following javascript to print a page then I want to redirect after either canceling or accepting the print.

<script type="text/javascript">
    window.print();

    window.location.replace("URL");
</script>

Everything works but when I add the window.location it adds a full blank page before the pages I'm printing.


you need to add a property in CSS @page{margin:0}

you can try this code :

<!DOCTYPE html>
<html>
<head>
    <title>tp</title>
<style type="text/css">
@page{
      margin: 0mm;
}
    *{
        padding: 0;
        margin: 0;
        background: red;
    }
</style>

</head>
<body>
<p>test</p>
<script type="text/javascript">
    window.print();
    window.location.replace("http://www.google.com");
</script></body>
</html>

Related Articles

Javascript window.open (xxx, & ldquo; download & rdquo ;;) creates a blank page at the download prompt

When I run window.open(file, "download") with safari, it opens a blank page while download prompt and the blank page stays there. I notice firefox opens a blank tab but it's close when download starts. Is there another javascript command/functio

windows.print results in empty page

So I'm trying to add a print button to an html page. Most of the page is not supposed to appear in print, so I hide everything in print and then reveal only the one div that is supposed to be printed (or this is what I'm trying to do). But when I try

Body onload creates a blank page

I am trying to display the last three months in a dropdown. I created a JavaScript function and called it in the body element's Onload attribute, but I am getting a blank page with no errors in the log. Below is the JSP: <%@ page import="java.util

JavaScript window.print () gives a blank print

I have an HTML-page with some data in table format, and this code: function printme() { window.print(); self.close(); } <body onload = "javascript:printme()"> With this, I can get printout from all browsers except one version of IE8 (8.0.7

Javascript window.print () gives a blank preview

I am trying to print my website using javascript but the print preview shows only header and footers and the rest is blank. <a href="javascript:void(0)" onclick="window.print()">Print</a> Can your guys help me on this one.T

Firefox prints an extra blank page

I have a web page that prints correctly on Chrome, Safari and IE, but has the followign problem on Firefox: It prints just the header on the first page. The rest of it is blank. The actual content is shown only on page 2. Googling a bit about it i fo

Silverlight HTML Bridge printing windows.print () white pages

I am using HTML bridge window.print() to print range between 20-30. The client says it is printing blank pages. We can only reproduce it on their machine. This is the code in xaml that combines all the pages in one page and prints it. This code works

Empty page when & ldquo; Print at the bottom of the page & rdquo; is activated and all sections of the blank page are deleted

I'm using Crystal Reports Basic for Visual Studio 2008. I have each item in a group printing on a separate page. There is a footer section which is set to Print at the Bottom of the Page. I am suppressing the page when its data is 0 by suppressing al

Css layout - second blank page when printing

im using the css file from this location: http://peterned.home.xs4all.nl/examples/csslayout1.html but somehow, when i print my page, the first page is perfect, but it starts to print a second page which is blank. Ofcourse i only need the first page,

Elimination of the local ratio of additional blank pages

I am printing an RDLC report using a class wrote with Vb.net. I converted the RDLC report to a List of MemoryStream and Printing it using a PrintDocument Object. i used This MSDN Article as a reference. This is my code: Private m_currentPageIndex As

How do I delete blank pages in SQL Reports?

I have a SQL Report that insists on printing an extra blank page at the end, even though all the report items should fit on one page. I tried shortening the elements on the page that is spilling over, but no matter how much I compress them, or how mu

By calling $ window.print () in angularjs, the print preview displays a blank page

I have a very strange problem where, when I call $window.print in angularjs, all I see is the date on the top left, page name on the top, page number on the bottom right, and the url on the bottom left. However, there is no other content on the page,

Chrome displays a blank page on the RTL language site until the window is resized

I just created an Arabic version a website and noticed that Chrome sometimes shows a totally blank page until the window is resized and then everything instantly becomes visible. Arabic is a RTL language, so the <html> tag has dir="rtl" la

Crystal Reports Printing blank page

I have a crystal report which is printing a blank page and printing the report fine, but just with this additional page. Done my research, ticked, unticked and added correct formula into the 'New Page After' option, not on last record formula etc, bu

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK