diff --git a/misc/screencast/demo.cast b/misc/screencast/demo.cast index 929e031b..6def170f 100644 --- a/misc/screencast/demo.cast +++ b/misc/screencast/demo.cast @@ -60,6 +60,6 @@ [8.280789, "o", "\rRecompressing JPEGs: 0image [00:00, ?image/s]\rRecompressing JPEGs: 0image [00:00, ?image/s]\r\n\rDeflating JPEGs: 0%| | 0/4 [00:00 \u001b[K\r\u001b[C\u001b[C"] [8.862206, "o", "\r\n\u001b[30m\u001b(B\u001b[m\u001b[30m\u001b(B\u001b[m\u001b[?2004l"] diff --git a/misc/screencast/demo.svg b/misc/screencast/demo.svg index b14b1a11..9a4af32b 100644 --- a/misc/screencast/demo.svg +++ b/misc/screencast/demo.svg @@ -1 +1 @@ ->>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdf--skip-text>ocrmypdf--skip-textmultipage.pdfmultipage.pdf>ocrmypdf--skip-textmultipage.pdfmultipage_ocr.pdfScanningcontents:100%|█████████████████████████████████████████████████████████████████████████|6/6[00:00<00:00,1270.68page/s]Startprocessing6pagesconcurrentlyOCR:0%||0.0/6.0[00:00<?,?page/s]4skippingallprocessingonthispageOCR:100%|█████████████████████████████████████████████████████████████████████████████████████|6.0/6.0[00:06<00:00,1.09s/page]Postprocessing...PDF/Aconversion:100%|████████████████████████████████████████████████████████████████████████████|6/6[00:02<00:00,2.71page/s]SomeinputmetadatacouldnotbecopiedbecauseitisnotpermittedinPDF/A.YoumaywishtoexaminetheoutputPDF'sXMPmetadata.RecompressingJPEGs:0image[00:00,?image/s]DeflatingJPEGs:100%|███████████████████████████████████████████████████████████████████████████|4/4[00:00<00:00,238.28image/s]JBIG2:0item[00:00,?item/s]Imageoptimizationratio:1.01savings:1.3%Totalfilesizeratio:1.02savings:1.6%OutputfileisaPDF/A-2B(asexpected)>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdf--version>ocrmypdf--version>ocrmypdf--s>ocrmypdf--sk>ocrmypdf--ski>ocrmypdf--skip>ocrmypdf--skip->ocrmypdf--skip-t>ocrmypdf--skip-te>ocrmypdf--skip-tex>ocrmypdf--skip-textmasks.pdf>ocrmypdf--skip-textmultipage.pdf>ocrmypdf--skip-textmultipage.pdf>ocrmypdf--skip-textmultipage.pdf>ocrmypdf--skip-textmultipage.pdf>ocrmypdf--skip-textmultipage.pdfmasks.pdf>ocrmypdf--skip-textmultipage.pdfmultipage.pdf>ocrmypdf--skip-textmultipage.pdfmultipage.pdf>ocrmypdf--skip-textmultipage.pdfmultipage_.pdf>ocrmypdf--skip-textmultipage.pdfmultipage_o.pdf>ocrmypdf--skip-textmultipage.pdfmultipage_oc.pdfScanningcontents:0%||0/6[00:00<?,?page/s]OCR:25%|█████████████████████▎|1.5/6.0[00:00<00:00,8.12page/s]OCR:42%|███████████████████████████████████▍|2.5/6.0[00:00<00:01,3.05page/s]OCR:58%|█████████████████████████████████████████████████▌|3.5/6.0[00:00<00:00,3.39page/s]OCR:75%|███████████████████████████████████████████████████████████████▊|4.5/6.0[00:01<00:00,2.49page/s]PDF/Aconversion:0%||0/6[00:00<?,?page/s]PDF/Aconversion:50%|██████████████████████████████████████|3/6[00:01<00:01,1.61page/s]PDF/Aconversion:83%|███████████████████████████████████████████████████████████████▎|5/6[00:01<00:00,2.90page/s] \ No newline at end of file +>>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdf--skip-text>ocrmypdf--skip-textmultipage.pdfmultipage.pdf>ocrmypdf--skip-textmultipage.pdfmultipage_ocr.pdfScanningcontents:100%|█████████████████████████████████████████████████████████████████████████|6/6[00:00<00:00,1270.68page/s]Startprocessing6pagesconcurrentlyOCR:0%||0.0/6.0[00:00<?,?page/s]4skippingallprocessingonthispageOCR:100%|█████████████████████████████████████████████████████████████████████████████████████|6.0/6.0[00:06<00:00,1.09s/page]Postprocessing...PDF/Aconversion:100%|████████████████████████████████████████████████████████████████████████████|6/6[00:02<00:00,2.71page/s]SomeinputmetadatacouldnotbecopiedbecauseitisnotpermittedinPDF/A.YoumaywishtoexaminetheoutputPDF'sXMPmetadata.RecompressingJPEGs:0image[00:00,?image/s]DeflatingJPEGs:100%|███████████████████████████████████████████████████████████████████████████|4/4[00:00<00:00,238.28image/s]JBIG2:0item[00:00,?item/s]Imageoptimizationratio:1.01savings:1.3%Totalfilesizeratio:1.02savings:1.6%OutputfileisaPDF/A-2b(asexpected)>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdfmultipage.pdfmultipage_with_ocr.pdf>ocrmypdf--version>ocrmypdf--version>ocrmypdf--s>ocrmypdf--sk>ocrmypdf--ski>ocrmypdf--skip>ocrmypdf--skip->ocrmypdf--skip-t>ocrmypdf--skip-te>ocrmypdf--skip-tex>ocrmypdf--skip-textmasks.pdf>ocrmypdf--skip-textmultipage.pdf>ocrmypdf--skip-textmultipage.pdf>ocrmypdf--skip-textmultipage.pdf>ocrmypdf--skip-textmultipage.pdf>ocrmypdf--skip-textmultipage.pdfmasks.pdf>ocrmypdf--skip-textmultipage.pdfmultipage.pdf>ocrmypdf--skip-textmultipage.pdfmultipage.pdf>ocrmypdf--skip-textmultipage.pdfmultipage_.pdf>ocrmypdf--skip-textmultipage.pdfmultipage_o.pdf>ocrmypdf--skip-textmultipage.pdfmultipage_oc.pdfScanningcontents:0%||0/6[00:00<?,?page/s]OCR:25%|█████████████████████▎|1.5/6.0[00:00<00:00,8.12page/s]OCR:42%|███████████████████████████████████▍|2.5/6.0[00:00<00:01,3.05page/s]OCR:58%|█████████████████████████████████████████████████▌|3.5/6.0[00:00<00:00,3.39page/s]OCR:75%|███████████████████████████████████████████████████████████████▊|4.5/6.0[00:01<00:00,2.49page/s]PDF/Aconversion:0%||0/6[00:00<?,?page/s]PDF/Aconversion:50%|██████████████████████████████████████|3/6[00:01<00:01,1.61page/s]PDF/Aconversion:83%|███████████████████████████████████████████████████████████████▎|5/6[00:01<00:00,2.90page/s] \ No newline at end of file diff --git a/src/ocrmypdf/cli.py b/src/ocrmypdf/cli.py index 6ce4d702..f3bd50cd 100644 --- a/src/ocrmypdf/cli.py +++ b/src/ocrmypdf/cli.py @@ -196,8 +196,8 @@ Online documentation is located at: "for users who want their file altered as little as possible. 'pdfa' " "also has problems with full Unicode text. 'pdf' minimizes changes " "to the input file. 'pdf-a1' creates a " - "PDF/A1-b file. 'pdf-a2' is equivalent to 'pdfa'. 'pdf-a3' creates a " - "PDF/A3-b file. 'none' will produce no output, which may be helpful if " + "PDF/A-1b file. 'pdf-a2' is equivalent to 'pdfa'. 'pdf-a3' creates a " + "PDF/A-3b file. 'none' will produce no output, which may be helpful if " "only the --sidecar is desired.", ) diff --git a/src/ocrmypdf/pdfa.py b/src/ocrmypdf/pdfa.py index e759150e..b44765d1 100644 --- a/src/ocrmypdf/pdfa.py +++ b/src/ocrmypdf/pdfa.py @@ -120,10 +120,13 @@ def file_claims_pdfa(filename: Path): 'output': 'pdf', 'conformance': 'No PDF/A metadata in XMP', } - valid_part_conforms = {'1A', '1B', '2A', '2B', '2U', '3A', '3B', '3U'} - conformance = f'PDF/A-{pdfmeta.pdfa_status}' + valid_part_conforms = {'1a', '1b', '2a', '2b', '2u', '3a', '3b', '3u'} + # Raw value in XMP metadata returned by pikepdf is uppercase, but ISO + # uses lower case for conformance levels. + pdfa_status_iso = pdfmeta.pdfa_status.lower() + conformance = f'PDF/A-{pdfa_status_iso}' pdfa_dict: dict[str, str | bool] = {} - if pdfmeta.pdfa_status in valid_part_conforms: + if pdfa_status_iso in valid_part_conforms: pdfa_dict['pass'] = True pdfa_dict['output'] = 'pdfa' pdfa_dict['conformance'] = conformance diff --git a/src/ocrmypdf/pluginspec.py b/src/ocrmypdf/pluginspec.py index 701e4c71..05d5a648 100644 --- a/src/ocrmypdf/pluginspec.py +++ b/src/ocrmypdf/pluginspec.py @@ -492,7 +492,7 @@ def generate_pdfa( pdf_version: The minimum PDF version that the output file should be. At its own discretion, the PDF/A generator may raise the version, but should not lower it. - pdfa_part: The desired PDF/A compliance level, such as ``'2B'``. + pdfa_part: The desired PDF/A compliance level, such as ``'2b'``. progressbar_class: The class of a progress bar, which must implement the ProgressBar protocol. If None, no progress is reported. stop_on_soft_error: If there is an "soft error" such that PDF/A generation diff --git a/tests/test_main.py b/tests/test_main.py index c7f051b6..9ad5f8ff 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -801,7 +801,7 @@ def test_pdfa_n(pdfa_level, resources, outpdf): ) pdfa_info = file_claims_pdfa(outpdf) - assert pdfa_info['conformance'] == f'PDF/A-{pdfa_level}B' + assert pdfa_info['conformance'] == f'PDF/A-{pdfa_level}b' def test_decompression_bomb_error(resources, outpdf, caplog):