VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Send a preformated file to any printer

by Newsgroup Posting (15 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (38 Votes)

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"

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

Rate Send a preformated file to any printer

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

Download this snippet    Add to My Saved Code

Send a preformated file to any printer Comments

No comments have been posted about Send a preformated file to any printer. Why not be the first to post a comment about Send a preformated file to any printer.

Post your comment

Subject:
Message:
0/1000 characters