mirror of
https://github.com/nikdoof/cups-avahi-airprint.git
synced 2025-12-10 18:52:18 +00:00
Fix na-letter paper size
This commit is contained in:
36
Dockerfile
36
Dockerfile
@@ -1,4 +1,4 @@
|
||||
FROM alpine:3.19
|
||||
FROM alpine:3.20
|
||||
|
||||
# Install the packages we need. Avahi will be included
|
||||
RUN echo -e "https://dl-cdn.alpinelinux.org/alpine/edge/testing\nhttps://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories &&\
|
||||
@@ -8,12 +8,7 @@ RUN echo -e "https://dl-cdn.alpinelinux.org/alpine/edge/testing\nhttps://dl-cdn.
|
||||
cups-client \
|
||||
cups-filters \
|
||||
cups-dev \
|
||||
gutenprint \
|
||||
gutenprint-libs \
|
||||
gutenprint-doc \
|
||||
gutenprint-cups \
|
||||
ghostscript \
|
||||
brlaser \
|
||||
hplip \
|
||||
avahi \
|
||||
inotify-tools \
|
||||
@@ -22,9 +17,31 @@ RUN echo -e "https://dl-cdn.alpinelinux.org/alpine/edge/testing\nhttps://dl-cdn.
|
||||
build-base \
|
||||
wget \
|
||||
rsync \
|
||||
py3-pycups \
|
||||
py3-pycups \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
# Build and install brlaser from source
|
||||
RUN apk add --no-cache git cmake && \
|
||||
git clone https://github.com/pdewacht/brlaser.git && \
|
||||
cd brlaser && \
|
||||
cmake . && \
|
||||
make && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf brlaser
|
||||
|
||||
# Build and install gutenprint from source
|
||||
RUN wget -O gutenprint-5.3.5.tar.xz https://sourceforge.net/projects/gimp-print/files/gutenprint-5.3/5.3.5/gutenprint-5.3.5.tar.xz/download && \
|
||||
tar -xJf gutenprint-5.3.5.tar.xz && \
|
||||
cd gutenprint-5.3.5 && \
|
||||
# Patch to rename conflicting PAGESIZE identifiers to GPT_PAGESIZE in all files in src/testpattern
|
||||
find src/testpattern -type f -exec sed -i 's/\bPAGESIZE\b/GPT_PAGESIZE/g' {} + && \
|
||||
./configure && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd .. && \
|
||||
rm -rf gutenprint-5.3.5 gutenprint-5.3.5.tar.xz
|
||||
|
||||
# This will use port 631
|
||||
EXPOSE 631
|
||||
|
||||
@@ -48,4 +65,7 @@ RUN sed -i 's/Listen localhost:631/Listen 0.0.0.0:631/' /etc/cups/cupsd.conf &&
|
||||
sed -i 's/<Location \/admin\/conf>/<Location \/admin\/conf>\n Allow All/' /etc/cups/cupsd.conf && \
|
||||
sed -i 's/.*enable\-dbus=.*/enable\-dbus\=no/' /etc/avahi/avahi-daemon.conf && \
|
||||
echo "ServerAlias *" >> /etc/cups/cupsd.conf && \
|
||||
echo "DefaultEncryption Never" >> /etc/cups/cupsd.conf
|
||||
echo "DefaultEncryption Never" >> /etc/cups/cupsd.conf && \
|
||||
echo "ReadyPaperSizes A4,TA4,4X6FULL,T4X6FULL,2L,T2L,A6,A5,B5,L,TL,INDEX5,8x10,T8x10,4X7,T4X7,Postcard,TPostcard,ENV10,EnvDL,ENVC6,Letter,Legal" >> /etc/cups/cupsd.conf && \
|
||||
echo "DefaultPaperSize Letter" >> /etc/cups/cupsd.conf && \
|
||||
echo "pdftops-renderer ghostscript" >> /etc/cups/cupsd.conf
|
||||
|
||||
@@ -186,10 +186,25 @@ class AirPrintGenerate(object):
|
||||
color.text = 'Color=T'
|
||||
service.append(color)
|
||||
|
||||
if attrs['media-default'] == 'iso_a4_210x297mm':
|
||||
max_paper = Element('txt-record')
|
||||
max_paper.text = 'PaperMax=legal-A4'
|
||||
service.append(max_paper)
|
||||
# Add paper size support with standard AirPrint format
|
||||
paper_sizes = Element('txt-record')
|
||||
paper_sizes.text = 'PaperMax=na-letter'
|
||||
service.append(paper_sizes)
|
||||
|
||||
# Add supported paper sizes with dimensions
|
||||
supported_paper = Element('txt-record')
|
||||
supported_paper.text = 'PaperSize=na-letter:8.5x11in,A4:210x297mm,A5:148x210mm,A6:105x148mm,EnvDL:110x220mm'
|
||||
service.append(supported_paper)
|
||||
|
||||
# Add paper size support flag
|
||||
paper_support = Element('txt-record')
|
||||
paper_support.text = 'PaperSize=T'
|
||||
service.append(paper_support)
|
||||
|
||||
# Add additional paper size attributes
|
||||
paper_attrs = Element('txt-record')
|
||||
paper_attrs.text = 'PaperSizeSupported=na-letter,A4,A5,A6,EnvDL'
|
||||
service.append(paper_attrs)
|
||||
|
||||
pdl = Element('txt-record')
|
||||
fmts = []
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.1.5
|
||||
1.2.0
|
||||
|
||||
Reference in New Issue
Block a user