krithika wrote:
> Hi,
> 
> Iam a newbie w.r.t Gecko code hacking.Iam trying to identify the exact
> position (dom element) at which page break occured.
> 
> I looked at nsSimplePageSequenceFrame , nsPageContentFrame.
> 
> Can someone tell me where exactly
> 
> 1. I can get the dom element at which page break occurs.
> 2. The offset left and top in the document at which page break occurs.
> 
> for instance if I can print page 1 occurs at offsetTop and offsetLet
> so and so.From which I can take the dom element.
> 
> 
> Thanks in Advance,
> Krithika
> 

You should be able to get the print preview PresShell from a 
DocumentViewer if it is in print preview mode. You can use that to get 
at the frame tree using GetPrimaryFrameFor or simply starting at the 
root using GetRootFrame.  Each page has its own frame, so you should be 
able to figure out what page an element starts on pretty easily.  Use 
GetNextContinuation, and you can find the page an element ends on.  Use 
GetOffsetToExternal, and you can find the coordinates of a frame 
relative to another frame, for example a page frame.  It's a little 
confusing, but you should be able to get any rendering information you need.

Of course, this is only accessible from C++, and nsIPresShell and 
nsIFrame can and will change frequently between releases.  That said, it 
should work.

For 1.9, I'm planning some changes that'll make it easier to get at the 
print presentation; that's still in the early planning stages, though.

-Eli
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to