diff --git a/programs/pdf2pdfa b/programs/pdf2pdfa index 084614b..33b5f58 100755 --- a/programs/pdf2pdfa +++ b/programs/pdf2pdfa @@ -7,6 +7,7 @@ OUTPUT=$2 DPI=$3 MAXBITMAP=$4 PDFSETTINGS=$5 +PDFA_CONFORMANCE=$6 if [ -z "$DPI" ]; then DPI=720 @@ -43,6 +44,16 @@ if ! [[ $MAXBITMAP =~ $re ]] ; then exit 2 fi +PDFA_CONFORMANCE_NUM="" +if [[ ! $PDFA_CONFORMANCE =~ $re ]] || [[ "$PDFA_CONFORMANCE" -lt 1 ]] || [[ "$PDFA_CONFORMANCE" -gt 3 ]]; then + echo "error: PDFA_CONFORMANCE invalid - only values from 1 to 3 are allowed" + exit 2 +fi +if [ -n "$PDFA_CONFORMANCE" ] && [ "$PDFA_CONFORMANCE" -gt 1 ]; then + # The ghostscript documentation specifies that -dPDFA parameter should only have the version value followed when using 2 or 3 + PDFA_CONFORMANCE_NUM="=$PDFA_CONFORMANCE" +fi + docker run \ --runtime="${LAUNDRY_DOCKER_RUNTIME:-runsc}" \ --network=none \ @@ -53,5 +64,5 @@ docker run \ --rm \ laundry-programs \ /bin/bash -c 'cat > /home/docconv/document.pdf && \ - gs -q -dPDFA -dBATCH -dNOPAUSE -r'$DPI' -dMaxBitmap='$MAXBITMAP' '$PDFSETTINGS' -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -dPDFACompatibilityPolicy=1 -sOutputFile=- /home/docconv/document.pdf' \ + gs -q -dPDFA'$PDFA_CONFORMANCE_NUM' -dBATCH -dNOPAUSE -r'$DPI' -dMaxBitmap='$MAXBITMAP' '$PDFSETTINGS' -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -dPDFACompatibilityPolicy=1 -sOutputFile=- /home/docconv/document.pdf' \ < "$INPUT" > "$OUTPUT" diff --git a/resources/public/index.html b/resources/public/index.html index a75d6ac..65d42b7 100644 --- a/resources/public/index.html +++ b/resources/public/index.html @@ -9,7 +9,8 @@ var pdfParameters = [ {"type": "pdf/pdf2pdfa", key: "dpi", dtype: "number", wrapper: "pdf_dpi_elem", elem: "pdf_dpi" }, {"type": "pdf/pdf2pdfa", key: "maxbitmap", dtype: "number", wrapper: "pdf_maxbitmap_elem", elem: "pdf_maxbitmap" }, - {"type": "pdf/pdf2pdfa", key: "pdfsettings", wrapper: "pdf_pdfsettings_elem", elem: "pdf_pdfsettings" } + {"type": "pdf/pdf2pdfa", key: "pdfsettings", wrapper: "pdf_pdfsettings_elem", elem: "pdf_pdfsettings" }, + {"type": "pdf/pdf2pdfa", key: "pdfaconformance", dtype: "number", wrapper: "pdf_pdfaconformance_elem", elem: "pdf_pdfaconformance" } ] function updateConversionParameters() { @@ -104,6 +105,9 @@