win32exception : Access is denied (..OnEndPage()) : Vista

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

johnpWalsh
User
Posts: 16
Joined: Fri Jan 28, 2011 10:35 am

win32exception : Access is denied (..OnEndPage()) : Vista

Post by johnpWalsh »

I am currently trying to print a PDf using your sample Viewer SDK code (..install_location\PDF-XChange Viewer SDK\Examples\
the pdf will print fine with most of the sample code .
However when i use the PCXView code (located in C:\Program Files\Tracker Software\PDF-XChange Viewer SDK\Examples\C#Examples\PXCView36) i get the following exception

win32exception : Access is denied
at System.Drawing.Printing.StandardPrintController.OnEndPage(PrintDocument document, PrintPageEventArgs e)
at System.Windows.Forms.PrintControllerWithStatusDialog.OnEndPage(PrintDocument document, PrintPageEventArgs e)
at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at PXCView36.frmMain.PrintPdfFile(IntPtr hParentWnd) in C:\Work_hp\Projects\PXCView36_CSharp\PXCView36\frmMain.cs:line 353


I need to use this sample as i don't want to include the Active X control in my code (I'm not displaying the PDF, just printing it).
Note :
- PXCView36 successfully prints other PDFs but not the PDF which I've attached)
- Other SDK sample code , where the Active X control is used, successfully prints out the PDFs
- It seems that it is just the PXCView36 code that does not print out the PDF (and this is the code i need as i only want to print the PDF and not view it, and therefore dont want to use a control in my window)

I am using windows Vista
You do not have the required permissions to view the files attached to this post.
johnpWalsh
User
Posts: 16
Joined: Fri Jan 28, 2011 10:35 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by johnpWalsh »

Hi
Was stepping into the code and stepped into the .Net code and discovered that it throws an Win32Exception in the following function : OnEndPage() in the class System.Drawing.Printing.StandardPrintController (at the line if (result <= 0) )

Code: Select all

//Class copied form System.Drawing.Printing
public class StandardPrintController : PrintController {
..
..
public override void OnEndPage(PrintDocument document, PrintPageEventArgs e) 
{
           Debug.Assert(dc != null && graphics != null, "PrintController methods called in the wrong order?"); 

            // For security purposes, don't assume our public methods methods are called in any particular order
            CheckSecurity(document);
            IntSecurity.UnmanagedCode.Assert(); 

            try 
            { 
                int result = SafeNativeMethods.EndPage(new HandleRef(this.dc, dc.Hdc));
                if (result <= 0) 
                    throw new Win32Exception();  //*** EXCEPTION THROWN HERE ****//
            }
            finally {
                CodeAccessPermission.RevertAssert(); 
                graphics.Dispose(); // Dispose of GDI+ Graphics; keep the DC
                graphics = null; 
            } 
            base.OnEndPage(document, e);
        } 
}
I'm also attaching a PDF (UniversalCrossword__Printable.pdf) that prints OK for me. When printing this pdf the exceptions is not thrown at the line shown above
You do not have the required permissions to view the files attached to this post.
johnpWalsh
User
Posts: 16
Joined: Fri Jan 28, 2011 10:35 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by johnpWalsh »

Hi adding 2 more files.. exact same content (were created using different adobe InDesign versions)
You do not have the required permissions to view the files attached to this post.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by Tracker Supp-Stefan »

Hello johnpWalsh,

One of our devs checked this topic and advised that the currect Viewer Simple DLL version does not have this problem, and you are using an older one: pxcview36 - and this version will not be fixed, so please consider upgrading to ver4.

Best,
Stefan
johnpWalsh
User
Posts: 16
Joined: Fri Jan 28, 2011 10:35 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by johnpWalsh »

Hi Thanks for your reply
Can you tell me where i can download the Latest DLL from?

I went to https://www.pdf-xchange.com/product/downloads/sdk page and downloaded both the

-> PDF-XChange Viewer Simple DLL SDK
-> PDF-XChange PRO SDK



I installed both and then ran the PXCView36.exe from each of these (ensuring that i was using the pxcview.dll included) and both of these still crash

Points to note
- This happens on Vista machines only (and not on all vista machines)
- This does not happen when i use any other Tracker X product
e.g when i user the PDFXCview.exe application that uses the activeXcontrol on the page it prints fine. However we cannot use the control here and we do not want to display the pdf, just print it

Is there any TrackerX dll i can use (apart from pxcview.dll) to print the pdf without having to display the pdf in a control

Thank you for all your help
I need this issue resolved ASAP as it is stopping us from releasing out product!
Thanks
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by Tracker Supp-Stefan »

Hello johnpWalsh,

We are still unable to reproduce this, so could you please either send us a detailed and step-by-step instructions how to reproduce it or a video of the problem, as with not knowing what to search for it's really hard to try and fix a problem.

Best,
Stefan
johnpWalsh
User
Posts: 16
Joined: Fri Jan 28, 2011 10:35 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by johnpWalsh »

PXCView36_sample_csharp.zip
ScreenShots.zip
FAILS_TO_PRINT.pdf
Hi
This is what I've done to reproduce the error
1) Open up PDF using PXCView36.exe (either the C# or Vb sample exe from your SDK .. ..\PDF-XChange PRO 4 SDK\Examples\Bin\PXCView36_sample_csharp.exe)
2) try and print the PDF using PXCView36.exe
- I chose a HP_DeskJet 3050 printer attached top my machine and also a network printer and both failed
3) the print dialog appears (see screenshots.zip/image1 attached )
4) click print
5) The 'Printing' message box appears (see screenshots.zip/image 2)
6) Then the App crashes displaying the 'Exception caught' message box (see screenshots.zip/image 3)


