Error handling win WPDFPrinter

  • How can I handle errors in WPDFPrinter?

    TWPPDFPrinter *WPPDFPrinter1;
    .
    .
    .

    WPPDFPrinter1->Filename = sPDF_FileName;
    WPPDFPrinter1->BeginDoc();
    .
    .
    .


    The path in sPDF_FileName points to a device which is not available, e.g. a USB-Stick which is not plugged in. In the debugger I get an exception in the WPF-dll, but I have to know what happened and if creating the file was successfull.

    Thanks in advance!

    Lewis

    • Offizieller Beitrag

    >> The path in sPDF_FileName points to a device which is not available, e.g. a USB-Stick which is not plugged in. In the debugger I get an exception in the WPF-dll, but I have to know what happened and if creating the file was successfull. <<

    In this case the BeginDoc procedure will also create an exception and set the variable LastError to 1.

  • OK, I found that, it is working, thank you!

    But I do the creating of PDF in a COM-Server, and there I always get the LastError-Variable with 0!

    WPPDFPrinter1->BeginDoc();
    iPDFError = WPPDFPrinter1->LastError;

    if (iPDFError == 0)
    {
    ...
    }
    else
    {
    return -1;
    }

    Lewis