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:
Code
procedure PrintDoc(nCopies : Integer;
nPaperSource1Page : Integer = -1;
nPaperSourceAllPage: Integer = -1);
var nOldPaperSource1Page : Integer;
nOldPaperSourceAllPage : Integer;
bHidden : Boolean;
begin
nOldCopies := Printer.Copies;
nOldPaperSource1Page := WF.WPRTF.PrintParameter.FirstPagePaperSource;
nOldPaperSourceAllPage := WF.WPRTF.PrintParameter.AllPagePaperSource;
bHidden := WF.WPRTF.InsertPointAttr.Hidden;
if nPaperSource1Page <> -1 then
WF.WPRTF.PrintParameter.FirstPagePaperSource := nPaperSource1Page;
if nPaperSourceAllPage <> -1 then
WF.WPRTF.PrintParameter.AllPagePaperSource := nPaperSourceAllPage;
WF.WPRTF.InsertPointAttr.Hidden := True;
WF.WPRTF.HyperlinkTextAttr.UseOnGetAttrColorEvent := False;
WF.WPRTF.AutomaticTextAttr.UseOnGetAttrColorEvent := False;
WF.WPRTF.DelayedReformat;
WF.WPRTF.ReformatAll(true);
WF.WPRTF.PrintParameter.PrintTitle := WF.WPRTF.LastFileName;
Printer.Copies := nCopies;
WF.WPRTF.Print;
WF.WPRTF.PrintParameter.FirstPagePaperSource := nOldPaperSource1Page;
WF.WPRTF.PrintParameter.AllPagePaperSource := nOldPaperSourceAllPage;
WF.WPRTF.InsertPointAttr.Hidden := bHidden;
WF.WPRTF.HyperlinkTextAttr.UseOnGetAttrColorEvent := True;
WF.WPRTF.AutomaticTextAttr.UseOnGetAttrColorEvent := True;
WF.WPRTF.ReformatAll(True, True);
end;
Alles anzeigen
Don't know where to look for!
Patrick