commit message

This commit is contained in:
Simon Zeyer 2024-01-08 16:06:47 +00:00
commit 161e76bb5a
16 changed files with 2429 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
*.html
.venv
.devcontainer
.vscode
*.image
__pycache__
.env

64
Dockerfile Normal file
View File

@ -0,0 +1,64 @@
FROM python:3.10-bullseye
ENV username=
ENV password=
ENV server="exchange.sankt-wendel.de"
ENV primary_smtp_address=
ENV filter_from="leitstelle@zrf-saar.de"
ENV webhooks=""
ENV alarminator_api=""
ENV alarminator_token=""
ENV alarmfax_parser_id=""
ENV alarminator_zvies_use_PEALGRP="False"
ENV print_num=0
ENV printer="DEFAULT"
ENV REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
COPY *.deb /
RUN apt-get --yes --force-yes update
RUN dpkg -i *.deb || exit 0
RUN apt-get --yes install -f
RUN apt-get --yes --force-yes install ca-certificates cups cups-filters libcups2-dev \
sudo \
whois \
usbutils \
cups \
cups-client \
cups-bsd \
cups-filters \
foomatic-db-compressed-ppds \
printer-driver-all \
openprinting-ppds \
hpijs-ppds \
hp-ppd \
hplip \
smbclient \
printer-driver-cups-pdf \
# cndrvcups-common \
# cndrvcups-ufr2-uk \
#&& dpkg -i /*.deb || exit 0 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /*.deb
WORKDIR /usr/src/app
EXPOSE 631
# Add user and disable sudo password checking
RUN useradd \
--groups=sudo,lp,lpadmin \
--create-home \
--home-dir=/home/print \
--shell=/bin/bash \
--password=$(mkpasswd print) \
print \
&& sed -i '/%sudo[[:space:]]/ s/ALL[[:space:]]*$/NOPASSWD:ALL/' /etc/sudoers
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY ./app .
COPY *.crt /usr/local/share/ca-certificates/
RUN update-ca-certificates
CMD [ "sh","-c","/etc/init.d/cups start && python3 /usr/src/app/exchange_connect.py" ]

View File

@ -0,0 +1,35 @@
-----BEGIN CERTIFIC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b78yvBXAfCNP6CH
MntHWpdLgtJmwsQt6j8k9Kf5qLnjatkYYaA7jBU=
-----END CERTIFICATE-----

123
app/exchange_connect.py Normal file
View File

@ -0,0 +1,123 @@
from threading import Thread
from exchangelib import Credentials, Configuration, Account, DELEGATE, FaultTolerance, Folder, Message, ExtendedProperty
import exchangelib.errors
import logging, time, os
from securecad_parser import parse_securecad_message
import os
import datetime
from hooks import webhook, alarminator_api, cups_print
class alarmfax_parser_verarbeitet(ExtendedProperty):
property_set_id = "64901230-f5f2-4b07-a032-58fb3970a09e"
property_name = "vom Alarmfax Parser verarbeitet"
property_type = "Boolean"
class alarmfax_parser_id(ExtendedProperty):
property_set_id = "0c595b56-c79d-4ecb-9e9b-c94fcef86816"
property_name = "ID des Alarmfax Parser"
property_type = "String"
Message.register("alarmfax_parser_verarbeitet", alarmfax_parser_verarbeitet)
Message.register("alarmfax_parser_id", alarmfax_parser_id)
#print([f.name for f in Message.FIELDS if f.is_searchable])
threads = {}
format = "%(asctime)s|%(threadName)s: %(message)s"
logging.basicConfig(format=format, level=logging.INFO,
datefmt="%Y-%m-%d %H:%M:%S")
def eventHandler(ELEMENT_NAME, item_id, item_changekey):
if (ELEMENT_NAME == 'ModifiedEvent' and IS_DEV) or ELEMENT_NAME == 'NewMailEvent' or ELEMENT_NAME == 'SearchFolderEvent':
logging.info(ELEMENT_NAME + " - get Mail")
m: Message = a.inbox.get(id=item_id, changekey=item_changekey)
if m.alarmfax_parser_verarbeitet and parser_id in m.alarmfax_parser_id:
logging.info("Mail {} bereits verarbeitet.. ignoriere".format(m.id))
if not IS_DEV:
return
else:
m.alarmfax_parser_verarbeitet = True
m.alarmfax_parser_id = m.alarmfax_parser_id + parser_id
m.save(update_fields=["alarmfax_parser_verarbeitet","alarmfax_parser_id"])
logging.info("got Mail {} von {}".format(m.subject, m.sender.email_address))
if m.sender.email_address in filter_from:
parsed_body = parse_securecad_message(m.body)
logging.debug(parsed_body)
if parsed_body != None:
if 'ALARMDEPESCHE' in parsed_body:
logging.info("Alarm für: {}".format(parsed_body['ALARMDEPESCHE']))
webhook(parsed_body)
alarminator_api(parsed_body)
cups_print(parsed_body,m.body)
pass
def folder_event_subscriber(folder: Folder):
logging.info('folder_event_subscriber startet for Folder: {}'.format(folder.name))
while True:
# filtern des ordners nach mails der letzten 24h, die nicht verarbeitet wurden
now = datetime.datetime.now(a.default_timezone)
folder.all()
folder.all()
filtered_items = folder.filter(
datetime_received__range=(now - datetime.timedelta(days=1), now + datetime.timedelta(days=1))
).exclude(
alarmfax_parser_verarbeitet=True,
alarmfax_parser_id__contains=parser_id
)
cnt = filtered_items.count()
if cnt > 0:
logging.info("{} Mails nicht verarbeitet in den letzten 2 Tagen in ordner: {}".format(cnt, folder.name))
filtered_items = filtered_items.values("id", "changekey")
for m in filtered_items:
t = Thread(target=eventHandler, args=('SearchFolderEvent',m["id"],m["changekey"],),name="eventHandler: SearchFolderEvent ({})".format(m["id"]))
t.start()
# aktives warten auf streaming_events. maximal eine minute lang, dann wird nochmal der ordner durchsucht, falls mails angekommen sind während eines timeout/cooldown.
subscription_id = folder.subscribe_to_streaming()
for notification in folder.get_streaming_events(subscription_id, connection_timeout=1):
for event in notification.events:
if event.item_id != None:
t = Thread(target=eventHandler, args=(event.ELEMENT_NAME,event.item_id.id,event.item_id.changekey,),name="eventHandler: {} ({})".format(event.ELEMENT_NAME, event.item_id.id))
t.start()
if __name__ == "__main__":
try:
username = os.environ.get('username')
password = os.environ.get('password')
server = os.environ.get('server')
folders = os.environ.get('folders',"")
parser_id = os.environ.get('alarmfax_parser_id',"")
primary_smtp_address = os.environ.get('primary_smtp_address')
filter_from = os.environ.get('filter_from').split(";") if os.environ.get('filter_from') else []
IS_DEV = True if os.environ.get('IS_DEV') and os.environ.get('IS_DEV') == "True" else False
if IS_DEV:
logging.getLogger().setLevel(logging.DEBUG)
credentials = Credentials(username=username, password=password)
config = Configuration(server=server, credentials=credentials,retry_policy=FaultTolerance(max_wait=5), max_connections=10)
a = Account(primary_smtp_address=primary_smtp_address, config=config, autodiscover=False, access_type=DELEGATE)
folders_to_subscribe = []
for f in folders.split(";"):
if f == "":
folders_to_subscribe.append(a.inbox)
else:
folders_to_subscribe.append(a.inbox / f)
while True:
for f in folders_to_subscribe:
if not f.name in threads or not threads[f.name].is_alive():
logging.info("folder_event_subscriber for folder \"{}\" not alive, starting".format(f.name))
t = Thread(target=folder_event_subscriber, args=(f,), daemon=True, name="folder_event_subscriber {}".format(f.name))
threads[f.name] = t
t.start()
time.sleep(1)
except exchangelib.errors.RateLimitError as e:
logging.error('',exc_info=e)
if e.status_code == 401:
webhook({"ERROR":{
"status_code": e.status_code,
"url": e.url
}})
time.sleep(60*60*12)
else:
logging.info("rate limit!!!! sleep 60s")
time.sleep(60)

