Sending Printjobs to network printers

Post Reply
bkromer
Member
Posts: 99
Joined: Thu Jul 11, 2019 10:41 am

Sending Printjobs to network printers

Post by bkromer »

Hey there,

I am currently testing the PDFPrinter APP we found at the Enfocus Appstore.
The goal is to send incoming files to network printers. Office and Label printers.

The Flow with the app looks like this:
Bildschirmfoto 2020-07-08 um 13.29.00.png
Bildschirmfoto 2020-07-08 um 13.29.00.png (154.02 KiB) Viewed 10378 times
For some printers it works very well for some not, Switch brings up an Error Message that some ScriptExecuter....exe crashed.

Is there any other solution for this use-case.
Benjamin
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Sending Printjobs to network printers

Post by jan_suhr »

I suggest that you contact the App-creator for support.
https://www.apagoinc.com/
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
bkromer
Member
Posts: 99
Joined: Thu Jul 11, 2019 10:41 am

Re: Sending Printjobs to network printers

Post by bkromer »

jan_suhr wrote: Wed Jul 08, 2020 1:39 pm I suggest that you contact the App-creator for support.
https://www.apagoinc.com/
I did thanks.
Benjamin
ThomasDeschamps
Member
Posts: 21
Joined: Wed Jul 20, 2016 12:03 pm

Re: Sending Printjobs to network printers

Post by ThomasDeschamps »

An easy alternative if you are operating on windows is a small batch file and Foxit Reader or similar PDF tool :

Code: Select all

setlocal enabledelayedexpansion
set mypath=C:\SCRUT\pdfa4
set myprinter=Brother_A4
echo "starting hotfolder scan in %mypath%"
:loop
for %%f in (%mypath%\*.pdf) do (
  echo printing %%f
  %mypath%\..\PGM\Foxit_Reader.exe /t "%%f" %myprinter%
  echo on printer %myprinter%
  move "%%f" "%mypath%\ARCHIVES"
  echo moving %%f in Archive

)
timeout /t 2
You need to create the folder "mypath" and use the windows name of your printer. the preset default printing option will be used.
if needed, you can put this batch file in the starting folder
w3gmbh
Newbie
Posts: 12
Joined: Mon Dec 16, 2013 4:14 pm

Re: Sending Printjobs to network printers

Post by w3gmbh »

Benjamin,

a nice and fast option for me was to use gsprint, a part of ghostview, extremely fast and configurable (just change your printer config).

see: http://www.ghostgum.com.au/software/gsview.htm

Switch Setup:
Application: C:/Program Files/Ghostgum/gsview/gsprint.exe
Parameters: -noquery -color -all -printer "MyWindowsPrinter" "%1"

Ralf.
bkromer
Member
Posts: 99
Joined: Thu Jul 11, 2019 10:41 am

Re: Sending Printjobs to network printers

Post by bkromer »

w3gmbh wrote: Tue Jul 21, 2020 12:24 pm ...

Switch Setup:
Application: C:/Program Files/Ghostgum/gsview/gsprint.exe
Parameters: -noquery -color -all -printer "MyWindowsPrinter" "%1"
...
Hey Ralf, can you describe that a little further.
Are you starting the gsprint.exe from within Switch?
ThomasDeschamps wrote: Thu Jul 09, 2020 9:40 am An easy alternative if you are operating on windows is a small batch file and Foxit Reader or similar PDF tool :
...
Thanks Thomas this is so cool. I dont know batch this well, but inspired by your script
I wrote myself a python2 script. It works like a hotfolder. PDF-Files need to have the printers name at the end like _BP730i.pdf
The only downside I see is that the scripts open´s the standard APP for PDF Files and sends it to the printer. After that, it closes the APP immediately.
So you won't run this script on your switch server as it would be very disturbing having pdf readers popping up all the time some printjob comes in. :/

Code: Select all

import win32api
import win32print
import os
import time
import shutil
import re
from datetime import datetime

now = datetime.now()
t = now.strftime("%d.%m.%Y, %H:%M:%S")

#all_printers = win32print.EnumPrinters(2)

pdf_dir = "Y:\\HOTFOLDER_DRUCK\\INPUT\\"
archiv = "Y:\\HOTFOLDER_DRUCK\\ARCHIV\\"

while True:
    time.sleep(1)
    files = os.listdir(pdf_dir)
    if files > 0:
        time.sleep(6) # WARTEN BIS SWITCH DEN PREFIX ENTFERNT HAT 
        files = os.listdir(pdf_dir) # ANSCHLIESSEND ORDNER NEU EINLESEN
        for f in files:
            pattern = re.compile('\_([a-zA-Z0-9]+)\.pdf')
            match = pattern.search(f)
            printer = match.group(1)
            defaultPrinter = win32print.GetDefaultPrinter()
            if defaultPrinter != printer:
                win32print.SetDefaultPrinter(printer)
            print t+" printing file "+ str(pdf_dir+f) +" on "+str(printer) #str(win32print.GetDefaultPrinter())
            time.sleep(1)
            win32api.ShellExecute(0, "print", os.path.join(pdf_dir,f), None,  ".",  0)
            time.sleep(6)
            shutil.copy(os.path.join(pdf_dir,f),os.path.join(archiv,f))
            os.remove(os.path.join(pdf_dir,f))
Benjamin
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Sending Printjobs to network printers

Post by jan_suhr »

What Ralf suggests uses the Execute Command element in Switch.

You'll see when you add it to the flow.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
bkromer
Member
Posts: 99
Joined: Thu Jul 11, 2019 10:41 am

Re: Sending Printjobs to network printers

Post by bkromer »

Great thx.
I also found a similar tool to ghostgum its called pdftoprinter http://www.columbia.edu/~em36/pdftoprinter.html.

Sending print jobs to a printer via cmd is easy, there is no pdfreader poping up now its completely silent.
But its also possible to define the amount of copies to print, the printer and the file as variables. But how can I build this in execute command?
My files are named like YB27_bkromer_copies_2_BP730i.pdf and the command should look like

Code: Select all

c://pdftoprinter.exe c://hotfolder/input/YB27_bkromer_copies_2_BP730i.pdf  "BP730i" copies=2
So I need the variable [Job.Name:After="copies_",Before="_"] for the amount of copies, the [Job.Name:After="_",Before=".pdf"] for the printer name and the [Job.Name] for the pdf file to print.
Is there a way to make this work?
Bildschirmfoto 2020-07-22 um 10.24.33.png
Bildschirmfoto 2020-07-22 um 10.24.33.png (66.38 KiB) Viewed 10228 times
If this works, this would be the perfect solution.
Benjamin
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Sending Printjobs to network printers

Post by jan_suhr »

You could probably do it with a .BAT or Shellscript file. Use the App Execute Command Friend to create such a file and then let Execute Command run it. With that app you could build up your command with Switch variables.

https://www.enfocus.com/en/appstore/pro ... and-friend
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
w3gmbh
Newbie
Posts: 12
Joined: Mon Dec 16, 2013 4:14 pm

Re: Sending Printjobs to network printers

Post by w3gmbh »

when using gsprint (blazing fast, no size mismatches) you can use all those switches (including copies):

http://www.ccp14.ac.uk/ccp/web-mirrors/ ... sprint.htm

Simple implementation screenshot:
gsprint.PNG
gsprint.PNG (11.85 KiB) Viewed 10221 times
Cheers,

Ralf
Post Reply