PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Apr 28, 2024 11:00 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Dec 19, 2013 5:03 pm 
Offline

Joined: Thu Dec 19, 2013 4:57 pm
Posts: 2
When I call printer.Print(); a Win32Exception "Access is Denied" error is thrown. The error occurs on PdfFilePrinter.DoSomeVeryDirtyHacksToMakeItWork() line 210.

I am going by the PdfPrint sample project included with the PDFSharp download. My code is very basic:

Code:
            PdfFilePrinter.AdobeReaderPath = adobeReaderLocation;//Path to AcroRd32.exe on windows 8 machine
            var printer = new PdfFilePrinter(_filePath, _printerName);
            try
            {
                printer.Print();
            }


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 19, 2013 5:07 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Access denied means your not permitted to do this.

Try running your code with administrator privileges.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 19, 2013 5:11 pm 
Offline

Joined: Thu Dec 19, 2013 4:57 pm
Posts: 2
Can you be more specific? Are you referring to programmatic elevation? I am running this code in the visual studio 2012 debugger in Administrator mode.

The issue occurs during the iteration of processes. When it reaches the process "sppsvc.exe" - Microsoft Software Protection Platform Service. In taking a closer look I noticed that this little block of code is configured to swallow exceptions. I only noticed because I always run my debugger configured to stop on all CLR thrown exceptions.

So this is just a well named piece of code DoSomeVeryDirtyHacksToMakeItWork() doing some naughty things...

I'll go ahead and ignore it....


Last edited by smacky311 on Thu Dec 19, 2013 5:26 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 19, 2013 5:24 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Sorry, forget the first post.

There is a try/catch around line 210 and a few exceptions will be OK.
You can tell the debugger not to break on such exceptions if they are handled in code.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 352 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group