Announcement

Collapse
No announcement yet.

Printing Without Formfeed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Printing Without Formfeed


    I have an application that prints labels in various formats.
    Label printing on laserjet or inkjet stock where each series
    of labels is on a separate page is not a problem. But, for
    those using a sprocket-feed type of label stock, each time any
    number of labels is printed, a formfeed is output and the
    sprocket-fed forms "eject" the length of a full page instead of
    just stopping at the end of the last-printed label.

    Referencing Charles Petzold's "Programming Windows, Fifth Edition",
    his simplest printing program (StartDoc, StartPage, EndPage,
    EndDoc) does just that; eject a blank page.

    The question is if it is even possible to send printed output to
    the printer without causing an entire "page" to be ejected as soon
    as EndDoc is submitted. I've been told there are Windows
    applications that do this, but I haven't found a way so far.


    Tom



    ------------------
    Tom Dandrea
    EQF Software
    Tom Dandrea
    EQF Software
    [email protected]

  • #2
    Yes it certainly can be done... I've even done it myself.

    The "trick" is that you have to set the page height in your DEVMODE structure then create your device context.
    Code:
    ' Pseudocode to show concept only
    DIM pDevMode AS DEVMODE PTR
    DIM PD       AS PRINTDLGAPI
    ...
    ' Get your default DC here from say, PrintDlg() with %PD_RETURNDC
    ' At this point, PD contains a handle of a DEVMODE structure.
    ...
    pDevMode = GlobalLock(PD.hDevMode)
    IF pDevMode THEN
      @pDevMode.dmFields      = @pDevMode.dmFields OR %DM_PAPERSIZE OR %DM_PAPERLENGTH OR %DM_PAPERWIDTH
      @pDevMode.dmPaperSize   = %DMPAPER_USER
      @pDevMode.dmPaperLength = 1000& ' 100mm in deci-mm
      @pDevMode.dmPaperWidth  = 4 * 254 ' 8" in deci-mm
      GlobalUnlock PD.hDevNames
    END IF
    ...
    Finally, use this modified DEVMODE with CreateDC, etc. Don't forget to GlobalLock/GlobalFree the structure first if you are working that way.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment

    Working...
    X