This happens in most of the vista machines here (ie on some vista machines it will work)
(i've attached snapshot of my system info see screenshots.zip/image 4)

also i've tried you other sample apps (ie apps other that PXCView36) and they work fine. Therefore it is due to some difference between the print code in pxcview.dll and the printcode used in the other DLLs used by othe other apps)

the error is in the following piece of code
win32exception : Access is denied
at System.Drawing.Printing.StandardPrintController.OnEndPage(PrintDocument document, PrintPageEventArgs e)
at System.Windows.Forms.PrintControllerWithStatusDialog.OnEndPage(PrintDocument document, PrintPageEventArgs e)
at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at PXCView36.frmMain.PrintPdfFile(IntPtr hParentWnd) in C:\Work_hp\Projects\PXCView36_CSharp\PXCView36\frmMain.cs:line 353
You do not have the required permissions to view the files attached to this post.
Jamie - Tracker Supp
User
Posts: 191
Joined: Thu Jun 02, 2011 3:23 pm

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by Jamie - Tracker Supp »

Hi John,

I am going to set up a vmware testbed to see if I can reproduce your challenge. I just need some details. I will need to know the setup of the vista machines that are failing. can I have a list of as many details as you can put together.
I will need at least:
1. cpu (and are you running 32/64 bit Windows?)
2. os
3. security (firewall,antivirus,ect)
4. current state of windows updates
5. viewer version
6. software running in background.

I would also like to know the setup of the vista machines that work properly. I hope to create an instance of both the fail and non-fail. The more information you can provide the better.

Thanks,
Jamie
johnpWalsh
User
Posts: 16
Joined: Fri Jan 28, 2011 10:35 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by johnpWalsh »

Hi
We have ghost images of the machines we test on. I will confirm a ghosted machine that the PDF fails on and I can burn a CD with the Ghost image and post it to you.
Does that work for you? (at least we would have no doubt about the machine setup to recreate the bug).

In the meantime, I'm attaching the system info of my machine where the PDF fails to print (I used our QA tool to print out the system info). The info is a little verbose but it contains all machine info, process info,installed apps etc..

Please find attached in zip file
- systeminfo.txt
- Fails_To_Print.pdf : pdf that will not print
- Success_Print.pdf : pdf that prints successfully
-pcview.dll (copied from the Tracker x Pro SDK i donwloaded last week and located in C:\Program Files\Tracker Software\PDF-XChange PRO 4 SDK\Examples\Bin)
- pxcview36_sample_vb.exe (copied from the Tracker x Pro SDK i donwloaded last week and located in C:\Program Files\Tracker Software\PDF-XChange PRO 4 SDK\Examples\Bin)

I've outlines in the posts above the place in code (in .net) where the app throws an exception.

thanks for all your help
John
You do not have the required permissions to view the files attached to this post.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by Tracker Supp-Stefan »

Hello John,

Thanks for the information and the offer to send us an image of a configuration, but if possible it would be probably easier, and definitely faster - if you could set one such machine up at your end and provide us with a remote access - so that we can test and see directly at your end how it fails.

Best,
Stefan
johnpWalsh
User
Posts: 16
Joined: Fri Jan 28, 2011 10:35 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by johnpWalsh »

Hi yes
I can give you remote access to one of our QC machines in our lab (its on an external network to our internal work network so there should be no issues with firewalls etc..)

What do i need to do, what info do i need to sent to you?
Will you be using Windows 'Remote Desktop" to connect or some other software (e.g VNC)?
I assume all i need to do is send you the IP address?

Also i can always install other software on it to aid in your investigation (e.g visual studio)

Thanks
John
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by Tracker Supp-Stefan »

Hello John,

The best would be if you can set the machine up to a state where we could reproduce the problem on it.
Then we can use either remote desktop, or TeamViewer/VNC.

Also please note that it's late on Friday evening for me, and the majority of our dev guys have finished for the day, so it might be best if you can set the machine up, and leave it on on Sunday evening US time - so that we could test it on Monday.

As for the log in details and IP - do send them via e-mail to support@pdf-xchange.com - so that they are not publicly available here int he forums.

Best,
Stefan
johnpWalsh
User
Posts: 16
Joined: Fri Jan 28, 2011 10:35 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by johnpWalsh »

Stefan
Thanks for your prompt replies.. much appreciated

Yes its late Friday here too and i won't be in work Monday so it will be Tuesday morning until I get back to you with the machine
I will post here when i get a machine setup and email (to support@pdf-xchange.com ) the IP and login details

Thanks again
John
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by Tracker Supp-Stefan »

Sure John - we would be expecting the post and the details in the e-mail.

Have a lovely long weekend :)

