I have a RichText that has Shape objects painted to it. The shapes are 18 pixels (line height) by 4 pixels. Each shape I add to the RichText is visible in the RichText.
My problem is that I cannot get all the shapes to show in a twpPreviewDlg, twPreview, or wpPDFPrinter when I use RichText.PrintPageOnCanvas. All of the text prints fine. But the Shapes do not.
At best the shapes show in the top half of a page. Any shapes in the lower half of the page do not show. RichText.Print also has problems with the shapes. In short, either PrintPageOnCavas has a problem, or I just cannot figure out how to use it correctly
I can iterate the Shape objects using RichText.TextObjects.List[x].
I can iterate the Shape objects using RichText.TextObjects.GotoNext.
I can use GoToNext and AtCP to get the objects and paint them to the canvas using obj.PaintTo(toCanvas,r) as shown below. But this only seems to work for wpPDF. I need to be able to use TwpPreviewDlg or TwpPreviev or RichText.Print.
Is there a bug in Preview or in PrintPageOnCanvas? Or am I doing something wrong?
CODE FOR PAINTING INDIVIDUAL OBJECTS
wpRichTextMargin.TextObjects.GotoNext;
obj := wpRichTextMargin.textobjects.AtCP;
x := (wpRichTextMargin.CPColNr+1) * 11;
Y := wpRichTextMargin.CPParNr * muldiv(wpRichTextMargin.ActiveLine.Height,screen.PixelsPerInch, 1440);
r.TopLeft := Point(x,Y);
r.BottomRight := Point(obj.Width+x,obj.Height+y);
TwpoShape(obj).PaintTo(toCanvas,r);
inc(wpRichTextMargin.Memo.cursor_pos);