Results 1 to 10 of 10

Thread: [RESOLVED] printing upside down

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    8

    Resolved [RESOLVED] printing upside down

    How can I make a few lines of text print upside down in a paper? The thing is there is this form paper which must go into the printer feeder upwards, so that you need to print on it upside down.

    Is there a setting for this (like "landscape" for printing sideways)? or some workaround?

    Thank you very much for your help.

  2. #2

  3. #3
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: printing upside down


  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    8

    Re: printing upside down

    Quote Originally Posted by RhinoBull
    Can't you just flip the paper?
    No because on the top of the form paper there is some kind of glue and if this edge goes first on the printer feeder there is a big probability that the paper will not enter correctly.

    There must be some way to send things to the printer rotated by 180 deg, no?

  5. #5
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: printing upside down

    What is your document ?
    How are you printing it ?
    Do you need mixed-mode ? (some lines upside down, some lines straight ?)

  6. #6

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    8

    Re: printing upside down

    What I need to print is an image with a logo and a couple of text lines.
    This will fit on a single page and everything (image and text) should be printed upside down on the page because of the way the paper goes into the printer feeder.

    How to print this is what I'm trying to figure out...

    I have no experience in printing with VB, but from what I've read in the forum an option could be using a richtextbox to format the page, right?

    Then I just have to send the formatted page to the printer upside down...

    How to do this? I really appreciate any help.

  7. #7
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: printing upside down

    Have you checked the properties for your printer? I have some SATO bar code printers and I can tell the printer to flip everything 180 degrees.

  8. #8
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: printing upside down

    Here is a code that can print RTB contents upside-down. Put your picture and text inside a RichTextBox and use it.

    Basically what it is doing is, printing the RTB contents to a picture using RTB's .SelPrint method, then flipping the picture using picturebox's PaintPicture method and finally it is printing the picture using Printer.PaintPicture method.

    This code is not 100% full-proof. You may need more RTB formatting code. See the How to set up the RichTextBox control for WYSIWYG printing article in MSDN.

    VB Code:
    1. ' Paste this code in a Form.
    2. ' Add 2 pictureboxes - [b]picSource[/b] and [b]picDest[/b]
    3. ' Add a richtextbox - [b]RichTextBox1[/b]
    4. ' Add a command button - [b]Command1[/b]
    5. Private Sub Command1_Click()
    6.  
    7.   ' Resize RTB --->
    8.  
    9.   With RichTextBox1
    10.  
    11.     '[b]Set ScrollBars = rtfNone at designtime[/b]
    12.     .Width = Printer.ScaleWidth
    13.     .Height = Printer.ScaleHeight
    14.     .SelStart = 0
    15.  
    16.   End With
    17.  
    18.   '--------------------------------------
    19.   ' Resize picSource --->
    20.  
    21.   With picSource
    22.  
    23.     .Width = Printer.ScaleWidth
    24.     .Height = Printer.ScaleHeight
    25.     .BackColor = vbWhite
    26.     .Picture = Nothing
    27.     .Cls
    28.     .AutoRedraw = True
    29.     ' Print RTB Content to picSource's hDC
    30.     ' You may need more fancy RTB formatting code here
    31.     RichTextBox1.SelPrint .hdc 'THIS IS IT !
    32.     .Picture = .Image
    33.     .AutoRedraw = False
    34.     .Refresh
    35.  
    36.   End With
    37.  
    38.   '--------------------------------------
    39.  
    40.   With picDest
    41.  
    42.     ' Resize picDest --->
    43.  
    44.     .Width = Printer.ScaleWidth
    45.     .Height = Printer.ScaleHeight
    46.     .BackColor = vbWhite
    47.     '--------------------------------------
    48.     ' Flip Vertically --->
    49.     .AutoRedraw = True
    50.     .PaintPicture picSource.Picture, picSource.ScaleWidth, 0, _
    51.                   -picSource.ScaleWidth, picSource.ScaleHeight, _
    52.                   0, 0, picSource.ScaleWidth, picSource.ScaleHeight, vbSrcCopy
    53.                  
    54.     picSource.Picture = .Image
    55.     .AutoRedraw = False
    56.     '--------------------------------------
    57.     ' Flip Horizentally --->
    58.     .Cls
    59.     .AutoRedraw = True
    60.     .PaintPicture picSource.Picture, 0, picSource.ScaleHeight, _
    61.                   picSource.ScaleWidth, -picSource.ScaleHeight, _
    62.                   0, 0, picSource.ScaleWidth, picSource.ScaleHeight, vbSrcCopy
    63.                  
    64.     Set .Picture = .Image
    65.     .AutoRedraw = False
    66.     .Refresh
    67.  
    68.   End With
    69.  
    70.   '--------------------------------------
    71.   'Finally Print
    72.   Printer.PaintPicture picDest.Picture, 0, 0
    73.   Printer.EndDoc
    74.  
    75. End Sub

    Hope it helps.

  9. #9

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    8

    Re: printing upside down

    Thank you for your help.

    I don't have VB on this computer but I will try iPrank's code this evening and let know tomorrow if it does what I need.

  10. #10

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    8

    Re: printing upside down

    That code did solve my problem. It's exactly what I needed: wonderful rotation of 180 deg with the two combined flips. Thank you very much!

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