110
app/hooks.py Normal file
View File

@ -0,0 +1,110 @@
import os
import logging
import requests
import cups
from weasyprint import HTML
from requests.adapters import Retry
import uuid
retries = Retry(total=5,
backoff_factor=0.1,
status_forcelist=[ 500, 502, 503, 504 ])
def webhook(parsed_body: dict):
try:
webhooks = os.environ.get('webhooks').split(";") if os.environ.get('webhooks') else []
for webhook in webhooks:
logging.info("POST zu {}".format(webhook))
s = requests.Session()
s.mount('https://', requests.adapters.HTTPAdapter(max_retries=retries))
s.post(webhook,json=parsed_body)
except Exception as e:
logging.error("alarminator_api", e)
def alarminator_api(parsed_body: dict):
try:
alarminator_api = os.environ.get('alarminator_api') if os.environ.get('alarminator_api') else ""
alarminator_token = os.environ.get('alarminator_token') if os.environ.get('alarminator_token') else ""
alarminator_zvies_use_PEALGRP = True if os.environ.get('alarminator_zvies_use_PEALGRP') == 'True' else False
if alarminator_api != "" and alarminator_token != "":
if 'ALARMDEPESCHE' in parsed_body: # sendAlarm triggern
logging.info("GET zu {}/operations/sendAlarm".format(alarminator_api))
s = requests.Session()
s.mount('https://', requests.adapters.HTTPAdapter(max_retries=retries))
#&object=Kirmesplatz &district=Oberlinxweilerstrasse &subject=THK (TH klein &street=Oberlinxweilerstrasse &ils=\"secur.CAD\" <leitstelle@zrf-saar.de>&connector=mailParser&token=ea2110e1-11b9-421f-a53d-96cc0fc82c31
req_string = ""
req_string +="?token={}".format(alarminator_token)
if 'Einsatzbeginn(Soll)' in parsed_body:
req_string +="&alarmdate={}".format(parsed_body['Einsatzbeginn(Soll)'].split(" ")[0])
req_string +="&alarmtime={}".format(parsed_body['Einsatzbeginn(Soll)'].split(" ")[1])
if 'Auftragsnummer' in parsed_body:
req_string +="&operationnumber={}".format(parsed_body['Auftragsnummer'])
if 'Sachverhalt' in parsed_body:
req_string +="&message={}".format(parsed_body['Sachverhalt'])
if 'Einsatzziel' in parsed_body:
if 'Stadt' in parsed_body['Einsatzziel']:
req_string +="&community={}".format(parsed_body['Einsatzziel']['Stadt'])
if 'PLZ / Ort' in parsed_body['Einsatzziel']:
req_string +="&location={}".format(parsed_body['Einsatzziel']['PLZ / Ort'])
if 'Objekt' in parsed_body['Einsatzziel']:
req_string +="&object={}".format(parsed_body['Einsatzziel']['Objekt'])
if 'Strasse' in parsed_body['Einsatzziel']:
req_string +="&street={}".format(parsed_body['Einsatzziel']['Strasse']) + (("\n"+parsed_body['Einsatzziel']['Info ']) if 'Info ' in parsed_body['Einsatzziel'] else "" )
if 'Strasse / Hs.-Nr.' in parsed_body['Einsatzziel']:
req_string +="&street={}".format(parsed_body['Einsatzziel']['Strasse / Hs.-Nr.'] + (("\n"+parsed_body['Einsatzziel']['Info ']) if 'Info ' in parsed_body['Einsatzziel'] else "" ))
if 'Einsatzmittelliste' in parsed_body:
gear = []
for r in parsed_body['Einsatzmittelliste']:
if r['Typ'] != 'PEALGRP':
gear.append(r['Ressourcen'])
req_string +="&gear={}".format(';'.join(gear))
#req_string +="&district={}".format('district')
#req_string +="&floor={}".format('floor')
#req_string +="&section={}".format('section')
req_string +="&keywordRaw={}".format(parsed_body['Einsatzstichwort'])
#req_string +="&keywordId={}".format('keywordId')
req_string +="&keywordCategory={}".format(parsed_body['Einsatzstichwort'].split("(")[0])
req_string +="&keywordName={}".format(parsed_body['Einsatzstichwort'].split("(")[1].split(")")[0])
if alarminator_zvies_use_PEALGRP:
if 'Einsatzmittelliste' in parsed_body:
zveis = []
for r in parsed_body['Einsatzmittelliste']:
if r['Typ'] == 'PEALGRP':
zveis.append(r['Ressourcen'])
req_string +="&zveis={}".format(';'.join(zveis))
else:
req_string +="&zveis={}".format(parsed_body['ALARMDEPESCHE'])
# req_string +="&gkx={}".format() if False
# req_string +="&gky={}".format() if False
# req_string +="&lat={}".format() if False
# req_string +="&lon={}".format() if False
subject = ""
if 'Notfallgeschehen' in parsed_body:
subject = parsed_body['Notfallgeschehen'] + "\n"
if 'Notfallgeschehen' in parsed_body:
subject = parsed_body['Notfallgeschehen'] + "\n"
req_string +="&subject={}".format(subject)
req_string +="&ils={}".format("ILS Saar")
req_string +="&connector={}".format("MailParser")
s.get(alarminator_api+"/operations/sendAlarm/"+req_string)
except Exception as e:
logging.error("alarminator_api", e)
def cups_print(parsed_body: dict, body: str):
fname = "/tmp/{}.pdf".format(uuid.uuid4())
try:
conn = cups.Connection ()
printer = os.environ.get('printer',"DEFAULT")
print_num = int(os.environ.get('print_num',0))
if 'ALARMDEPESCHE' in parsed_body:
with open(fname,"wb") as f:
f.write(HTML(string=body, base_url="").write_pdf())
for i in range(0, print_num):
conn.printFile (printer, fname, "Alarmfax", {})
os.remove(fname)
except Exception as e:
if os.path.exists(fname):
os.remove(fname)
logging.error("cups_print", e)

