lovely0493 / open-webkit-sharp

Automatically exported from code.google.com/p/open-webkit-sharp
GNU Lesser General Public License v3.0
1 stars 0 forks source link

Freeze when attempting to Print Page using Print dialog #27

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open OpenWebkitSharp Test
2. Click test in the bottom right
3. Click show print dialog
4. Click print with a valid printer selected
5. The program will display a "Printing" Dialog and it will hang at this point 
without spooling anything to the printer

What is the expected output? What do you see instead?
That the document would be printed out. Instead the program hangs at this point.

What version of the product are you using? On what operating system?
OpenWebKitSharp 2.0 on Windows 7 x64

Please provide any additional information below.
I have tried this with several different printers with the same result. The 
same error occurs in my own applications making use of the control.

Original issue reported on code.google.com by ben.war...@gmail.com on 17 Nov 2011 at 9:57

GoogleCodeExporter commented 8 years ago
Thanks for the detailed issue report. I will do my best to fix this as soon as 
possible but the problem is that I don't own a printer. Maybe it is a problem 
inside the PrintManager.cs class. I will look into it further.

Original comment by tsumalis96@gmail.com on 17 Nov 2011 at 10:03

GoogleCodeExporter commented 8 years ago
Hi,

The easiest way to test is to download the bullzip pdf printer or attempt to 
print the page to a microsoft xps file which both reproduce the error without a 
printer.

Cheers,

Ben

Original comment by ben.war...@gmail.com on 17 Nov 2011 at 11:21

GoogleCodeExporter commented 8 years ago
Thanks for the advice!

Original comment by tsumalis96@gmail.com on 17 Nov 2011 at 1:11

GoogleCodeExporter commented 8 years ago
Hi,

I have tried your latest build Version 2.1(r55) and unfortunately it is still 
generating and exception when attempting to print or generate a print preview. 

This seems to be due to a divide by zero exception in the   
_webFramePrivate.setInPrintingMode(1, ref hdc); on line 70 of PrintManager.cs.

Original comment by ben.war...@gmail.com on 25 Nov 2011 at 9:06

GoogleCodeExporter commented 8 years ago
I applied a patch to fix this issue but I am not sure that it is going to work. 
I modified this file: 
http://code.google.com/p/open-webkit-sharp/source/browse/Source/OpenWebKitSharp/
PrintManager.cs

Download the above and add it to your source. Then build the library and update 
it in your project. Please when you debug, if the same error occurs tell me 
what the values of _RemotableHandle hdc are (the int values inside the object)

Original comment by tsumalis96@gmail.com on 26 Nov 2011 at 11:14

GoogleCodeExporter commented 8 years ago
I have tried applying the patch to the latest version but the same divide by 
zero exception still occurs.

Some example values of the hdc are as follows:
fcontext = -1558111167 
u:
hInproc = 40
hRemote = 40

fcontext, hInproc, and hRemote change with each execution
hInproc always seems to be equal to hRemote

Original comment by ben.war...@gmail.com on 26 Nov 2011 at 3:03

GoogleCodeExporter commented 8 years ago
I need to find a way to convert the _remotableHandle to a IntPtr and opposite 
in order to make printing operations work but _remotableHandle is a bit strange 
and although it is a handle, the conversion fails. Maybe I can find a way to 
convert the _remotableHandle to int within the interop library.

Original comment by tsumalis96@gmail.com on 26 Nov 2011 at 3:53

GoogleCodeExporter commented 8 years ago
I made another change for you to test it. Please download PrintManager.cs again 
if you want and rebuild.

Original comment by tsumalis96@gmail.com on 26 Nov 2011 at 6:33

GoogleCodeExporter commented 8 years ago
The latest version unfortunately still gives the same divide by zero error with 
the latest version of PrintManager.cs

Some example values of the hdc are as follows:
fcontext = 0 
u:
hInproc = -1574886399
hRemote = -1574886399 

fcontext is now always zero
hInproc always seems to be equal to hRemote

Original comment by ben.war...@gmail.com on 27 Nov 2011 at 12:21

GoogleCodeExporter commented 8 years ago
OK Now I went deeper into WebKit and changed some interfaces on the Type 
Library. I changed all HDCs to ints so that it does not ask for 
_remotableHandle. I will commit the revision in a minute from now

Original comment by tsumalis96@gmail.com on 27 Nov 2011 at 9:10

GoogleCodeExporter commented 8 years ago
New revision is available

Original comment by tsumalis96@gmail.com on 27 Nov 2011 at 9:15

GoogleCodeExporter commented 8 years ago
Ok I have just checked out and compiled the new version. I have a slightly 
different error now.

When I attempt to print I get an exception on line 75 with all the public 
elements of "_printGfx" giving an "InvalidOperationException -  Object is 
currently in use elsewhere."

Original comment by ben.war...@gmail.com on 27 Nov 2011 at 11:32

GoogleCodeExporter commented 8 years ago
Thanks for the info. I will inform you if I find anything else that I can do.

Original comment by tsumalis96@gmail.com on 28 Nov 2011 at 3:11

GoogleCodeExporter commented 8 years ago
In the latest revision I fixed this problem but the Print Preview shows blank 
pages and I don't know if printing works. The dialogs now show up without 
exceptions.

Original comment by tsumalis96@gmail.com on 29 Nov 2011 at 5:15

GoogleCodeExporter commented 8 years ago
Thanks for the update I have just checked the it and it appears to be giving me 
some exceptions in the WebUIDelegate.cs folder due to 
webViewHeaderHeight(WebView WebView) and  webViewFooterHeight(WebView WebView) 
not being implemented.

As these functions are supposed to return a float I tried changing them 
slightly just to return an arbitrary number (I used 100 for both). The print 
and print preview pages then display without exceptions but all the pages are 
blank without any content but it seems like a good step in the right direction.

Original comment by ben.war...@gmail.com on 30 Nov 2011 at 12:41

GoogleCodeExporter commented 8 years ago
Maybe these functions are the key to success then. I will try to do this.

Original comment by tsumalis96@gmail.com on 30 Nov 2011 at 3:35

GoogleCodeExporter commented 8 years ago
Hackish printing is now used

Original comment by tsumalis96@gmail.com on 30 Dec 2011 at 11:24