Re: VB Printer Dialog Problem (VB6)



<andy.vandierendonck@xxxxxxxxxx> wrote in message news:1151918512.530634.13860@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

It should be better if we make another
topic: Useful Print tips (VB6) :-)

Yeah. It is getting a bit long this thread :-)

Now at first, I understand the thing with the bottom
margin. I'll modify my code, the less problems I
have, the better!

Yes. And the right margin as well. Don't forget that. You'll find that if you code it in the way I have suggested it will work reliably on all printers. Also, if you code the rest of your stuff properly, it will also work correctly even if the user chooses to use landscape instead of portrait, or perhaps switches to a different paper size.

the 'DummyRun'. Printer.KillDoc gave me already
problems. Sometimes it happens that the Document
to kill not dissapears in the printer waitlist. As status
it display: "Removing..." But after a few hours it still
is removing.

Yes. I did say that was not the method I would recommend. I've never actually used it myself and I just threw it into the melting pot in case you didn't fancy amending your code in accordance with my main suggested method. I tested KillDoc here just on a very simple print job and it worked fine, but I had visions of it causing problems with more complex print jobs and possibly on certain specific printers. But my suggested method of altering the CurrentX and CurrentY positions instead of actually printing the stuff and then setting them to zero instead of doing a NewPage works fine and is reliable:

With Printer
If DummyRun = False Then
.Print TextToPrint
Else
.CurrentY = .CurrentY + TextHeight(TextToPrint)
End If
End With

That method, as I suggested in my post, is very sound and you won't have any problems with it. In fact it is essentially the very same method that is used by the DrawText API when you use the DT_CALCRECT flag and by the RichTextBox when you send it an EM_FORMATRANGE message with a wParam of False (Do Not Render). Of course you'll also have to similarly change any code that draws lines or boxes or circles or paints pictures, in the way that I have also suggested, but that shouldn't be too much of a problem.

Thank you very much for all the help!

You're welcome.

Mike


.



Relevant Pages

  • Re: VB Printer Dialog Problem (VB6)
    ... margin", which on many printers is itself a little to the right of the left ... value of 12, Call SetMargin. ... the very bottom most position you can ...
    (comp.lang.basic.visual.misc)
  • Re: Word setting huge bottom margin
    ... This problem is in the Preferences, and an Archive/Install keeps the ... I have 5 identical Intel minis printing to a couple of HP printers (P2015, ... and if you then do Fix, it changes the bottom margin to 18.37". ...
    (microsoft.public.mac.office.word)
  • Re: Printer paper margin problem
    ... Chris Evans wrote: ... When I do a printout from TechWriter/EasyWriter the margin on ... The top margin is correct. ... I've tried editing paper margins for various printers over the last few ...
    (comp.sys.acorn.hardware)
  • Need suggestions for a printer.
    ... After checking out several printers and flipping through various ... The fact that the bottom margin is ... Takes pigment black ink. ... If it doesn't take giant cartridges, ...
    (comp.periphs.printers)
  • Re: Print Preview
    ... the print and with the ink issue. ... I never mentioned an ink issue with HP printers. ... HP's driver in such a way as to make it almost totally useless). ... smaller) margin on me. ...
    (microsoft.public.publisher)