Printer Driver is not been specified

Asked

Viewed 338 times

1

I am using tsclib.dll to print labels on Bematech LB-1000. In the openport() Procedure it already gives the error Printer Driver is not been specified.

The printer is local, USB port and I am passing its name as parameter in this way:

openport('Bematech');

as explained in the dll instruction manual. But even following the instructions, this error continues. Using the printer’s own commands, it works normally. I believe the problem is actually in dll.

Someone’s been through this trouble and they know how to help me?

code:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    Button1: TButton;
    Image1: TImage;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
{$R GenericLIB.RES}

procedure openport(PrinterName:pchar);stdcall;far; external 'tsclib.dll';
procedure closeport; external 'tsclib.dll';
procedure sendcommand(Command:pchar);stdcall;far;external 'tsclib.dll';
procedure setup(LabelWidth, LabelHeight, Speed, Density, Sensor, Vertical,             Offset:pchar);stdcall; far; external 'tsclib.dll';
procedure downloadpcx(Filename,ImageName:pchar);stdcall;far;external     'tsclib.dll';
procedure barcode(X, Y, CodeType, Height, Readable, Rotation, Narrow, Wide,     Code :pchar); stdcall; far; external 'tsclib.dll';
procedure printerfont(X, Y, FontName, Rotation, Xmul, Ymul,     Content:pchar);stdcall;far; external 'tsclib.dll';
procedure clearbuffer; external 'tsclib.dll';
procedure printlabel(NumberOfSet, NumberOfCopoy:pchar);stdcall; far;external     'C:\Windows\System32\tsclib.dll';
procedure formfeed;external 'tsclib.dll';
procedure nobackfeed; external 'tsclib.dll';
procedure windowsfont (X, Y, FontHeight, Rotation, FontStyle, FontUnderline : integer; FaceName, TextContect:pchar);stdcall;far;external 'tsclib.dll';

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;

begin

  openport('Bematech');
        for i:=1 to 1 do
         begin
          clearbuffer;
          sendcommand('DIRECTION 1');
          windowsfont(10, 10, 30, 0, 2, 0, 'arial', 'Exemplo LB - 1000     Delphi - Bematech');
          barcode('10', '100', '128', '100', '1', '0', '2', '2', '1234567-    BEMATECH');
          printlabel('1', '1');
        end;
          closeport;


end;

end.
  • Have you checked in Painel de Controle > Dispositivos e Impressoras if the printer appears there with that name you set?

  • You have previously followed this tutorial http://partners.bematech.com.br/bemacast/Paginas/post.aspx?idPost=6112 ?

  • Yes @Sorack, she shows up and is under that name.

  • Enter the complete code of your procedure that performs the printing, please.

  • http://stackoverflow.com/a/27979316/2221388 see if you can get help.

  • @Pablovargas did follow this tutorial. And I’ve also read this post.

  • You can send a test page through the printer settings in Device Manager?

  • @Sorack edited the question and put the code.

  • @Pablovargas for printer properties? If so, print normally. I believe the problem is even in this precedent, because sending the commands directly to the printer, without using dll, works perfectly.

  • 1

    Your printer calls it "WELL" anyway?

  • Kamila, in open port you should put the name of the printer as well as appears in the Device Manager.

  • @Sorack switched to Bematech. But even stating the name that is on the devices and printers or putting the port name, that is USB001 the error persists.

Show 7 more comments

1 answer

3


I managed to solve my problem with the help of Bematech Support. Follow the Solution:

First of all, the sample code provided on the Bematech website is for Delphi 7. My IDE is Delphi 10. I already started wrong rsrs. I didn’t really mean it. According to the analyst, "The problem is due to divergence in the structure of variables that have Alphabetic characters between version 7 and the later version of Delphi. It is mandatory to use Ansi variables in the calls of DLL functions that have to pass String or Char."

So I took with the application version support in Delphi 10 and it worked. DLL and driver are correct.

If anyone is interested in getting the source code this is the download link: https://www.dropbox.com/s/9ho7vuzo7y1g4rg/Novo%20Lb1000%20Employment%20Delphi%202010.rar? dl=0

To everyone who tried to help, thank you very much!

  • You could go up on github the source code https://github.com/

  • @Pablovargas thanks for the tip. I will go up and put the link in the reply.

  • I put the whole project, I think it’s better.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.