Results 1 to 11 of 11

Thread: WITH PRINTER...image

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,586

    WITH PRINTER...image

    pseudo code:

    Code:
    with printer
    ....
    Printer.Print ""
            picBarCode.AutoRedraw = True
            Printer.PaintPicture picBarCode.Image, 0, 0, picBarCode.Width, picBarCode.Height
    ....
            Printer.EndDoc
    
        End With
    when i print the doc the picBarCode, is printed on the top of document!, and not to the bottom...

    note:
    - picBarCode is a picturebox on form
    - and i need to center orizonthal the image

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: WITH PRINTER...image

    You told it to paint the picture at coordinates (0, 0) so it is doing as requested.

    Centering is pretty easy. Use an X-offset value that is 0.5 * (DestWidth - PictureWidth).

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,586

    Re: WITH PRINTER...image

    Quote Originally Posted by dilettante View Post
    You told it to paint the picture at coordinates (0, 0) so it is doing as requested.

    Centering is pretty easy. Use an X-offset value that is 0.5 * (DestWidth - PictureWidth).
    ???
    Example, please.

    and....

    how to the code know to print the image to the and of last line printed?

    in effect, i have a similar code:

    whith printer
    ...
    Printer.Print "------------------------------------------------------------"
    Printer.Print ""
    Printer.Print "test1"
    Printer.Print "test2"
    Printer.Print "test3"
    Printer.Print "..."
    Printer.Print "this is last line"
    <here i need to print the image

    end with

    note:
    the number of line are variable
    Last edited by luca90; Oct 16th, 2021 at 10:29 AM.

  4. #4
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: WITH PRINTER...image

    Checkout the CurrentX, CurrentY Properties in VB help

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: WITH PRINTER...image

    The PaintPicture() method has no relationship with CurrentX or CurrentY.

  6. #6
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,176

    Re: WITH PRINTER...image

    luca---YOU do it...dile laid it out in pretty plain English...
    Sam I am (as well as Confused at times).

  7. #7
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: WITH PRINTER...image

    Quote Originally Posted by dilettante View Post
    The PaintPicture() method has no relationship with CurrentX or CurrentY.
    But in theory you could retrieve the currentx and currenty and pass those to the paint picture function

  8. #8
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: WITH PRINTER...image

    Dile
    I was thinking about a line like
    Code:
    Printer.PaintPicture picBarCode.Image, Printer.CurrentX, Printer.CurrentY, picBarCode.Width, picBarCode.Height
    From post #3 it looks like the OP wants the Picture printed after the last line of text.

  9. #9
    Hyperactive Member
    Join Date
    Jul 2020
    Posts
    370

    Re: WITH PRINTER...image

    Top middle:
    Code:
    Printer.PaintPicture picBarCode.Image, (Printer.Width - picBarCode.ScaleWidth) / 2, 0, picBarCode.ScaleWidth, _
            picBarCode.ScaleHeight, 0, 0, picBarCode.ScaleWidth, picBarCode.ScaleHeight, vbSrcCopy
    Bottom middle:
    Code:
    Printer.PaintPicture picBarCode.Image, (Printer.Width - picBarCode.ScaleWidth) / 2, (Printer.Height - picBarCode.ScaleHeight), _
    picBarCode.ScaleWidth, picBarCode.ScaleHeight, 0, 0, picBarCode.ScaleWidth, picBarCode.ScaleHeight, vbSrcCopy

  10. #10
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: WITH PRINTER...image

    Quote Originally Posted by Magic Ink View Post
    From post #3 it looks like the OP wants the Picture printed after the last line of text.
    Could be. I mostly got "please write this line of code for me" once again.

  11. #11
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,176

    Re: WITH PRINTER...image

    Exactly, dile....that is why i posted #6!
    Sam I am (as well as Confused at times).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width