95
app/securecad_parser.py Normal file
View File

@ -0,0 +1,95 @@
from glob import glob
import pandas as pd
from numpy import nan
tt_list_alarmdepesche = []
tt_list_infodepesche = []
tt_list_einsatzprotokoll = []
def parse_securecad_message(body_html: str):
body_html = body_html.replace(u'\xa0', u' ')
if 'ALARMDEPESCHE' in body_html:
t_list = {}
tables = pd.read_html(body_html) # Returns list of all tables on page
t_count = 0
for t in tables:
t_count = t_count + 1
table_dict = t.to_dict('index')
if t_count == 1 and 'ALARMDEPESCHE' in table_dict[0][0]:
k:str
v:str
k,v = table_dict[0][0].split('>>')
t_list[k.strip()] = v.strip()
elif t_count == 2:
continue
elif t_count == 3:
for r in table_dict:
if table_dict[r][0] is not nan:
t_list[table_dict[r][0].strip(' :')] = table_dict[r][1]
elif t_count > 3 and table_dict[0] is not nan and table_dict[0][0] == 'Einsatzziel' and 'Einsatzziel' not in t_list:
t_list['Einsatzziel'] = {}
for r in table_dict:
if table_dict[r][0] is not nan and table_dict[r][0] != 'Einsatzziel':
t_list['Einsatzziel'][table_dict[r][0].strip(' :')] = table_dict[r][1]
elif t_count > 3 and table_dict[0] is not nan and table_dict[0][0] == 'Einsatzziel' and 'Einsatzziel' in t_list:
continue
elif t_count > 3 and table_dict[0] is not nan and table_dict[0][0] == 'Zusatztext zum Ort' and 'Zusatztext zum Ort' not in t_list:
t_list['Zusatztext zum Ort'] = []
for r in table_dict:
if table_dict[r][0] is not nan and table_dict[r][0] != 'Zusatztext zum Ort':
t_list['Zusatztext zum Ort'].append(table_dict[r][1])
elif t_count > 3 and table_dict[0] is not nan and table_dict[0][0] == 'Zusatztext zum Ort' and 'Zusatztext zum Ort' in t_list:
continue
elif t_count > 3 and table_dict[0] is not nan and table_dict[0][0] == 'Zusatztext zum Objekt' and 'Zusatztext zum Objekt' not in t_list:
t_list['Zusatztext zum Objekt'] = []
for r in table_dict:
if table_dict[r][0] is not nan and table_dict[r][0] != 'Zusatztext zum Objekt':
t_list['Zusatztext zum Objekt'].append(table_dict[r][1])
elif t_count > 3 and table_dict[0] is not nan and table_dict[0][0] == 'Zusatztext zum Objekt' and 'Zusatztext zum Objekt' in t_list:
continue
elif t_count > 3 and table_dict[0] is not nan and table_dict[0][0] == 'Einsatzmittelliste':
# es folgt die Einsatzmittelliste
continue
elif t_count > 3 and table_dict[0] is not nan and table_dict[0][0] == 'Ressourcen'and table_dict[0][1] == 'Typ' and table_dict[0][2] == 'Organisation':
t_list['Einsatzmittelliste'] = []
for r in table_dict:
if table_dict[r][0] != "Ressourcen":
t_list['Einsatzmittelliste'].append({
'Ressourcen': table_dict[r][0] if table_dict[r][0] is not nan else "",
'Typ': table_dict[r][1] if table_dict[r][1] is not nan else "",
'Organisation': table_dict[r][2] if table_dict[r][2] is not nan else "",
'Status': table_dict[r][3] if table_dict[r][3] is not nan else "",
'Alarm': table_dict[r][4] if table_dict[r][4] is not nan else "",
'aus': table_dict[r][5] if table_dict[r][5] is not nan else "",
'an': table_dict[r][6] if table_dict[r][6] is not nan else "",
'Auftrag': table_dict[r][7] if table_dict[r][7] is not nan else "",
})
else:
#print(table_dict)
pass
#print(t_list)
#tt_list_alarmdepesche.append(t_list)
# bereinigung
if 'Zusatztext zum Objekt' in t_list:
if t_list['Zusatztext zum Objekt'].__len__() == 1 and t_list['Zusatztext zum Objekt'][0].strip() == ".":
del t_list['Zusatztext zum Objekt']
else:
t_list['Zusatztext zum Objekt'] = "\n".join(t_list['Zusatztext zum Objekt'])
if 'Zusatztext zum Ort' in t_list:
if t_list['Zusatztext zum Ort'].__len__() == 1 and t_list['Zusatztext zum Ort'][0].strip() == ".":
del t_list['Zusatztext zum Ort']
else:
t_list['Zusatztext zum Ort'] = "\n".join(t_list['Zusatztext zum Ort'])
t_list["__HTML_BODY"] = body_html
return t_list
else:
pass
pass
if __name__ == "__main__":
for i in glob('*.html'):
with open(i,'r') as f:
parse_securecad_message(f.read())
pass

Binary file not shown.

0
cups/cupsd.conf Normal file
View File

1162
cups/ppd/DEFAULT.ppd Normal file

File diff suppressed because it is too large Load Diff

496
cups/ppd/DEFAULT.ppd.O Normal file
View File

