Beiträge von dibby

    Hi,

    I've just checked the latest WPViewPDF control and it has strange problems with semi-transparent paths or images - it is visible in all palaces where in PDF there should be shadows.

    PDF file is valid - as it displays properly in many popular freeware viewers - but it does not in WPViewPDF
    [Blockierte Grafik: http://data.dibby.pl/wpview-pdf/new…pdf-viewers.png]

    Original file:
    http://data.dibby.pl/wpview-pdf/nea-cover-page.pdf

    Is there any possible solution for this problem?

    Hi,

    Thanks for reply. I've already read that keeping one "alive" control in the whole application life-time cycle could solve many problems that's why I have (hidden) one in my main form.

    Is it possible to get notified when WPViewPDF control closed its painting thread?

    My temporary solution to wait arbitrarily chosen period of time works, but I would not like it in my final application.

    10 seconds seems to be enough for WPViewPDF control to close all it's threads in any system I've tested - but this value cannot be sure (especially in some older systems / slower PCs) - and the worst thing is that disposing the control throws uncatchable exception that makes whole application crash?

    I have problem with WPViewPDF library - it randomly (but quite often) throws an exception when I try to dispose pdf viewer control.

    Exception details:

    Code
    ************** Exception Text **************System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.   at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)   at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)   at WPViewPDF.PDFViewer.DefWndProc(Message& m)   at System.Windows.Forms.Control.WmSetFocus(Message& m)   at System.Windows.Forms.Control.WndProc(Message& m)   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    As it is exception thrown from unmanaged code I cannot caught it in my .NET app and application crashes.


    Code
    private void PDFForm_FormClosing(object sender, FormClosingEventArgs e)        {            try            {                if (pdfViewer != null && !pdfViewer.IsDisposed && pdfViewer.IsHandleCreated)                {                    pdfViewer.Clear();                    pdfViewer.Dispose(); // <- Here this exception is thrown                    pdfViewer = null;                    GC.Collect();                }            }            catch (Exception ex)            {                Log.TraceError("Cannot dispose pdfViewer: {0}", ex, ex.Message);            }        }

    What can be the reason this exception is thrown?

    I use the latest release of the library together with .NET 4.0 framework.


    EDIT: I've found that this exception is thrown almost always when I open about 40MB encrypted PDF, scroll to 2nd or 5th page and immediately close PDF Viewer form.

    Temporary solution that seems to solve this problem on my clients PCs is to hide PDF viewer form and wait ~10 sec. before disposing controls.