Best,
Stefan
johnpWalsh
User
Posts: 16
Joined: Fri Jan 28, 2011 10:35 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by johnpWalsh »

Hi
I have a LAB PC now available for remoting into and have emailed you on the login details.

I have created a directory C:\TRACKER_X_TEST which contains the following:

- Folder called 'PDF-XChangeViewerProSDK_V2.5.197' whihc is the developer SDK I downloaded from your website
https://www.pdf-xchange.com/product ... k/download

- 'PXCView36_sample_csharp.exe': The exe i copied from the installed sdk
- 'pxcview.dll' used by the exe

- 2 PDFs called 'FAILS_TO_PRINT.pdf' and 'SUCCESS_PRINT.pdf' which, respectively, fail to print and successfully print using your PXCView36...exe'

If you need me to do anything this side let me know

Thanks
John
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by Tracker Supp-Stefan »

Thanks John,

We got the e-mail with the details.
I have passed it to the guys in the dev team, and we will see to check the machine tomorrow morning.

I hope it will be sufficient to just check the system, but if we do need anything else - we will certainly ask!

Best,
Stefan
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by Tracker Supp-Stefan »

Hello John,

One of our developers did the tests in your environment - thanks for setting it up for us.

And his comments are that he is able to reproduce the problem only with the C# sample and that specific printer.
He is unable to reproduce it when using e.g. the Microsoft XPS one or using the C++ samples and the printer in question, so the only advice he could give is to try and update the printer drivers and ensure that all .NET framework updates are installed.

Best,
Stefan
johnpWalsh
User
Posts: 16
Joined: Fri Jan 28, 2011 10:35 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by johnpWalsh »

This issue happens on here vista machines using other printers (other than virtual printer 'Microsoft XPS')
I can plug a different printer into the machine and show you the problem
NB : This does work using the other tracker X .net applications.. i.e I can print the PDF using "PDFXCview.exe" contained in the same SDK

Therefore it can't be a .net issue or a printer driver issue => It prints using PDFXCview.exe but not using pxcview36_sample_vb.exe

I assume it is a bug in the 'pxcview.dll' code
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by Lzcat - Tracker Supp »

pxcview36_sample_app.exe uses pxcview.dll and can print. It does NOT use .NET. So the problem is not in the pxcview.dll.

PDFXCview.exe can also print and does NOT use .NET (even our .NET samples use the Viewer AX. The actual printing is done in another process which does not use .NET itself).

So please try to localize the problems somewhere around .NET and the printer drivers or maybe the combination of both.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
johnpWalsh
User
Posts: 16
Joined: Fri Jan 28, 2011 10:35 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by johnpWalsh »

Firstly thank you for your time and effort in trying to resolve this problem

I tried both apps again on the machine i have shared out to you. (using the FAILS_TO_PRINT.pdf file)

Firstly I renamed pxcview.dll to pxcview1.dll so that I coud determine who was using it

- PDFXCview.exe opens FAILS_TO_PRINT.pdf and prints succesfully

- PXCView36_sample_csharp.exe will not open the pdf as it looks for pxcview.dll