@ -0,0 +1,496 @@
*PPD-Adobe: "4.3"
*%
*% For information on using this, and to obtain the required backend
*% script, consult http://www.openprinting.org/
*%
*% This file is published under the GNU General Public License
*%
*% PPD-O-MATIC (4.0.0 or newer) generated this PPD file. It is for use with
*% all programs and environments which use PPD files for dealing with
*% printer capability information. The printer must be configured with the
*% "foomatic-rip" backend filter script of Foomatic 4.0.0 or newer. This
*% file and "foomatic-rip" work together to support PPD-controlled printer
*% driver option access with all supported printer drivers and printing
*% spoolers.
*%
*% To save this file on your disk, wait until the download has completed
*% (the animation of the browser logo must stop) and then use the
*% "Save as..." command in the "File" menu of your browser or in the
*% pop-up manu when you click on this document with the right mouse button.
*% DO NOT cut and paste this file into an editor with your mouse. This can
*% introduce additional line breaks which lead to unexpected results.
*%
*% You may save this file as 'Generic-PCL_6_PCL_XL_Printer-hpijs-pcl5c.ppd'
*%
*%
*FormatVersion: "4.3"
*FileVersion: "1.1"
*LanguageVersion: English
*LanguageEncoding: ISOLatin1
*PCFileName: "HPIJS-PC.PPD"
*Manufacturer: "Generic"
*Product: "(PCL 6/PCL XL Printer)"
*cupsVersion: 1.0
*cupsManualCopies: True
*cupsModelNumber: 2
*cupsFilter: "application/vnd.cups-postscript 100 foomatic-rip"
*cupsFilter: "application/vnd.cups-pdf 0 foomatic-rip"
*%pprRIP: foomatic-rip other
*ModelName: "Generic PCL 6/PCL XL Printer"
*ShortNickName: "Gen. PCL 6/PCL XL P. hpi.-pcl5c"
*NickName: "Generic PCL 6/PCL XL Printer Foomatic/hpijs-pcl5c"
*PSVersion: "(3010.000) 550"
*PSVersion: "(3010.000) 651"
*PSVersion: "(3010.000) 652"
*PSVersion: "(3010.000) 653"
*PSVersion: "(3010.000) 704"
*PSVersion: "(3010.000) 705"
*PSVersion: "(3010.000) 800"
*PSVersion: "(3010.000) 815"
*PSVersion: "(3010.000) 850"
*PSVersion: "(3010.000) 860"
*PSVersion: "(3010.000) 861"
*PSVersion: "(3010.000) 862"
*PSVersion: "(3010.000) 863"
*PSVersion: "(3010.000) 864"
*PSVersion: "(3010.000) 870"
*LanguageLevel: "3"
*ColorDevice: True
*DefaultColorSpace: RGB
*FileSystem: False
*Throughput: "1"
*LandscapeOrientation: Plus90
*TTRasterizer: Type42
*1284DeviceID: "DRV:Dhpijs-pcl5c,R0,M0,Sv,TI,X600,Y600,C1,t100,l100,g100,p100,s70;"
*driverName hpijs-pcl5c: "HP's HPIJS driver - PPDs for compatible PCL-5c-based non-HP color laser printers"
*driverType I/IJS: ""
*driverUrl: "http://hplipopensource.com/"
*driverObsolete: False
*driverSupplier: "Hewlett-Packard"
*driverManufacturerSupplied: False
*driverLicense: "BSD"
*driverSupportContactVoluntary: "https://launchpad.net/hplip HPLIP support and bug tracking system"
*driverMaxResolution: 600 600
*driverColor: True
*driverTextSupport: 100
*driverLineartSupport: 100
*driverGraphicsSupport: 100
*driverPhotoSupport: 100
*driverRenderingSpeed: 70
*DefaultResolution: 600dpi
*HWMargins: 18 14.40 18 14.4
*VariablePaperSize: True
*MaxMediaWidth: 100000
*MaxMediaHeight: 100000
*NonUIOrderDependency: 105 AnySetup *CustomPageSize
*CustomPageSize True: "pop pop pop pop pop
%% FoomaticRIPOptionSetting: PageSize=Custom"
*End
*FoomaticRIPOptionSetting PageSize=Custom: " -dDEVICEWIDTHPOINTS=0 -dD&&
EVICEHEIGHTPOINTS=0"
*End
*ParamCustomPageSize Width: 1 points 36 100000
*ParamCustomPageSize Height: 2 points 36 100000
*ParamCustomPageSize Orientation: 3 int 0 0
*ParamCustomPageSize WidthOffset: 4 points 0 0
*ParamCustomPageSize HeightOffset: 5 points 0 0
*FoomaticIDs: Generic-PCL_6_PCL_XL_Printer hpijs-pcl5c
*FoomaticRIPCommandLine: "gs -q -dBATCH -dPARANOIDSAFER -dQUIET -dNOPA&&
USE -dNOMEDIAATTRS -dNOINTERPOLATE -sDEVICE=ijs -sIjsServer=hpijs -sDe&&
viceManufacturer=&quot;HEWLETT-PACKARD&quot; -sDeviceModel=&quot;hp co&&
lor LaserJet&quot;%A%B%C -dIjsUseOutputFD%Z -sOutputFile=- -"
*End
*OpenGroup: General/General
*OpenUI *PrintoutMode/Print Quality: PickOne
*FoomaticRIPOption PrintoutMode: enum Composite B
*OrderDependency: 10 AnySetup *PrintoutMode
*DefaultPrintoutMode: Normal
*PrintoutMode Draft/Draft: "%% FoomaticRIPOptionSetting: PrintoutMode=Draft"
*FoomaticRIPOptionSetting PrintoutMode=Draft: "Quality=150DraftColorCM&&
YK"
*End
*PrintoutMode Draft.Gray/Draft Grayscale: "%% FoomaticRIPOptionSetting: PrintoutMode=Draft.Gray"
*FoomaticRIPOptionSetting PrintoutMode=Draft.Gray: "Quality=150DraftGr&&
ayscaleCMYK"
*End
*PrintoutMode Normal/Normal: "%% FoomaticRIPOptionSetting: PrintoutMode=Normal"
*FoomaticRIPOptionSetting PrintoutMode=Normal: "Quality=300ColorCMYK"
*PrintoutMode Normal.Gray/Normal Grayscale: "%% FoomaticRIPOptionSetting: PrintoutMode=Normal.Gray"
*FoomaticRIPOptionSetting PrintoutMode=Normal.Gray: "Quality=300Graysc&&
aleCMYK"
*End
*PrintoutMode High/High Quality: "%% FoomaticRIPOptionSetting: PrintoutMode=High"
*FoomaticRIPOptionSetting PrintoutMode=High: "Quality=600BestColorCMYK&&
"
*End
*PrintoutMode High.Gray/High Quality Grayscale: "%% FoomaticRIPOptionSetting: PrintoutMode=High.Gray"
*FoomaticRIPOptionSetting PrintoutMode=High.Gray: "Quality=600Grayscal&&
eCMYK"
*End
*CloseUI: *PrintoutMode
*OpenUI *InputSlot/Media Source: PickOne
*FoomaticRIPOption InputSlot: enum CmdLine C
*OrderDependency: 100 AnySetup *InputSlot
*DefaultInputSlot: Default
*InputSlot Default/Printer Default: "%% FoomaticRIPOptionSetting: InputSlot=Default"
*FoomaticRIPOptionSetting InputSlot=Default: ",PS:MediaPosition=7"
*InputSlot Upper/Upper Tray: "%% FoomaticRIPOptionSetting: InputSlot=Upper"
*FoomaticRIPOptionSetting InputSlot=Upper: ",PS:MediaPosition=1"
*InputSlot Lower/Lower Tray: "%% FoomaticRIPOptionSetting: InputSlot=Lower"
*FoomaticRIPOptionSetting InputSlot=Lower: ",PS:MediaPosition=4"
*InputSlot Envelope/Envelope Feeder: "%% FoomaticRIPOptionSetting: InputSlot=Envelope"
*FoomaticRIPOptionSetting InputSlot=Envelope: ",PS:MediaPosition=3"
*InputSlot LargeCapacity/Large Capacity Tray: "%% FoomaticRIPOptionSetting: InputSlot=LargeCapacity"
*FoomaticRIPOptionSetting InputSlot=LargeCapacity: ",PS:MediaPosition=&&
5"
*End
*InputSlot Manual/Manual Feeder: "%% FoomaticRIPOptionSetting: InputSlot=Manual"
*FoomaticRIPOptionSetting InputSlot=Manual: ",PS:MediaPosition=2"
*InputSlot MPTray/Multipurpose Tray: "%% FoomaticRIPOptionSetting: InputSlot=MPTray"
*FoomaticRIPOptionSetting InputSlot=MPTray: ",PS:MediaPosition=8"
*CloseUI: *InputSlot
*OpenUI *Duplex/Double-Sided Printing: PickOne
*FoomaticRIPOption Duplex: enum Composite A
*OrderDependency: 100 AnySetup *Duplex
*DefaultDuplex: None
*Duplex DuplexNoTumble/Flip on Long Edge (Standard): "%% FoomaticRIPOptionSetting: Duplex=DuplexNoTumble"
*FoomaticRIPOptionSetting Duplex=DuplexNoTumble: ""
*Duplex DuplexTumble/On (Flip on Short Edge): "%% FoomaticRIPOptionSetting: Duplex=DuplexTumble"
*FoomaticRIPOptionSetting Duplex=DuplexTumble: ""
*Duplex None/Off: "%% FoomaticRIPOptionSetting: Duplex=None"
*FoomaticRIPOptionSetting Duplex=None: ""
*CloseUI: *Duplex
*OpenUI *PageSize/Page Size: PickOne
*FoomaticRIPOption PageSize: enum CmdLine A
*OrderDependency: 105 AnySetup *PageSize
*DefaultPageSize: A4
*PageSize Letter/Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
*FoomaticRIPOptionSetting PageSize=Letter: " -dDEVICEWIDTHPOINTS=612 -&&
dDEVICEHEIGHTPOINTS=792"
*End
*PageSize A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
*FoomaticRIPOptionSetting PageSize=A4: " -dDEVICEWIDTHPOINTS=595 -dDEV&&
ICEHEIGHTPOINTS=842"
*End
*PageSize Photo/Photo or 4x6 inch index card: "%% FoomaticRIPOptionSetting: PageSize=Photo"
*FoomaticRIPOptionSetting PageSize=Photo: " -dDEVICEWIDTHPOINTS=288 -d&&
DEVICEHEIGHTPOINTS=432"
*End
*PageSize Photo5x7/Photo or 5x7 inch index card: "%% FoomaticRIPOptionSetting: PageSize=Photo5x7"
*FoomaticRIPOptionSetting PageSize=Photo5x7: " -dDEVICEWIDTHPOINTS=360&&
-dDEVICEHEIGHTPOINTS=504"
*End
*PageSize 3x5/3x5 inch index card: "%% FoomaticRIPOptionSetting: PageSize=3x5"
*FoomaticRIPOptionSetting PageSize=3x5: " -dDEVICEWIDTHPOINTS=216 -dDE&&
VICEHEIGHTPOINTS=360"
*End
*PageSize 5x8/5x8 inch index card: "%% FoomaticRIPOptionSetting: PageSize=5x8"
*FoomaticRIPOptionSetting PageSize=5x8: " -dDEVICEWIDTHPOINTS=360 -dDE&&
VICEHEIGHTPOINTS=576"
*End
*PageSize A3/A3: "%% FoomaticRIPOptionSetting: PageSize=A3"
*FoomaticRIPOptionSetting PageSize=A3: " -dDEVICEWIDTHPOINTS=842 -dDEV&&
ICEHEIGHTPOINTS=1190"
*End
*PageSize A5/A5: "%% FoomaticRIPOptionSetting: PageSize=A5"
*FoomaticRIPOptionSetting PageSize=A5: " -dDEVICEWIDTHPOINTS=420 -dDEV&&
ICEHEIGHTPOINTS=595"
*End
*PageSize A6/A6: "%% FoomaticRIPOptionSetting: PageSize=A6"
*FoomaticRIPOptionSetting PageSize=A6: " -dDEVICEWIDTHPOINTS=297 -dDEV&&
ICEHEIGHTPOINTS=420"
*End
*PageSize B4JIS/B4 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B4JIS"
*FoomaticRIPOptionSetting PageSize=B4JIS: " -dDEVICEWIDTHPOINTS=729 -d&&
DEVICEHEIGHTPOINTS=1033"
*End
*PageSize B5JIS/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5JIS"
*FoomaticRIPOptionSetting PageSize=B5JIS: " -dDEVICEWIDTHPOINTS=516 -d&&
DEVICEHEIGHTPOINTS=729"
*End
*PageSize Env10/Envelope #10: "%% FoomaticRIPOptionSetting: PageSize=Env10"
*FoomaticRIPOptionSetting PageSize=Env10: " -dDEVICEWIDTHPOINTS=297 -d&&
DEVICEHEIGHTPOINTS=684"
*End
*PageSize EnvC5/Envelope C5: "%% FoomaticRIPOptionSetting: PageSize=EnvC5"
*FoomaticRIPOptionSetting PageSize=EnvC5: " -dDEVICEWIDTHPOINTS=459 -d&&
DEVICEHEIGHTPOINTS=649"
*End
*PageSize EnvC6/Envelope C6: "%% FoomaticRIPOptionSetting: PageSize=EnvC6"
*FoomaticRIPOptionSetting PageSize=EnvC6: " -dDEVICEWIDTHPOINTS=323 -d&&
DEVICEHEIGHTPOINTS=459"
*End
*PageSize EnvDL/Envelope DL: "%% FoomaticRIPOptionSetting: PageSize=EnvDL"
*FoomaticRIPOptionSetting PageSize=EnvDL: " -dDEVICEWIDTHPOINTS=312 -d&&
DEVICEHEIGHTPOINTS=624"
*End
*PageSize EnvISOB5/Envelope B5: "%% FoomaticRIPOptionSetting: PageSize=EnvISOB5"
*FoomaticRIPOptionSetting PageSize=EnvISOB5: " -dDEVICEWIDTHPOINTS=499&&
-dDEVICEHEIGHTPOINTS=709"
*End
*PageSize EnvMonarch/Envelope Monarch: "%% FoomaticRIPOptionSetting: PageSize=EnvMonarch"
*FoomaticRIPOptionSetting PageSize=EnvMonarch: " -dDEVICEWIDTHPOINTS=2&&
79 -dDEVICEHEIGHTPOINTS=540"
*End
*PageSize Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive"
*FoomaticRIPOptionSetting PageSize=Executive: " -dDEVICEWIDTHPOINTS=52&&
2 -dDEVICEHEIGHTPOINTS=756"
*End
*PageSize FLSA/American Foolscap: "%% FoomaticRIPOptionSetting: PageSize=FLSA"
*FoomaticRIPOptionSetting PageSize=FLSA: " -dDEVICEWIDTHPOINTS=612 -dD&&
EVICEHEIGHTPOINTS=936"
*End
*PageSize Hagaki/Hagaki: "%% FoomaticRIPOptionSetting: PageSize=Hagaki"
*FoomaticRIPOptionSetting PageSize=Hagaki: " -dDEVICEWIDTHPOINTS=283 -&&
dDEVICEHEIGHTPOINTS=420"
*End
*PageSize Ledger/Ledger: "%% FoomaticRIPOptionSetting: PageSize=Ledger"
*FoomaticRIPOptionSetting PageSize=Ledger: " -dDEVICEWIDTHPOINTS=792 -&&
dDEVICEHEIGHTPOINTS=1224"
*End
*PageSize Legal/Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
*FoomaticRIPOptionSetting PageSize=Legal: " -dDEVICEWIDTHPOINTS=612 -d&&
DEVICEHEIGHTPOINTS=1008"
*End
*PageSize Oufuku/Oufuku-Hagaki: "%% FoomaticRIPOptionSetting: PageSize=Oufuku"
*FoomaticRIPOptionSetting PageSize=Oufuku: " -dDEVICEWIDTHPOINTS=420 -&&
dDEVICEHEIGHTPOINTS=567"
*End
*PageSize SuperB/Super B: "%% FoomaticRIPOptionSetting: PageSize=SuperB"
*FoomaticRIPOptionSetting PageSize=SuperB: " -dDEVICEWIDTHPOINTS=936 -&&
dDEVICEHEIGHTPOINTS=1368"
*End
*PageSize w558h774/16K: "%% FoomaticRIPOptionSetting: PageSize=w558h774"
*FoomaticRIPOptionSetting PageSize=w558h774: " -dDEVICEWIDTHPOINTS=558&&
-dDEVICEHEIGHTPOINTS=774"
*End
*PageSize w612h935/Executive (JIS): "%% FoomaticRIPOptionSetting: PageSize=w612h935"
*FoomaticRIPOptionSetting PageSize=w612h935: " -dDEVICEWIDTHPOINTS=612&&
-dDEVICEHEIGHTPOINTS=935"
*End
*PageSize w774h1116/8K: "%% FoomaticRIPOptionSetting: PageSize=w774h1116"
*FoomaticRIPOptionSetting PageSize=w774h1116: " -dDEVICEWIDTHPOINTS=77&&
4 -dDEVICEHEIGHTPOINTS=1116"
*End
*CloseUI: *PageSize
*OpenUI *PageRegion: PickOne
*OrderDependency: 105 AnySetup *PageRegion
*DefaultPageRegion: A4
*PageRegion Letter/Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
*PageRegion A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
*PageRegion Photo/Photo or 4x6 inch index card: "%% FoomaticRIPOptionSetting: PageSize=Photo"
*PageRegion Photo5x7/Photo or 5x7 inch index card: "%% FoomaticRIPOptionSetting: PageSize=Photo5x7"
*PageRegion 3x5/3x5 inch index card: "%% FoomaticRIPOptionSetting: PageSize=3x5"
*PageRegion 5x8/5x8 inch index card: "%% FoomaticRIPOptionSetting: PageSize=5x8"
*PageRegion A3/A3: "%% FoomaticRIPOptionSetting: PageSize=A3"
*PageRegion A5/A5: "%% FoomaticRIPOptionSetting: PageSize=A5"
*PageRegion A6/A6: "%% FoomaticRIPOptionSetting: PageSize=A6"
*PageRegion B4JIS/B4 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B4JIS"
*PageRegion B5JIS/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5JIS"
*PageRegion Env10/Envelope #10: "%% FoomaticRIPOptionSetting: PageSize=Env10"
*PageRegion EnvC5/Envelope C5: "%% FoomaticRIPOptionSetting: PageSize=EnvC5"
*PageRegion EnvC6/Envelope C6: "%% FoomaticRIPOptionSetting: PageSize=EnvC6"
*PageRegion EnvDL/Envelope DL: "%% FoomaticRIPOptionSetting: PageSize=EnvDL"
*PageRegion EnvISOB5/Envelope B5: "%% FoomaticRIPOptionSetting: PageSize=EnvISOB5"
*PageRegion EnvMonarch/Envelope Monarch: "%% FoomaticRIPOptionSetting: PageSize=EnvMonarch"
*PageRegion Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive"
*PageRegion FLSA/American Foolscap: "%% FoomaticRIPOptionSetting: PageSize=FLSA"
*PageRegion Hagaki/Hagaki: "%% FoomaticRIPOptionSetting: PageSize=Hagaki"
*PageRegion Ledger/Ledger: "%% FoomaticRIPOptionSetting: PageSize=Ledger"
*PageRegion Legal/Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
*PageRegion Oufuku/Oufuku-Hagaki: "%% FoomaticRIPOptionSetting: PageSize=Oufuku"
*PageRegion SuperB/Super B: "%% FoomaticRIPOptionSetting: PageSize=SuperB"
*PageRegion w558h774/16K: "%% FoomaticRIPOptionSetting: PageSize=w558h774"
*PageRegion w612h935/Executive (JIS): "%% FoomaticRIPOptionSetting: PageSize=w612h935"
*PageRegion w774h1116/8K: "%% FoomaticRIPOptionSetting: PageSize=w774h1116"
*CloseUI: *PageRegion
*DefaultImageableArea: Letter
*ImageableArea Letter/Letter: "18 14.40 594 777.60"
*ImageableArea A4/A4: "18 14.40 577 827.60"
*ImageableArea Photo/Photo or 4x6 inch index card: "18 14.40 270 417.60"
*ImageableArea Photo5x7/Photo or 5x7 inch index card: "18 14.40 342 489.60"
*ImageableArea 3x5/3x5 inch index card: "18 14.40 198 345.60"
*ImageableArea 5x8/5x8 inch index card: "18 14.40 342 561.60"
*ImageableArea A3/A3: "18 14.40 824 1175.60"
*ImageableArea A5/A5: "18 14.40 402 580.60"
*ImageableArea A6/A6: "18 14.40 279 405.60"
*ImageableArea B4JIS/B4 (JIS): "18 14.40 711 1018.60"
*ImageableArea B5JIS/B5 (JIS): "18 14.40 498 714.60"
*ImageableArea Env10/Envelope #10: "18 14.40 279 669.60"
*ImageableArea EnvC5/Envelope C5: "18 14.40 441 634.60"
*ImageableArea EnvC6/Envelope C6: "18 14.40 305 444.60"
*ImageableArea EnvDL/Envelope DL: "18 14.40 294 609.60"
*ImageableArea EnvISOB5/Envelope B5: "18 14.40 481 694.60"
*ImageableArea EnvMonarch/Envelope Monarch: "18 14.40 261 525.60"
*ImageableArea Executive/Executive: "18 14.40 504 741.60"
*ImageableArea FLSA/American Foolscap: "18 14.40 594 921.60"
*ImageableArea Hagaki/Hagaki: "18 14.40 265 405.60"
*ImageableArea Ledger/Ledger: "18 14.40 774 1209.60"
*ImageableArea Legal/Legal: "18 14.40 594 993.60"
*ImageableArea Oufuku/Oufuku-Hagaki: "18 14.40 402 552.60"
*ImageableArea SuperB/Super B: "18 14.40 918 1353.60"
*ImageableArea w558h774/16K: "18 14.40 540 759.60"
*ImageableArea w612h935/Executive (JIS): "18 14.40 594 920.60"
*ImageableArea w774h1116/8K: "18 14.40 756 1101.60"
*DefaultPaperDimension: Letter
*PaperDimension Letter/Letter: "612 792"
*PaperDimension A4/A4: "595 842"
*PaperDimension Photo/Photo or 4x6 inch index card: "288 432"
*PaperDimension Photo5x7/Photo or 5x7 inch index card: "360 504"
*PaperDimension 3x5/3x5 inch index card: "216 360"
*PaperDimension 5x8/5x8 inch index card: "360 576"
*PaperDimension A3/A3: "842 1190"
*PaperDimension A5/A5: "420 595"
*PaperDimension A6/A6: "297 420"
*PaperDimension B4JIS/B4 (JIS): "729 1033"
*PaperDimension B5JIS/B5 (JIS): "516 729"
*PaperDimension Env10/Envelope #10: "297 684"
*PaperDimension EnvC5/Envelope C5: "459 649"
*PaperDimension EnvC6/Envelope C6: "323 459"
*PaperDimension EnvDL/Envelope DL: "312 624"
*PaperDimension EnvISOB5/Envelope B5: "499 709"
*PaperDimension EnvMonarch/Envelope Monarch: "279 540"
*PaperDimension Executive/Executive: "522 756"
*PaperDimension FLSA/American Foolscap: "612 936"
*PaperDimension Hagaki/Hagaki: "283 420"
*PaperDimension Ledger/Ledger: "792 1224"
*PaperDimension Legal/Legal: "612 1008"
*PaperDimension Oufuku/Oufuku-Hagaki: "420 567"
*PaperDimension SuperB/Super B: "936 1368"
*PaperDimension w558h774/16K: "558 774"
*PaperDimension w612h935/Executive (JIS): "612 935"
*PaperDimension w774h1116/8K: "774 1116"
*OpenUI *Duplex/Double-Sided Printing: PickOne
*FoomaticRIPOption Duplex: enum CmdLine A
*OrderDependency: 120 AnySetup *Duplex
*DefaultDuplex: None
*Duplex DuplexNoTumble/Long Edge (Standard): "%% FoomaticRIPOptionSetting: Duplex=DuplexNoTumble"
*FoomaticRIPOptionSetting Duplex=DuplexNoTumble: " -dDuplex=true -dTum&&
ble=false"
*End
*Duplex DuplexTumble/Short Edge (Flip): "%% FoomaticRIPOptionSetting: Duplex=DuplexTumble"
*FoomaticRIPOptionSetting Duplex=DuplexTumble: " -dDuplex=true -dTumbl&&
e=true"
*End
*Duplex None/Off: "%% FoomaticRIPOptionSetting: Duplex=None"
*FoomaticRIPOptionSetting Duplex=None: " -dDuplex=false"
*CloseUI: *Duplex
*CloseGroup: General
*OpenGroup: PrintoutMode/Printout Mode
*OpenUI *Quality/Resolution, Quality: PickOne
*FoomaticRIPOption Quality: enum CmdLine B
*OrderDependency: 100 AnySetup *Quality
*DefaultQuality: FromPrintoutMode
*Quality FromPrintoutMode/Controlled by 'Print Quality': "%% FoomaticRIPOptionSetting: Quality=@PrintoutMode"
*Quality 150BestColorCMYK/150 dpi, Best, Color: "%% FoomaticRIPOptionSetting: Quality=150BestColorCMYK"
*FoomaticRIPOptionSetting Quality=150BestColorCMYK: " -r150 -sIjsParam&&
s=Quality:Quality=2,Quality:ColorMode=2,Quality:MediaType=0,Quality:Pe&&
nSet=2"
*End
*Quality 150ColorCMYK/150 dpi, Color: "%% FoomaticRIPOptionSetting: Quality=150ColorCMYK"
*FoomaticRIPOptionSetting Quality=150ColorCMYK: " -r150 -sIjsParams=Qu&&
ality:Quality=0,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet&&
=2"
*End
*Quality 150DraftColorCMYK/150 dpi, Draft, Color: "%% FoomaticRIPOptionSetting: Quality=150DraftColorCMYK"
*FoomaticRIPOptionSetting Quality=150DraftColorCMYK: " -r150 -sIjsPara&&
ms=Quality:Quality=1,Quality:ColorMode=2,Quality:MediaType=0,Quality:P&&
enSet=2"
*End
*Quality 150DraftGrayscaleCMYK/150 dpi, Draft, Grayscale: "%% FoomaticRIPOptionSetting: Quality=150DraftGrayscaleCMYK"
*FoomaticRIPOptionSetting Quality=150DraftGrayscaleCMYK: " -r150 -sIjs&&
Params=Quality:Quality=1,Quality:ColorMode=0,Quality:MediaType=0,Quali&&
ty:PenSet=2"
*End
*Quality 150GrayscaleCMYK/150 dpi, Grayscale: "%% FoomaticRIPOptionSetting: Quality=150GrayscaleCMYK"
*FoomaticRIPOptionSetting Quality=150GrayscaleCMYK: " -r150 -sIjsParam&&
s=Quality:Quality=0,Quality:ColorMode=0,Quality:MediaType=0,Quality:Pe&&
nSet=2"
*End
*Quality 300BestColorCMYK/300 dpi, Best, Color: "%% FoomaticRIPOptionSetting: Quality=300BestColorCMYK"
*FoomaticRIPOptionSetting Quality=300BestColorCMYK: " -r300 -sIjsParam&&
s=Quality:Quality=2,Quality:ColorMode=2,Quality:MediaType=0,Quality:Pe&&
nSet=2"
*End
*Quality 300ColorCMYK/300 DPI, Color: "%% FoomaticRIPOptionSetting: Quality=300ColorCMYK"
*FoomaticRIPOptionSetting Quality=300ColorCMYK: " -r300 -sIjsParams=Qu&&
ality:Quality=0,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet&&
=2"
*End
*Quality 300GrayscaleCMYK/300 dpi, Grayscale: "%% FoomaticRIPOptionSetting: Quality=300GrayscaleCMYK"
*FoomaticRIPOptionSetting Quality=300GrayscaleCMYK: " -r300 -sIjsParam&&
s=Quality:Quality=0,Quality:ColorMode=0,Quality:MediaType=0,Quality:Pe&&
nSet=2"
*End
*Quality 600BestColorCMYK/600 dpi, Best, Color: "%% FoomaticRIPOptionSetting: Quality=600BestColorCMYK"
*FoomaticRIPOptionSetting Quality=600BestColorCMYK: " -r600 -sIjsParam&&
s=Quality:Quality=2,Quality:ColorMode=2,Quality:MediaType=0,Quality:Pe&&
nSet=2"
*End
*Quality 600GrayscaleCMYK/600 DPI, Grayscale: "%% FoomaticRIPOptionSetting: Quality=600GrayscaleCMYK"
*FoomaticRIPOptionSetting Quality=600GrayscaleCMYK: " -r600 -sIjsParam&&
s=Quality:Quality=0,Quality:ColorMode=0,Quality:MediaType=0,Quality:Pe&&
nSet=2"
*End
*CloseUI: *Quality
*CloseGroup: PrintoutMode
*% Generic boilerplate PPD stuff as standard PostScript fonts and so on
*DefaultFont: Courier
*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
*Font Bookman-Light: Standard "(001.004S)" Standard ROM
*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
*Font Courier: Standard "(002.004S)" Standard ROM
*Font Courier-Bold: Standard "(002.004S)" Standard ROM
*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
*Font Helvetica: Standard "(001.006S)" Standard ROM
*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
*Font Symbol: Special "(001.007S)" Special ROM
*Font Times-Bold: Standard "(001.007S)" Standard ROM
*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
*Font Times-Italic: Standard "(001.007S)" Standard ROM
*Font Times-Roman: Standard "(001.007S)" Standard ROM
*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
*Font ZapfDingbats: Special "(001.004S)" Standard ROM

