Search Tools Links Login

Send a preformated file to any printer

Posted: 2002-06-01
By: ArchiveBot
Viewed: 152

Filed Under:

VB6 Code Cache

No attachments for this post

Q. How can I send a preformated file to a printer "as is". If I use Printer.Print then things like ESC get converted to a box or whatever chr$(27) is in the current font.
A.I'm using following code to send AutoCAD .plt-files to my printer, and it works ok for me. "Soren Staun Jorgensen"

Original Author: Newsgroup Posting

API Declarations

Public Declare Function CopyFile& Lib "kernel32" Alias "CopyFileA" (ByVal
lpExistingFileName As String, ByVal lpNewFileName As String, ByVal
bFailIfExists As Long)


Public Sub SendFileToPrinter()
  Dim FileName As String
  Dim s As Long
  Dim i As Integer
  For i = 0 To frmMain.List.ListCount - 1
    If frmMain.List.Selected(i) Then
      FileName = CurFolder & "" & frmFileList.File.List(i)
      s = SendToPort(FileName, CurPrnPort, vbNull)
      frmMain.List.Selected(i) = False
    End If
  Next i
End Sub
Public Function SendToPort(sFileName$, sPortName$, lPltFailed&)
Dim s As Long
  s = CopyFile(sFileName, sPortName, lPltFailed)
End Function

Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.