请教大侠!
VB中。如何打印几行字就结束而不让打印机换页。就如超市的打印机一样可以连续不断的打印。
我遇到的问题是不管打印几个字,都要浪费一页纸,我想要每次打印都是继续着上次打印位置继续打而不要换页。
多谢!!!

解决方案 »

  1.   

    printer.print "dsfsdfds"
    printer.EndDoc
    就这么几个字却要一页纸
      

  2.   

    不要调用EndDoc.
    设置页面高度小一点,然后调用printer.NewPage,只走你设置的高度
      

  3.   

    EndDoc只在最后调用,把所有数据都打印完后,再调用EndDoc。
    换页时自己控制(NewPage)
      

  4.   

    用户要求实时打印,不调用EndDoc,打印机不打印怎么办?请问怎么根据文本行数设置页面高度?
      

  5.   

    用户要求实时打印,不调用EndDoc,打印机不打印怎么办?请问怎么根据文本行数设置页面高度或者纸张大小?
      

  6.   

    不是不调用EndDoc,而是在把当前要打印的东西都Print之后,才调用EndDoc
      

  7.   

    我也有相同的问题 
    用printer.newpage printer.endoc 好像不能解决问题
    代码如下:
    Printer.ScaleMode = 6
    Printer.FontSize = 12
    printer.width=120
    printer.height=90Printer.FontBold = False
    Printer.FontName = "楷体_GB2312"
    Printer.CurrentX = 19 
    Printer.CurrentY = 70
    printer.print "我是一个人。"
    Printer.NewPage
    Printer.EndDoc
      

  8.   

    printer.EndDoc就是打印输出并换页,相对应的printer.NewDoc就是新开一页。
    至于你说的自动设置边距什么的问题比较难解决,
      

  9.   

    打印的机子操作系统相关的。
    98下,设置 printer对象的大小,即可。
    2000下的必须通过api,设置打印窗口类型,如果没有你想要的大小的打印窗口,
    必须为系统新增一个打印窗口。
    ------------------------------------
    如果,你没有设置大小,系统根据默认的打印窗口类型打印出来,一般好像都是a4大小(不大确记)
    ----------------------------------------------
      

  10.   

    2000下,大概要用到下面的api,和常量,声明。
    Private Declare Function EnumForms Lib "winspool.drv" Alias "EnumFormsA" _
        (ByVal hPrinter As Long, ByVal Level As Long, ByRef pForm As Any, _
        ByVal cbBuf As Long, ByRef pcbNeeded As Long, _
        ByRef pcReturned As Long) As LongPrivate Declare Function AddForm Lib "winspool.drv" Alias "AddFormA" _
        (ByVal hPrinter As Long, ByVal Level As Long, pForm As Byte) As LongPrivate Declare Function DeleteForm Lib "winspool.drv" Alias "DeleteFormA" _
        (ByVal hPrinter As Long, ByVal pFormName As String) As LongPrivate Declare Function OpenPrinter Lib "winspool.drv" _
        Alias "OpenPrinterA" (ByVal pPrinterName As String, _
        phPrinter As Long, ByVal pDefault As Long) As LongPrivate Declare Function ClosePrinter Lib "winspool.drv" _
        (ByVal hPrinter As Long) As LongPrivate Declare Function DocumentProperties Lib "winspool.drv" _
        Alias "DocumentPropertiesA" (ByVal hwnd As Long, _
        ByVal hPrinter As Long, ByVal pDeviceName As String, _
        pDevModeOutput As Any, pDevModeInput As Any, ByVal fMode As Long) _
        As LongPrivate Declare Function ResetDC Lib "gdi32" Alias "ResetDCA" _
        (ByVal hdc As Long, lpInitData As Any) As LongPrivate Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" _
        (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)Private Declare Function lstrcpy Lib "KERNEL32" Alias "lstrcpyA" _
        (ByVal lpString1 As String, ByRef lpString2 As Long) As Long' Optional functions not used in this sample, but may be useful.
    Private Declare Function GetForm Lib "winspool.drv" Alias "GetFormA" _
        (ByVal hPrinter As Long, ByVal pFormName As String, _
        ByVal Level As Long, pForm As Byte, ByVal cbBuf As Long, _
        pcbNeeded As Long) As LongPrivate Declare Function SetForm Lib "winspool.drv" Alias "SetFormA" _
        (ByVal hPrinter As Long, ByVal pFormName As String, _
        ByVal Level As Long, pForm As Byte) As Long' Constants for DEVMODE
    Private Const CCHFORMNAME = 32
    Private Const CCHDEVICENAME = 32
    Private Const DM_FORMNAME As Long = &H10000
    Private Const DM_ORIENTATION = &H1&' Constants for PRINTER_DEFAULTS.DesiredAccess
    Private Const PRINTER_ACCESS_ADMINISTER = &H4
    Private Const PRINTER_ACCESS_USE = &H8
    Private Const STANDARD_RIGHTS_REQUIRED = &HF0000
    Private Const PRINTER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or _
        PRINTER_ACCESS_ADMINISTER Or PRINTER_ACCESS_USE)' Constants for DocumentProperties() call
    Private Const DM_MODIFY = 8
    Private Const DM_IN_BUFFER = DM_MODIFY
    Private Const DM_COPY = 2
    Private Const DM_OUT_BUFFER = DM_COPY
    ' Custom constants for this sample's SelectForm function
    Private Const FORM_NOT_SELECTED = 0
    Private Const FORM_SELECTED = 1
    Private Const FORM_ADDED = 2Private Type RECTL
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End TypePrivate Type SIZEL
            cx As Long
            cy As Long
    End TypePrivate Type SECURITY_DESCRIPTOR
            Revision As Byte
            Sbz1 As Byte
            Control As Long
            Owner As Long
            Group As Long
            Sacl As Long  ' ACL
            Dacl As Long  ' ACL
    End Type' The two definitions for FORM_INFO_1 make the coding easier.
    Private Type FORM_INFO_1
            Flags As Long
            pName As Long   ' String
            Size As SIZEL
            ImageableArea As RECTL
    End TypePrivate Type sFORM_INFO_1
            Flags As Long
            pName As String
            Size As SIZEL
            ImageableArea As RECTL
    End TypePrivate Type DEVMODE
            dmDeviceName As String * CCHDEVICENAME
            dmSpecVersion As Integer
            dmDriverVersion As Integer
            dmSize As Integer
            dmDriverExtra As Integer
            dmFields As Long
            dmOrientation As Integer
            dmPaperSize As Integer
            dmPaperLength As Integer
            dmPaperWidth As Integer
            dmScale As Integer
            dmCopies As Integer
            dmDefaultSource As Integer
            dmPrintQuality As Integer
            dmColor As Integer
            dmDuplex As Integer
            dmYResolution As Integer
            dmTTOption As Integer
            dmCollate As Integer
            dmFormName As String * CCHFORMNAME
            dmUnusedPadding As Integer
            dmBitsPerPel As Long
            dmPelsWidth As Long
            dmPelsHeight As Long
            dmDisplayFlags As Long
            dmDisplayFrequency As Long
    End TypePrivate Type PRINTER_DEFAULTS
           pDatatype As String
           pDevMode As Long    ' DEVMODE
            DesiredAccess As Long
    End TypePrivate Type PRINTER_INFO_2
            pServerName As String
            pPrinterName As String
            pShareName As String
            pPortName As String
            pDriverName As String
            pComment As String
            pLocation As String
            pDevMode As DEVMODE
            pSepFile As String
            pPrintProcessor As String
            pDatatype As String
            pParameters As String
            pSecurityDescriptor As SECURITY_DESCRIPTOR
            Attributes As Long
            Priority As Long
            DefaultPriority As Long
            StartTime As Long
            UntilTime As Long
            Status As Long
            cJobs As Long
            AveragePPM As Long
    End Type