24
cups/printers.conf Normal file
View File

@ -0,0 +1,24 @@
# Printer configuration file for CUPS v2.3.3op2
# Written by cupsd
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
NextPrinterId 2
<Printer DEFAULT>
PrinterId 1
UUID urn:uuid:7c17efda-9fe6-3e3a-4aca-76806149a3b3
Info Canon MF4500 Series
Location Local Printer
MakeModel Canon MF4500 Series UFRII LT
DeviceURI usb://Canon/MF4500%20Series?serial=000000000000&interface=1
State Idle
StateTime 1683143895
ConfigTime 1683137948
Type 8393940
Accepting Yes
Shared No
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-job
</Printer>

24
cups/printers.conf.O Normal file
View File

@ -0,0 +1,24 @@
# Printer configuration file for CUPS v2.3.3op2
# Written by cupsd
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
NextPrinterId 2
<Printer DEFAULT>
PrinterId 1
UUID urn:uuid:7c17efda-9fe6-3e3a-4aca-76806149a3b3
Info Canon MF4500 Series
Location Local Printer
MakeModel Canon MF4500 Series UFRII LT
DeviceURI usb://Canon/MF4500%20Series?serial=000000000000&interface=1
State Idle
StateTime 1683137963
ConfigTime 1683137948
Type 8393940
Accepting Yes
Shared No
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-job
</Printer>