I then renamed pxcview1.dll back to pxcview.dll.
The pdf then opend fine using PXCView36_sample_csharp.exe
When i tried to print it gave the exception (see attached file containing screenshot)
=> PXCView36_sample_csharp.exe does NOT print FAILS_TO_PRINT.pdf file
EXCEPTION_PXCView36_sample_csharp.zip
Therefore
- BOTH apps print the SUCCESS_PRINT.pdf
- ONLY ONEapp DOES NOT print the FAILS_TO_PRINT.pdf
----> the app using pxcview.dll does NOT print => PXCView36_sample_csharp.exe
----> the app that doesn't need pxcview.dll prints successfully => PDFXCview.exe

Therefore I fail to see how it can be a .net or a driver issue as
1) you have stated that both apps do NOT use .net => therefore how can it be a .net issue
2) one app prints and the other does not : if it was a driver issue (or .net issue) surely both apps would fail to print
3) Both apps print the SUCCESS_PRINT.pdf ( so how can it be a driver/.net issue? Surely they would also not print the SUCCESS_PRINT.pdf ).
It has to be something related to the difference between the 2 PDFs or a difference between how your 2 apps print the pdf

I have tried printing using various other PDF editors (adobe,fox etc..)
They all print (including your PDFXCview.exe)
PXCView36_sample_csharp.exe is the only app that does not
In the first post above i outline the piece of code where the printing throws an exceptions
You do not have the required permissions to view the files attached to this post.
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by Lzcat - Tracker Supp »

All what you wrote is true, BUT you missed that there are TWO examples which use the same pxcview.dll - pxcview36_sample_app.exe and PXCView36_sample_csharp.exe.
pxcview36_sample_app.exe does not use .NET and can print FAILS_TO_PRINT.pdf.
PXCView36_sample_csharp.exe use .NET and cannot print FAILS_TO_PRINT.pdf.
Both of them use same pxcview.dll, so I don't think that problem is in the dll. It is much more complicated and somehow related to .NET.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
johnpWalsh
User
Posts: 16
Joined: Fri Jan 28, 2011 10:35 am

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by johnpWalsh »

Thanks again for your reply

PXCView36_sample_csharp.exe use .NET and cannot print FAILS_TO_PRINT.pdf.

But
PXCView36_sample_csharp.exe
- can print SUCCESS_PRINT.pdf
- cannot print FAILS_TO_PRINT.pdf

If its a .net issue then surely it wouldn't be able to print either PDF.

Also you said :
"PDFXCview.exe can also print and does NOT use .NET (even our .NET samples use the Viewer AX. The actual printing is done in another process which does not use .NET itself)."
This would also suggest printing is not related to .net

IS there any difference in printing logic between PXCView36_sample_csharp.exe and pxcview36_sample_app.exe that would account for this?

IS there any other DLL or sample code I can use that will allow me to print the PDF (without displaying the PDF on screen). If there is I could use that rather than trying to chase this problem down.?
At the end of the day all i want to do is to be able to print the PDF from code.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: win32exception : Access is denied (..OnEndPage()) : Vist

Post by Corwin - Tracker Sup »

Hi John,

First update your PXV_CommonRenderParametersFlags enum (in PXCV_Lib.cs) to this:

Code: Select all

public enum PXV_CommonRenderParametersFlags
{
   pxvrpf_None						=	0x0000,
   pxvrpf_Rotate_NoRotate			=	0x0000,
   pxvrpf_Rotate_Rotate90CW		=	0x0001,
   pxvrpf_Rotate_Rotate180			=	0x0002,
   pxvrpf_Rotate_Rotate90CCW		=	0x0003,
   pxvrpf_Rotate_RotateMask		=	0x0003,
   pxvrpf_UseVectorRenderer		=	0x0004,
   pxvrpf_RenderAsGray             =   0x0008,
   pxvrpf_EmbeddedFontAsCurves     =   0x0010,
   pxvrpf_AllFontsAsCuves          =   0x0030,
   //
   pxvrpf_NoTransparentBkgnd       =   0x0040,
   //
   pxvrpf_BlackAndWhite            =   0x0080,		// for drawtodc: result will be black-and-white
   pxvrpf_Dither                   =   0x0100,		// use dithering or not; has meaning only with pxvrpf_BlackAndWhite
};
then in frmMain try to render the PDF using pxvrpf_UseVectorRenderer and pxvrpf_EmbeddedFontAsCurves flags -
in OnPrintPage function replace this code:

Code: Select all

crp.Flags = (int)PXCV_Lib36.PXV_CommonRenderParametersFlags.pxvrpf_UseVectorRenderer;
with this:

Code: Select all

crp.Flags = (int)PXCV_Lib36.PXV_CommonRenderParametersFlags.pxvrpf_UseVectorRenderer | (int)PXCV_Lib36.PXV_CommonRenderParametersFlags.pxvrpf_EmbeddedFontAsCurves;
HTH.