Hello,
I have a strange bug on some PC in a unknown but reproductible situation in TRVHeaderFooterRVData.DrawBackToBitmap
when I print a document, "pi.Background" is null,
you test for instance "(pi <> nil) and (pi.Background.Color..", I have to add "(pi <> nil) and (pi.Background <> nil) and (pi.Background.Color ..."
do you know how it can happend ? I can't reproduce that on my dev machine, only on customers PC, I've found the situation by iteration with debug messages :/
strange bug in TRVHeaderFooterRVData.DrawBackToBitmap
-
- Site Admin
- Posts: 17579
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: strange bug in TRVHeaderFooterRVData.DrawBackToBitmap
Sorry, I do not understand how it could be, an object for BackgroundProperty ofTCustomRVParaInfo is created in its constructor and destroyed in its destructor.
Something is corrupted.
Something is corrupted.
Re: strange bug in TRVHeaderFooterRVData.DrawBackToBitmap
ok
pi is FParaStyle and pi.ClassName returns TIBCParam !!!
is see that FParaStyle is "valid only in DrawPage"...but it point to something completly out of scope (IBDAC SQL Parameter)
maybe it's one of my patches that does this...but I do not change anything in the para styles
I'll revert my changes (for PDF printing) and use the VirtualPrinter feature
is it possible that the FParaStyle point to an old instance of a ParaStyle and have never been set to nil and the same address point now to something completly different ?
pi is FParaStyle and pi.ClassName returns TIBCParam !!!
is see that FParaStyle is "valid only in DrawPage"...but it point to something completly out of scope (IBDAC SQL Parameter)
maybe it's one of my patches that does this...but I do not change anything in the para styles
I'll revert my changes (for PDF printing) and use the VirtualPrinter feature
is it possible that the FParaStyle point to an old instance of a ParaStyle and have never been set to nil and the same address point now to something completly different ?
Re: strange bug in TRVHeaderFooterRVData.DrawBackToBitmap
yep I have probably missed something in my patch (taken from an old RV version), when I use the VirtualPrinter everything is right.
Thanks
Thanks
Re: strange bug in TRVHeaderFooterRVData.DrawBackToBitmap
No
I have the same bug when saving to a PDF with this code
and the call stack
Note that at this moment I use also a TRVPrintPreview, and SaveAsPDF is called when I click on a toolbar button to export the preview to a PDF file
I have the same bug when saving to a PDF with this code
Code: Select all
procedure TRVPrint.SaveAsPDF(const AFileName: string);
begin
var Doc := LLPDFDocument.TPDFDocument.Create(nil);
Doc.PDFACompatible := True;
Doc.FileName := UniqueFileName(AFileName);
Doc.BeginDoc;
VirtualPrinter.Active := True;
VirtualPrinter.PageWidth := MulDiv(Doc.Page[0].Width, 96, 72);
VirtualPrinter.PageHeight := MulDiv(Doc.Page[0].Height, 96, 72);
var Pages := FormatPages(rvdoALL);
DrawPage(1, Doc.Canvas, False);
for var Page := 2 to Pages do
begin
Doc.NewPage;
DrawPage(Page, Doc.Canvas, False);
end;
Doc.EndDoc;
Doc.Free;
end;
Code: Select all
PtRVData.TCustomPrintableRVData.DrawBackToBitmap(77,-325,$116DEEC0,(1701016, 292417216, 12360940, 292770248, 265433312),-1,False,True,True,1)
PtRVData.TRVHeaderFooterRVData.DrawBackToBitmap(77,42,$116DEEC0,(1701016, 292417216, 1700852, 12402001, 1700796),-1,False,True,True,1)
PtRVData.TRectPtblRVData.DrawBackToBitmap(69,39,$116DEEC0,(1701016, 292417216, 12649144, 12649144, 1701036),-1,False,True,True,1)
PtRVData.DrawItemBackTotmpbmp(???)
PtRVData.TCustomPrintableRVData.DrawPage(1,1,$1165D3A8,True,False,True)
RVTable.DrawCell(0,0,361,4,4,45,40,0,1,$1165D3A8,(1701556, 291885992, 1, 0, (1701556, 291885992), (1, 0)),(1701276, 1701556, 291885992, 1, (1701276, 1701556), (291885992, 1)),True,False)
RVTable.TRVTableItemInfo.PaintTo(43,???,38,$1165D3A8,[rvidsPrint,rvidsPreviewCorrection],$1213EB20,$1165C558,False,(1701556, 0, 291882328, 303295264, (1701556, 0), (291882328, 303295264)),rvcmPrinterColor,$118199E8,nil,nil,0,0,1,False,False,0)
RVTable.TRVTableItemInfo.Print($1165D3A8,43,38,875,True,False,True,(1701812, 1, 0, 1, 875),???,rvcmPrinterColor,$118199E8,0,1,False)
PtRVData.TCustomPrintableRVData.DrawPage(1,1,$1165D3A8,True,False,True)
PtRVData.TPrintableRVData.DoPagePrepaint($1165D3A8,1,True,False,True,True)
PtRVData.TCustomPrintableRVData.DrawPage(1,1,$1165D3A8,True,False,True)
PtRVData.TCustomMainPtblRVData.DrawPage(???,???,$1165D3A8,True,False,True)
PtblRV.TCustomPrintableRV.DrawPage(1,$1165D3A8,True,False,True)
PtblRV.TRVPrint.DrawPage(1,$1165D3A8,False)
RichViewPatch.TRVPrint.SaveAsPDF(???)
Re: strange bug in TRVHeaderFooterRVData.DrawBackToBitmap
I don"t use backgrounds...is that correct to add a "FParaStyle := nil" after "FDrawITem := nil" at the end of DrawPage ? because it fix the problem.
-
- Site Admin
- Posts: 17579
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: strange bug in TRVHeaderFooterRVData.DrawBackToBitmap
Try assigning
FParaStyle := nil;
at the very end of procedure DrawParagraph (that is defined inside TCustomPrintableRVData.DrawPage).
Does it help?
If not, please send me a document where this problem happens to email richviewgmailcom.
FParaStyle := nil;
at the very end of procedure DrawParagraph (that is defined inside TCustomPrintableRVData.DrawPage).
Does it help?
If not, please send me a document where this problem happens to email richviewgmailcom.