196
cupsd.conf.txt Normal file
View File

@ -0,0 +1,196 @@
#
# Configuration file for the CUPS scheduler. See "man cupsd.conf" for a
# complete description of this file.
#
# Log general information in error_log - change "warn" to "debug"
# for troubleshooting...
LogLevel warn
PageLogFormat
# Specifies the maximum size of the log files before they are rotated. The value "0" disables log rotation.
MaxLogSize 0
# Default error policy for printers
ErrorPolicy retry-job
# Allow remote access
Listen *:631
Listen /var/run/cups/cups.sock
# Show shared printers on the local network.
Browsing Yes
BrowseLocalProtocols dnssd
# Default authentication type, when authentication is required...
DefaultAuthType Basic
DefaultEncryption IfRequested
# Web interface setting...
WebInterface Yes
# Timeout after cupsd exits if idle (applied only if cupsd runs on-demand - with -l)
IdleExitTimeout 60
# Restrict access to the server...
<Location />
Order allow,deny
Allow all
</Location>
# Restrict access to the admin pages...
<Location /admin>
Order allow,deny
Allow all
</Location>
# Restrict access to configuration files...
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow all
</Location>
# Restrict access to log files...
<Location /admin/log>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow all
</Location>
# Set the default printer/job policies...
<Policy default>
# Job/subscription privacy...
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
# Job-related operations must be done by the owner or an administrator...
<Limit Create-Job Print-Job Print-URI Validate-Job>
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
# All administration operations require an administrator to authenticate...
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
# All printer operations require a printer operator to authenticate...
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
# Set the authenticated printer/job policies...
<Policy authenticated>
# Job/subscription privacy...
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
# Job-related operations must be done by the owner or an administrator...
<Limit Create-Job Print-Job Print-URI Validate-Job>
AuthType Default
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
# All administration operations require an administrator to authenticate...
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
# All printer operations require a printer operator to authenticate...
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
# Set the kerberized printer/job policies...
<Policy kerberos>
# Job/subscription privacy...
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
# Job-related operations must be done by the owner or an administrator...
<Limit Create-Job Print-Job Print-URI Validate-Job>
AuthType Negotiate
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
AuthType Negotiate
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
# All administration operations require an administrator to authenticate...
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
# All printer operations require a printer operator to authenticate...
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Negotiate
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>

