Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 28th, 2006, 05:07 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default Printing Problem

Ok,
   I have been banging my head off the wall over this for about 2 hours and I can not figure out what is going on. I have a windows application that I need to be able to print from, no big deal. I set up my menus and such that are related to printing and calling:

[printdocument].Print();

Sends the document to the printer without a problem. Now if i do something like this:

    PrintDocument tmpDoc = new PrintDocument();
    tmpDoc.PrintPage += new PrintPageEventHandler(toPrinter);
    tmpDoc.DefaultPageSettings = pgSettings;
    PrintDialog dlg = new PrintDialog();
    dlg.Document = tmpDoc;
    DialogResult dlgResult = dlg.ShowDialog();
    if (dlgResult == DialogResult.OK)
    {
        tmpDoc.Print();
    }

The print Dialog box is displayed correctly BUT when the I click on the OK button, this line:

DialogResult dlgResult = dlg.ShowDialog();

Generates the error:

An unhandled exception of type 'System.Security.SecurityException' occurred in mscorlib.dll

Additional information: Request for the permission of type System.Drawing.Printing.PrintingPermission, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a failed.

As I said, calling [printdocument].print(); works fine and the page is printed correctly, however if i try to do anything else (change settings in code, or to use the dialog box) i get that error. Does anyone have any answers for this!?

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dos Printing Problem ctranjith Pro VB 6 1 October 7th, 2004 12:03 PM
problem in printing hotguy VBScript 0 December 19th, 2003 03:07 AM
printing problem smukher Pro VB 6 2 June 12th, 2003 04:18 AM
printing problem smukher Beginning VB 6 2 June 11th, 2003 10:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.