Printer

  • 17 Mar

    How to check the printer status before sending a pdf to the printer update

    How to check the printer status before sending a pdf to the printer

    Previous article: link

    We added a new Pascal Script function in version v2024.3.17.0

    Function psGetUrlContent(Const aUrl, aParams: String; var aError: String): String;

    Please check the previous article, we only changed the following part:

    • First Destination: Pascal Script
      • Please add the following script: link
      • We added the following Const values which you’ll need to adjust:
        • ctCheckPrinterConnection: This will add the possibility to check the printer using the URL of the printer (web page). A lot of network printers have an internal web server that we’ll be using to check if the printer is online.
          • Set this value to ‘TRUE’ if you want to use this option, otherwise set this Const to ‘FALSE’.
        • cpPrinterUrl: If ‘ctCheckPrinterConnection := True;’ then add the Url (web interface) of the Printer we need to check.
        • ..

    We added this update because the customer had a printer where, by default, only its web interface was enabled. In the previous article we used a telnet connection which seems to be disabled with some printer due to security reasons.

    check the printer status update

    If you need any help with this ‘check the printer status’ request, please let us know.

    Best Regards,

    Limagito Team

    #pdf #managedfiletransfer #filetransfer #filemanagement

  • 24 Feb

    How to check the printer status before sending a pdf to the printer

    How to check the printer status before sending a pdf to the printer

    Q: We are rolling out a process at one of our customers which requires printing a PDF to a printer. With our tooling, we are not getting confirmation if this printout succeeded/ failed. Can we use Limagito to read a folder, send the PDF to the fixed printer and then return something to our bot? That may be something like a separate file, with the details of the job.

    A: We added some extra options in version v2024.2.24.0 to achieve this. The following blog article is just an example, other possibilities are available. Just let us know if you need any help.

    We added an update of this blog article here

    • We used a Windows Folder as Source:

    limagito file mover windows folder as source

    • Filename include filter is set to *.pdf because we only want to handle pdf files:

    limagito file mover filename include filter

    • We enabled ‘File Memory’ because we only want to print the same pdf file once:

    limagito file mover file memory option

    • The Function is set to ‘Copy’ because we want to leave the original pdf at the source (this is not a must, also ‘Move’ is possible):
      • Destination Options is set to ‘Exit Cyclus on Error’.
        • This ‘Exit Cyclus on Error’ will skip the next Destination in case of error.

    limagito file mover function setup check the printer status

    • We added two destinations:
      • First destination is our ‘Pascal Script’ option: This script will check the printer status and if the status is not OK then it will not print the pdf. The error status can be used to trigger an email event.
      • Second destination  is our ‘PDF’ option: This destination will print the pdf file.

    limagito filemover destination check the printer status

    • First Destination: Pascal Script
      • Please add the following script: link
      • We added the following Const values which you’ll need to adjust:
        • ctCheckPrinterConnection: This will add the possibility to check the printer using its IP (or Hostname) + Port.
          • Set this value to ‘TRUE’ if you want to use this option, otherwise set this Const to ‘FALSE’.
        • cpPrinterIP: If ‘ctCheckPrinterConnection := True;’ then add the IP (or Hostname) of the Printer we need to check.
        • ctPrinterPort: If ‘ctCheckPrinterConnection := True;’ then add the Port of the Printer we need to check. We used port 23 which is the default Telnet port. Most printers are able to received commands directly on that port.
        • ctPrinterError: In case the status of the printer (received from the Windows Spooler) contains 2 then we’ll handle this as Error.
        • ctOutputPathError: In case of Error we’ll write a txt file in this path (must end with a \ ). The text file has the name of the source file but with ‘.txt’ as extension.
          • The content of this text file contains the source filename + the error received.
          • This can be adjusted, please let us know if needed.
      • Don’t forget to adjust the Printer name needed to check that status from the Windows Spooler

    limagito file mover check the printer status

    • Second Destination: PDF
      • Click ‘Add’
      • Adjust Description
      • Check ‘Enabled’
      • Select ‘Print PDF File’
      • Switch to ‘Print’ Tab

    limagito file mover pdf as destination

      • Disable ‘Use Default Printer’
      • Select the printer you need from the combobox ‘Available Devices’
      • Click the + button

    limagito file mover pdf as destination

    • RunTime Log Result:

    We detected that the printer connection was available but the Windows spooler returned an error status. This is why we didn’t print the pdf and returned an error which can be used to send the ‘On Error’ email event. In this event you can use the parameter %VSE which contains the status information from the printer.

    limagito file mover check the printer status runtime log

    • Error Event Setup
      • Please open our ‘Rule Events’ option:

    limagito file rule events option

      • Select and enable the ‘On Error’ event
        1. Check ‘Enable Mail’
        2. > SMTP Setup
        3. > Message Setup
        4. When done, this setup can be tested using our ‘Test’ button

    limagito file mover on error event

      • Message Setup:
        • Always use a valid ‘From’ email address because some SMTP servers will reject the message without returning an error.
        • We used our parameter %VSE in the body because it contains the error information from the printer.

    limagito file mover on error event

    If you need any help with this ‘check the printer status’ request, please let us know.

    Best Regards,

    Limagito Team

    #pdf #managedfiletransfer #filetransfer #filemanagement

  • 11 Aug

    How to send zpl file to Zebra printer using Limagito file mover

    Q: How to send zpl file to Zebra printer. Do you have a solution in Limagito to send Zpl files to a printer? Zpl is a standard language for label printers.
    A: On request we added an option in Limagito File Mover v2023.8.10.0. The customer did some successful tests. These new options should be able to send other Zpl like type of files (EPL,..) to printers too.

    • In our example we used a Windows folder as Source, searching for zpl files:

    limagito file mover windows folder as source

    • We enabled ‘Exclude Files In Use’ because we don’t want to touch source .zpl file that are still being created:

    limagito file mover exclude files in use

    • Please set the Filename Include filter to *.zpl because we only need this type of files:

    limagito file mover filename include filter

    • Our Rule will be triggered every 30 seconds using a scan timer (Schedule Setup button):

    limagito file mover scan timer setup

    • As function we used ‘Move’ because after a successful print we want to delete the source .zpl file:

    limagito file mover function setup

    • As Destination we are going to use a Script:

    limagito file mover as Destination

    Var
      iList: Integer;
      tmpInfo, tmpFile, tmpString: String;
      tmpList: TStringList;
    Begin
      psExitCode:= 0;
      // ... add your code here
      tmpFile := psFilePath + psFileName;
      // Do Send
      tmpList := TStringList.Create;
      Try
        tmpList.CommaText := psGetPrinters;
        If tmpList.Count > 1 Then
        Begin
          For iList := 0 To (tmpList.count-1) Do 
            psLogWrite(1, '', 'Installed printer [' + IntToStr(iList+1) + ']: ' + tmpList.Strings[iList]);
          psLogWrite(1, '', 'Default printer: ' + psGetDefaultPrinter);
        End
        Else
          psLogWrite(1, '', 'No printer installed');        
        psLogWrite(1, '', 'Send file "' + tmpFile + '" to printer');
        Try
          tmpList.Clear;
          tmpList.LoadFromFile(tmpFile);
          If tmpList.Count > 0 Then
          Begin
            tmpString := tmpList.Text;
            // Method 1
            tmpInfo := psPrintRawString(tmpString, '');
            // Method 2
            // tmpInfo := psPrintRawList(tmpList, '');
            // Debug
            If tmpInfo <> '' Then
            Begin
              psLogWrite(1, '', 'Sent to printer error: ' + tmpInfo);
            End Else
            Begin
              psExitCode := 1;  
              psLogWrite(1, '', 'Sent to printer successfully: ' + tmpFile);
            End;
          End
          Else
          psLogWrite(1, '', 'Found empty file: ' + tmpFile);
        Except
          psLogWrite(1, '', 'LoadFromFileError: ' + tmpFile);
        End;
      Finally
        tmpList.Free;
      End;
    End.
    

    The script above will load the content of the .zpl (or other raw type of files) and will send this data to a selected printer.

            // Method 1
            tmpInfo := psPrintRawString(tmpString, ”);

    By default we’ll use the ‘Default’ printer in Windows which means the Zebra printer should be set as Default printer. If you want to use a Zebra printer that is not set to default in Windows you’ll need to add the printer name to the function.

    Suppose the installed Zebra printer name is: My Zebra Printer

            // Method 1
            tmpInfo := psPrintRawString(tmpString, ‘My Zebra Printer’);

    To help you with the printer names, the script will wrote the names in the RunTime log if you trigger the Rule (please check the output of the RunTime log in the screenshot below).

    limagito file mover send zpl file to Zebra printer

    • RunTime Log result:

    limagito runtime log

    If you need any info about this new ‘zpl file to Zebra printer’ option, please let us know.

    #zpl #zebra #filetransfer #filemanagement

    Best regards,

    Limagito Team

    By Limagito-Team Pascal Script Printer , , ,
SEARCH