27
docker-compose.yaml Executable file
View File

@ -0,0 +1,27 @@
version: "2"
services:
app:
build: ./
image: gitea.simonzeyer.de/simon/wnd_ils_alarmfax_parser:latest
restart: always
privileged: true
environment:
- username=${username}
- password=${password}
- server=${server}
- primary_smtp_address=${primary_smtp_address}
- filter_from=${filter_from}
- folders=${folders}
- IS_DEV=${IS_DEV}
- webhooks=${webhooks}
- alarmfax_parser_id=${alarmfax_parser_id}
- alarminator_api=${alarminator_api}
- alarminator_token=${alarminator_token}
- alarminator_zvies_use_PEALGRP=${alarminator_zvies_use_PEALGRP}
- printer=${printer}
- print_num=${print_num}
volumes:
- ./cups:/etc/cups
- ./cupsd.conf.txt:/etc/cups/cupsd.conf
- /dev/bus/usb:/dev/bus/usb
- /var/run/dbus:/var/run/dbus

31
requirements.txt Normal file
View File

@ -0,0 +1,31 @@
cached-property==1.5.2
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==3.0.1
cryptography==39.0.0
defusedxml==0.7.1
dnspython==2.3.0
exchangelib==4.9.0
idna==3.4
isodate==0.6.1
lxml==4.9.2
ntlm-auth==1.5.0
numpy==1.24.1
oauthlib==3.2.2
pandas==1.5.2
pycparser==2.21
Pygments==2.14.0
python-dateutil==2.8.2
pytz==2022.7.1
pytz-deprecation-shim==0.1.0.post0
requests==2.28.2
requests-ntlm==1.1.0
requests-oauthlib==1.3.1
six==1.16.0
tzdata==2022.7
tzlocal==4.2
urllib3==1.26.14
xmltodict==0.12.0
xmltojson==2.0.1
pycups==2.0.1
weasyprint