Instance of TWPVirtPage is not valid!

  • Hi Julian

    sometimes printing a document i get the Exception 'Instance of TWPVirtPage is not valid!'

    In WPRTEDefs i found this code

    Code
    function TWPVirtPage.GetImageRefCount: Integer;begin  if FImageRefs <> nil then    Result := FImageRefs.Count  else  begin   {$IFDEF WPDEBUG}    Result := 0;   {$ELSE}    raise Exception.Create('Instance of TWPVirtPage is not valid!');   {$ENDIF}  end;end;

    Printing hundred of pages, nothing happens! Sometimes printing five times the same document, i get the error five times.

    The documents look always the same. One header only on the first page, one header not on first page.

    For printing, i use the following method:

    Don't know where to look for!


    Patrick

  • Hi Julian,

    tried this and get the error again. I unaligned the Preview and again the same.

    What happens: It's a document of two pages:

    First Page: Header only on First Page and Text within the Body
    Second Page: Header not on First Page and Text within the Body

    Printing the document, the first page is ok. On the second page only the header ist printed. I get the error message "'Instance of TWPVirtPage is not valid!" and after acknowledge the message, the editor gets the focus back and cursor is showing in the active header of the second page!!!

    Closing the editor i get many access violations....

    Hope that helps a litte bit more!

    Delphi 7
    WPTools 5.20.6

    Patrick

  • I have one (and only one) user who is getting this error ("instance of TWPVirtPage is not valid!"). Looking at the error logs that our app keeps, it is possible that this started with Service Pack 3 of Win-XP. My hunch is that this is a printer driver conflict of some kind.

    You asked in a previous post if they had a call stack. I do have one and am posting it now in case it might help shed some light:

    WPRTEDefs.TWPVirtPage.GetImageRefCount
    WPRTEPaint.TWPRTFEnginePaint.PaintRTFPage
    WPCTRMemo.TWPCustomRtfEdit.PaintPageOnCanvas (Line 8617, "WPCTRMemo.pas")
    WPCTRMemo.TWPCustomRtfEdit.PrintPage (Line 13225, "WPCTRMemo.pas")
    WPCTRMemo.TWPCustomRtfEdit.PrintPages (Line 13403, "WPCTRMemo.pas")
    WPCTRRich.TWPCustomRichText.Print (Line 3341, "WPCtrRich.pas")

    We are using WPTools ver 5.35.3.

    I also found a callstack from an older version that our user was using when the problem first surfaced earlier this year (06/2009). That old copy of our app was probably using WPTools ver 3:

    WPPrint.PrintPage (Line 1527, "WPPrint.pas")
    System.@HandleAnyException (Line 4399, "system.pas")
    WPPrint.TWPPrinterEngine.PrintPagesNormal (Line 1704, "WPPrint.pas")

    As I said, I am convinced the cause is in their computer setup. I am posting this now in case the call stack helps anyone.

    Thanks,
    Gene Weinbeck
    FundRaiser Software

    • Offizieller Beitrag

    Hi,

    WPTools prior to V5 did not have a "TWPVirtPage", it used a completely different way to organize the lines.

    If there also happens a problem during printing I assume the problem is, that during printing stille editing or other access happens.

    Is it possible that this user where it happens has spooling switched off?

    I also assume that this is a rather long text, with many pages which takes "long" to print.

    Julian

  • Hi Julian,

    1) I will check about the spooling.

    2) Yes. The text is actually a series of merged form letters, often 100's or 1,000's at a time. The letters go into a database, then printed from there. The user has the option of first previewing the letters (one by one) from the database table, using a TWpRichText, not the TWpPreviewDlg.

    3) This problem occurs more frequently than I had understood. Looking back through our tech support notes for all customers, I have found many more instances of this, and they all occur when printing a series of letters.
    Sometimes, if they have this error when printing all from the preview, the error will stop when they restart our application and re-print without previewing.
    Sometimes, the problem will go away if they reduce the size of the graphic images in the letter.
    In a few cases, they will need to restart Windows before the problem goes away.

    Gene