Every browser has print preview command in their File menu I want to make "print" button on HTML page and upon clicking i want to open print preview page. is this possible?
With this we can open print options
Print this page
but can we open print-preview page instead print options ?
window.print() is the only print-related function in window.
However, if you have defined a dedicated css-file for print, you can create a page that simulates a print-preview by only using the print stylesheet. And then open this in a popup or new window.
No you can't. However there is a way to show that in IE by using ActiveX and some others for other browsers...
Related
I have used window.open() of JavaScript function to display a PDF/an image. What is my question is I don't want to show options tab for user. Otherwise if possible I want to hide the 'download' and 'print' option from the window.open tab.
This cannot be done via code. This is a PDF preview. Not an HTML page. The only way you can remove the icons from showing i.e. print & download, is to edit Viewing PDFs and viewing preferences
https://helpx.adobe.com/acrobat/using/viewing-pdfs-viewing-preferences.html
This is the window that appears for printing in browser. This windows appear after opening on a PDF page in a browser. Also this window is next stop after clicking print button in a PDF file generated by FPDF. I am using FPDF and I believe you cant output or add other things aside from your data so Close window automatically after printing dialog closes solution is not valid for my problem. This solution basically add a JS script in the pop up window.
Is there a way to close this window after clicking on the PRINT BUTTON for PDF pages. For PDF generated by FPDF?
Is there any way to create my own print preview and give all option as given in chrome print preview. Also i want to hide the chrome default print preview dialog through javascript and show my own print preview dialog, because firefox and IE doesn't have this facility that's why i want my own dialog to show.
Thanks,
Sandy
You can have a new pop-up window which looks like a preview of the page you want to print and provide few functionality through java-script as in Chrome.This will work fine in non chrome browsers.
But you cannot hide chrome's print preview functionality via java-script.
So whatever new print preview page you create will look good in most of the browsers, but your custom print preview page will again go through print preview of chrome before printing.
For ex, Suppose you want to print in order confirmation page of an e-commmerce website by showing your custom print preview.
To achieve this you can have a dummy print button on the confirmation page on click of which your pop up opens with the formatted print content with extra functionality as provided by chrome. You can have your print button (window.print())in your custom print preview to print the final page.
But this works fine in non chrome browsers, but will go through chrome's preview functionality again.
My jsp application has one home page and that has so many anchors <a> for accessing different pages using AJAX.
one anchor is for creating user which opens a particular user registration window using javascript window.open of size 1050*600.
at end of use r registration i am providing two anchors :
1. for displaying preview of registered info and
2. for taking print out of registered info.
both are of size 500*200 and again I am calling javscript window.open() to open these two windows.
but it's not they are taking same size as that of parent pop up (ie.1050*600).
how to open pop-up in alreadily open pop-up window?
where do you have print preview ? in the register page itself ? if yes then you can use window.resizeTo in your print preview page to reset to the size you want, ideally its
window.resizeTo(500,200); in your case
I have a HTML page that has a link to a PDF. This PDF opens in a new window.
The parent HTML page has a File->Print menu item. When the user clicks Print I want to be able to automatically open the PDF and print it. The printing part is where I am stuck.
Any help would be much appreciated.
Thanks.
If you open that window with a specific name (e.g. target="nameofwin") in the link pointing at the PDF, you might get away with nameofwin.print(). However, I'm not sure if that'd work since the PDF will be shown using a plugin, and not be a native part of the page. There may be some API that allows you to interface with the PDF display plugin, but then you're stuck wondering if you've got Acrobat or FoxIt or WhateverElse running in there.
You can probably use PDF.js to render the PDF in a hidden div. Then, on your "print" button, register a click in which you add a new print stylesheet to the document, show that div, print the window and then remove the print stylesheet.