Print Preview Window

I want to create a generic Print Preview panel.
Does anyone know whether this has been done already, any pointers on where to get help?

I've done it, and it's not fun. Java doesn't have much help for creating printing stuff. You have to do much of it yourself.
I implemented the preview as an extended JComponent and just basically drew the print job to the screen. The only problem with this approach is that your print jobs must also not do anything weird or strange with the clipping areas, otherwise they can always draw off the 'page' by mistake.
As for pointers, I couldn't find much information about printing that wasn't extremly simple. If you are going to want to print custom jobs to the printer ,then make sure that they are well behaived.

Similar Messages

  • Print Templates print preview window closes unexpectly when printing document

    This is a cross posting from Internet Explorer Web Development after a suggestion that this forum would be a better location. See
    https://social.msdn.microsoft.com/Forums/ie/en-US/351e1245-b606-4467-9f3c-1c72f9cdf9ea/print-templates-print-preview-window-closes-unexpectly-when-printing-document?forum=iewebdevelopment.
    I have raised an issue through Connect for this:
    https://connect.microsoft.com/IE/feedback/details/1134168/ie9-to-ie11-print-templates-print-preview-window-closes-unexpectly-when-printing-document, but I would like some more visibility of the issue as my customers thought my application was closing when
    they printed a document.  I also don't know if an issue in Connect gets any priority support via MSDN, but this forum does.
    This looks to me like a problem in the IE Print Templates startDoc API call, but if there is a more appropriate forum to raise this issue in please let me know.
    In the application where I use print templates, the window closing is not in it self a problem because the Javascript that is calling startDoc also closes the Print Preview window when the print is finished.
    The fact that the application looses focus and can be hidden by the windows of other applications when the Print Preview window is closed by startDoc is the issue noticed by our customers, so I need a fix preferably, or a work around at a pinch.
    Details of the issue reproduced below.
    When using IE Print Templates, the startDoc function is causing the print preview window to close.  This behaviour started with IE9, and is still present with IE11.
    When an application is using print templates (see
    https://msdn.microsoft.com/en-us/library/aa753279(v=vs.85).aspx) for print functionality, this has the effect of causing the application to become hidden by any other application window once printing from the print preview window has started.  It is
    actually this behaviour that started me looking at this issue as the users thought the hosting application had closed.
    Print Templates are not accessible by using IE as a web browser, but only when using the WebBrowser Control to embed IE in an application.  The reference for this feature is available from this url:https://msdn.microsoft.com/en-us/library/aa753279(v=vs.85).aspx
    and a sample Microsoft application that demonstrates the use of Print Templates can be used to demonstrate the problem (required for the reproduction steps).  The application is available via this article and searching for "download spiffy".
    Steps to reproduce the problem:
    To see the full effect of the issue, first ensure there is a window from another application (like Windows Explorer) that will cover the sample applications window if brought to the foreground (making the Windows Explorer window full screen works).
    Start the sample application (and ensure that the full screen Window Explorer is the next application to activate).
    Then in the drop down box in the top right corner of the UI select Template8.htm.
    Click the Print Preview button that is just below the drop down box (this will open a new Print Preview window).
    In the new window click the Print… button (this will open a Print dialog).
    Click the Print button at the bottom of the Print dialog.
    The Print dialog closes (expected) and then the Print Preview window also closes (not expected), however the document is still printed successfully.
    When the Print Preview windows is closed unexpectedly, the Windows Explorer window is brought to the foreground (obscuring the sample applications window).
    If you reselect the sample application and click the Print Preview button again, the Print Preview dialog is not displayed unless you restart the application (this looks to be a symptom of the same issue, not a separate problem).
    To see that the Print Preview window appears to be closed by the startDoc call, use the resource editor in Visual Studio (the exe can be opened directly by File | Open | File…) to edit the HTML resource "TEMPLATE8.HTM" (I found I needed to delete
    it and add it back in for the change to stick), find the startDoc call and add two alerts, one on the line before and one on the line after.  When IE is accessing the template, it is being done using the name of the executable (so do not rename the modified
    version of printtemplates.exe, make the changes to a copy in a different directory if you don't want to change the original).  Start the modified version of the application and follow the same steps as in the reproduction.  This time, after clicking
    the Print button in the Print dialog, the dialog will close, the first alert will pop up, then the Print Preview window will close, then
    the second alert will pop up.
    Thank you,
    Warren.

    Hi Shu,
    I have noticed that the print templates API is listed as part of the Legacy APIs. 
    Is this just because it hasn't changed or is not new?  Or does this mean that it is no longer maintained and may be removed (or at least deprecated) at some point in the future? 
    It would good to know if we should start planning for the implementation of a different method of printing.
    I understand that the sample application is no longer maintained, but I also think that the Print Template API that it uses has not changed, and so should still work (and it does mostly).
    If the Print Preview window was being closed as a result of using the Print dialog (and if it had behaved the same way with IE8) I would be willing to go with the by design argument.  
    I have found that the Print Preview window is not closed until startDoc is called, and it closes before control is returned from the startDoc function. 
    Just as part of investigating and try to find a workaround, if I call window.close(), any alert calls made no longer display the alert window after the close call. 
    Alert still functions after startDoc has closed the window however. 
    The is not the sort of consistent behaviour I would expect from something that is by design. 
    Also while investigating, I found that calling startDoc after calling window.close() results in an exception with the error code -2147467259 (0x80004005), this is probably quite normal and expected, but does indicate that the Web Browser Control should
    not be closed till after printing.
    I had found that old thread, and I had concluded it was the same issue, but it was also aimed at different aspect of the problem (which I see in the sample application, but not my application). 
    The visible issue I have is that my users think the application has been closed because after clicking print (on the Print dialog) the application gets hidden by other windows from other applications. 
    This aspect affects the sample in the same manner and so it was a convenient way to demonstrate the problem.
    If IE connect do not look at this issue any time soon, do I have any other avenues to resolve this issue?
    Thank you,
    Warren.

  • Can you disable the print preview window from firefox and how?

    I would like to disable the print preview window and be able to click print once. I don't have the firefox symbol on the top left of the window. Can someone please give me the steps to change the settings?

    You can look at this extension:
    *Universal Print: https://addons.mozilla.org/firefox/addon/universal-print/

  • Just wondering if I'm looking for something that doesn't exist - can firefox automatically close the "print-preview" window after printing?

    I'm using the addon in my firefox toolbar to print preview website data then append to a pdf file. Sometimes I am distracted, then can't remember if I've gone through the process and printed/appended the page to the file. It would be helpful if there was a way that the print preview window would close after printing thereby confirming that the process has completed. Thanks in advance.

    Thanks for your reply.
    I'm running different versions of firefox on different computers. I'm aware of the upgrade procedures. Same issue in later versions as well.
    The add-on is called "Print Preview Button 0.5" by sindre-wimberger which I obtained through the "Search Mozilla Support"
    However, that's not really relevant - to bring this back to basics the same situation occurs if you do <File> <Print Preview> then print the document. The print preview screen remains until manually closed. Perhaps there is a setting in "about:config"? Does anyone know if this is so? There is an entry "print.whileinprintpreview" but not sure what setting does here. Suspect if set to "False" then you probably wouldn't be able to print from "Print Preview" screen.
    Thanks.

  • Print preview window is blank

    Sometimes when I try to print a PDF from the net my print preview window is blank even though it shows the document might be multipule pages long.  The same can happen when trying to print out other things from the net....any ideas out there?
    thanks, Steve

    Hi Steve, not sure, but they have ways of preventing you from printing some PDFs, & possibly other ways to obscure it.
    Do you have a link to one that shows blank?

  • CS5 Print preview window heavly inconsistant with left margin

    I can adjust my images to look fine in the print window display with the paper size I select. However the printed image does not accurately track what is shown in the preview.
    It does not matter if I print borderless or with border.
    I suppose it is a minor quibble in that moving the preview image left margin to the right (positive values) by small amounts the print out actually moves it to the left by that small amount. At first I thought this might be random paper alignment errors but the behavior is too consistent. But as I continued my tests I could not significantly/consistently shift the image to the right until a movement finally happened between 1/2 and 6/10ths of an inch. Only then did I get the actual 6/10th white border on the left side of the printout.
    What the heck am I doing wong? Is this a bug? The old print preview was so much better as it gave a WYSIWYG output. Now it seems to be a crap shoot whether your border adjustments match your desired shift.
    This is too blatant of an error to be a bug, so what am I overlooking? There seems to be some kind of rasterization of the movement going on I don't know about.

    That's a bit surprising, in that I've found HP in general to support their released hardware better than most when a new OS is released.
    But it's not unheard of.  Manufacturers don't benefit measurably by supporting old hardware, though it's a no-brainer that doing so builds brand loyalty.  In fact, I'm sure there are marketeers in these companies that actually believe forcing you to buy a new device is a Good Thing.  The printer is not supposed to be a consumable!
    Scanners are more often devices that fall into this trap.  Over time I've thrown away two perfectly working scanners (one Canon and one Mustek) because they weren't supported by their manufacturer upon release of a new version of Windows.  On the other hand, my little, cheap HP 932c printer is still perfectly supported in Windows 7, even though I bought it back in the days of XP.  Perhaps it has something to do with numbers of units sold.
    Anyway, best of luck getting things worked out.  I'm very sorry to hear that HP may be going the way of the other manufacturers. 
    -Noel

  • Smart Web Printing & blank print preview window but prints anyway

    I can successfully print using Smart Web Printing on my W7 laptop.  My Deskjet F380 is set up to always display a print preview before printing but when I use Smart Web Printing the print preview is always blank but it still prints correctly.  I have no problems with the print preview from IE8.  Has anyone else encountered this problem?
    This question was solved.
    View Solution.

    this problem has now resolved itself - I think since the latest HP update.

  • Print preview window not showing page to be printed

    My wife and I just downloaded Firefox to our new Macbook Airs with Lion. The small preview box in the print layout widow does not show the page being previewed. In addition, the selected print windows are not holding from print session to print session.
    I love Firefox on my old Mac, so please help us resolve this problem.
    Pete
    [email protected]

    Sean, I was importing directly from the camera to Lightroom. I might add that I have been using this same procedure for a couple of years now and only within the past few weeks have the problems come up and if I made some change somewhere along the line I certainly have no idea what the change was. As I have mentioned before in some of this forums communications, when I imported directly from a card reader outside of the camera, everything was just as it should be and yet up to a couple of weeks ago, I could import directly either from the camera or a reader card with the same perfect results. (This is from my Canon XTi as I do not have a card reader yet for the G10) I would assume a card reader will work as well for the G10 and so I have ordered one and hopefully this will be a rather simple solution to the problem. As John had indicated in one of his messages he occasionally liked to import directly from the camera and I echo that as I do also.
    Bob

  • My Verizon email "print" button opens a blank "print preview" window.

    Help!  I am running Windows 7 and  I.E. 8. on a new HP Pavilion. I cannot print an email from the Verizon Web site in a "printer friendly" format without the entire web page printing and advertising. I get a blank pop-up Window where the "preview" should be.
     I believe I should be able to get an answer from the support helpline, but I cannot. Apparently I have to pay for "premium service" if I understand the sales pitch I get every time I call support, but no one takes the time to tell me what is included in "premium" service.  I can print from other web sites using a "printer friendly" format.

    #1 In mine, I got text that says This message contains unloaded images.
    So: I had to click on load images.
    #2 Then I clicked on print.
    #3 I am on Windows XP SP3 with Firefox, it works fine here.
    If you are the original poster (OP) and your issue is solved, please remember to click the "Solution?" button so that others can more easily find it. If anyone has been helpful to you, please show your appreciation by clicking the "Kudos" button.

  • FF windows goes blank white and freezes if I click a link in another application when Print Preview is open in FF (Win 7 64-bit)

    Possible bug: FF dumps my session if I try to open an external link without closing print preview view. I had left the Print Preview screen open in FF after printing a web page, and I clicked a web link in another application, which would have normally opened in a new tab in FF. However, only the Print Preview window was displayed and when I clicked "Close", the FF window when all white. Back/backspace wouldn't work and I had to close FF and start a new session. I tested this a few times and it happens every time. I didn't think to test whether this happens in Safe Mode.

    Troubleshooting extensions and themes
    * https://support.mozilla.com/en-US/kb/Troubleshooting%20extensions%20and%20themes
    Check and tell if its working.

  • Problem with window.close() and print preview in IE

    Hi all,
    In IE, when window.close() or self.close() is executed, the window is closing perfectly. But when after opening a print preview window from file menu in IE and after closing the print preview with [X] button, then the window.close() is not working. Is there any solution to close the window even after closing the print preview window? here is the sample code.
    1) Close.htm
    <HTML>
    <TITLE>TEST</TITLE>
    <BODY>
    <SCRIPT LANGUAGE="javascript">
    function CloseMe()
    window.close();
    //self.close();
    </SCRIPT>
    <INPUT TYPE="button" ONCLICK="CloseMe()" VALUE="Close Me">
    </BODY>
    </HTML>
    Thanks,

    masijade. wrote:
    nogoodatcoding wrote:
    Crosspost: http://forum.java.sun.com/thread.jspa?threadID=5227849&tstart=0
    Why'd you start a new thread once you got an answer on the thread linked above ( and even acknowledged it ) about the fact a that it was not a Java query?Because last time it was a JSP forum, which is not JavaScript obviously, but this is a Java forum, and the designers, obviously, simply neglected to include Script in the name, of course. ;-):D Why, oh, why did they have to call it JavaScript! (And before someone starts, that was a rhetorical question!)

  • Why am I not able to use "selection" as a print range option when using the print preview feature? Is this facility available or am I doing something wrong?

    Having seleted some text on a web page which is the only information I would like to print, I seem to be unable to preview what the printed page will look like using the "Selection" option in the Print Range section of the "Print" Menu from the Print Preview window. The radio button for "Selection" is not selectable!
    I am able to do this using Internet Explorer, which is probably my main reason for using that browser but would like to use a similar feature in Firefox

    That connection is supported for tethering....
    Barry

  • Preview window

    This is my first post so bear with me.
    I use a HP8500 and run windows 7 and have Print Preview set to on.
    It works very well but occassionally while waiting for the preview window to pop up I do something else and then the window disappears and I can't get it back. It's not behind any other windows and it's not an application so I can't kill it.
    The printer thinks its printing but is really waiting for a click in the Preview window which I can't see.
    When this happens the print files sit in the queue and even rebooting and turning the printer on and off doesn't clear the problem.
    I've had to stop the spooler and delete the files but sometimes the printer is still "printing" and it takes a long time to get back to printing.
    Is there a better way ?
    Thanks in anticipation.

    Hi LMSHP,
    Sorry for the delayed response to your follow-up post.
    I have done some research on your post.  A post by Bobby Mikkelson on the Microsoft Community Forums should help with resolving the issue with your print preview window.
    Microsoft Community Forums - Post by Bobby Mikkelson
    http://answers.microsoft.com/en-us/ie/forum/ie8-windows_vista/when-i-try-to-print-from-internet-expl...
    Regards,
    Happytohelp01
    Please click on the Thumbs Up on the right to say “Thanks” for helping!
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    I work on behalf of HP

  • Print Preview shows (and prints) only a portion of a page,

    Not the printer's fault - it prints what Print Preview sends it (about half a page).

    There's a couple of old Bugs ''(over 8 years old)'' in Firefox that can cause that to happen with some web pages. One Bug was recently fixed for Firefox 4.0b8, but it doesn't look like it will be applied to Firefox 3.6.x versions.
    There may be a workaround you could apply for a specific domain via a Stylish script, but we'd need the URL of that page and a screen shot of the Print Preview window to try to help you fix it.

  • SSFCOMP_PDF_PREVIEW - print preview + mail

    Hi Experts,
    I am using the function module SSFCOMP_PDF_PREVIEW to preview my layout in pdf. Now the users want to mail it. I know the function module to send mails. I am not asking for that. I would like to know if I can send the pdf as email to an external address entered by the user(optional).
    I am talking about the standard layouts here like sales orders/invoices so no option of creating a field on selection screen. 
    Please let me know if it is possible.
    Warm Regards,
    Abdullah

    Hi Kartik,
    Thanks for your response. Currently I am calling a Z screen, after close_form function module of my sap script(It is called every time the user exits the screen. The requirement is that on the print preview window, I should have the option of mailing along with a user defined body in my layout (sap script/smartform). And the mail that goes should have the layout in pdf format. This process should be available only if the user wants to send the mail.
    The transactions are standard like sales order/delivery note etc. but the scripts/smartforms are developed in my scenario.
    Warm Regard,
    Abdullah

Maybe you are looking for