m***@gmail.com
2014-06-03 17:06:18 UTC
I'm having an unnecessarily difficult time getting printing to work. For
now I'm testing with the Microsoft XPS Document Writer. By default it has
no margins so the page size equals the printable size. I figured this would
be a good place to start although my code should take margins into effect
for normal printers. If I am simply printing the Scintilla contents only
everything looks good. Alignment of the text is correct, each page prints
properly, etc. When I add header/footer text the first page looks perfect.
Everything is painted where it should be. Pages 2-N are different. My
header/footer are both shifted up by 11 pixels. The Scintilla painted
region is still properly positioned. If I replace the call to
SCI_FORMATRANGE with an increment of my lengthPrinted variable (same logic
as done in SciTE) by 1000 each iteration to simulate printing and getting
through the loop with 2+ pages the header and footer are properly
positioned.
So, to recap...
1. Header/footer display properly on page 1, but are both shifted up 11
pixels on pages 2-N. The up shift is the same on each page 2-N, it's not 11
on page two, 22 on page three, etc.
2. Removing SCI_FORMATRANGE and simulating multiple pages does not create a
header/footer shift, they are properly positioned.
My code is a near clone of SciTE's logic. I've omitted the custom margin
setting stuff because we print only using the printer's margins and don't
allow the user to specify their own. I'm a Delphi developer and have been
using the TCanvas methods like TextOut and TextExtent to draw text and get
text sizes, but I've also tried the Windows API calls directly like
DrawTextW and creating clipping regions, etc. and I get the same behavior
regardless of the approach.
The attached file is my "printed" document that shows the problem I'm
having.
Any help or guidance is greatly appreciated. I've already scoured the SciTE
code to death and don't see anything functionally different.
Thanks,
Michael
PS. In the SciTE code I see wEditor.Call(SCI_FORMATRANGE, FALSE, 0); at the
end of printing, but the documentation does not mention this as a necessary
step. I've put in it my code since you're doing so in SciTE, but do you
have any additional explanation for doing so? My C is not as good, but it
looks like an unnecessary step that just returns 0 when I examine
FormatRange in the source.
now I'm testing with the Microsoft XPS Document Writer. By default it has
no margins so the page size equals the printable size. I figured this would
be a good place to start although my code should take margins into effect
for normal printers. If I am simply printing the Scintilla contents only
everything looks good. Alignment of the text is correct, each page prints
properly, etc. When I add header/footer text the first page looks perfect.
Everything is painted where it should be. Pages 2-N are different. My
header/footer are both shifted up by 11 pixels. The Scintilla painted
region is still properly positioned. If I replace the call to
SCI_FORMATRANGE with an increment of my lengthPrinted variable (same logic
as done in SciTE) by 1000 each iteration to simulate printing and getting
through the loop with 2+ pages the header and footer are properly
positioned.
So, to recap...
1. Header/footer display properly on page 1, but are both shifted up 11
pixels on pages 2-N. The up shift is the same on each page 2-N, it's not 11
on page two, 22 on page three, etc.
2. Removing SCI_FORMATRANGE and simulating multiple pages does not create a
header/footer shift, they are properly positioned.
My code is a near clone of SciTE's logic. I've omitted the custom margin
setting stuff because we print only using the printer's margins and don't
allow the user to specify their own. I'm a Delphi developer and have been
using the TCanvas methods like TextOut and TextExtent to draw text and get
text sizes, but I've also tried the Windows API calls directly like
DrawTextW and creating clipping regions, etc. and I get the same behavior
regardless of the approach.
The attached file is my "printed" document that shows the problem I'm
having.
Any help or guidance is greatly appreciated. I've already scoured the SciTE
code to death and don't see anything functionally different.
Thanks,
Michael
PS. In the SciTE code I see wEditor.Call(SCI_FORMATRANGE, FALSE, 0); at the
end of printing, but the documentation does not mention this as a necessary
step. I've put in it my code since you're doing so in SciTE, but do you
have any additional explanation for doing so? My C is not as good, but it
looks like an unnecessary step that just returns 0 when I examine
FormatRange in the source.
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.