aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-04-24 18:47:24 +0200
committerJay Berkenbilt <ejb@ql.org>2022-04-24 19:06:19 +0200
commitd0b7cc8ac6773e3ddab1c34da910072fac441d07 (patch)
tree1c31fdd532e5b279a0b8079dbefb1f6cfd55dc26 /qpdf
parent63c5a56f38f51c4e1f0226721eae59a9201fed0e (diff)
downloadqpdf-d0b7cc8ac6773e3ddab1c34da910072fac441d07.tar.zst
QPDFJob json: make removeAttachment take an array (fixes #693)
Diffstat (limited to 'qpdf')
-rw-r--r--qpdf/qtest/qpdf.test21
-rw-r--r--qpdf/qtest/qpdf/remove-multiple-attachments-json.out3
-rw-r--r--qpdf/qtest/qpdf/remove-multiple-attachments.json10
-rw-r--r--qpdf/qtest/qpdf/remove-multiple-attachments.out3
-rw-r--r--qpdf/qtest/qpdf/remove-multiple-attachments.pdfbin0 -> 1341 bytes
5 files changed, 36 insertions, 1 deletions
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index 5bf6be76..8878aa31 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -723,7 +723,7 @@ $td->runtest("check overlay with no resources output",
show_ntests();
# ----------
$td->notify("--- File Attachments ---");
-$n_tests += 33;
+$n_tests += 37;
open(F, ">auto-txt") or die;
print F "from file";
@@ -907,6 +907,25 @@ $td->runtest("check dates",
{$td->REGEXP => ".*CreationDate \\(D:\\d+.*ModDate \\(D:\\d+.*",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
+$td->runtest("remove multiple attachments",
+ {$td->COMMAND =>
+ "qpdf --verbose --static-id add-attachments-1.pdf a.pdf" .
+ " --remove-attachment=auto-1 --remove-attachment=auto-Two"},
+ {$td->FILE => "remove-multiple-attachments.out",
+ $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check output",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "remove-multiple-attachments.pdf"});
+$td->runtest("remove multiple attachments (json)",
+ {$td->COMMAND =>
+ "qpdf --job-json-file=remove-multiple-attachments.json"},
+ {$td->FILE => "remove-multiple-attachments-json.out",
+ $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check output",
+ {$td->FILE => "b.pdf"},
+ {$td->FILE => "remove-multiple-attachments.pdf"});
show_ntests();
# ----------
diff --git a/qpdf/qtest/qpdf/remove-multiple-attachments-json.out b/qpdf/qtest/qpdf/remove-multiple-attachments-json.out
new file mode 100644
index 00000000..3563f1f8
--- /dev/null
+++ b/qpdf/qtest/qpdf/remove-multiple-attachments-json.out
@@ -0,0 +1,3 @@
+qpdf: removed attachment auto-1
+qpdf: removed attachment auto-Two
+qpdf: wrote file b.pdf
diff --git a/qpdf/qtest/qpdf/remove-multiple-attachments.json b/qpdf/qtest/qpdf/remove-multiple-attachments.json
new file mode 100644
index 00000000..ea79cdf5
--- /dev/null
+++ b/qpdf/qtest/qpdf/remove-multiple-attachments.json
@@ -0,0 +1,10 @@
+{
+ "verbose": "",
+ "staticId": "",
+ "inputFile": "add-attachments-1.pdf",
+ "outputFile": "b.pdf",
+ "removeAttachment": [
+ "auto-1",
+ "auto-Two"
+ ]
+}
diff --git a/qpdf/qtest/qpdf/remove-multiple-attachments.out b/qpdf/qtest/qpdf/remove-multiple-attachments.out
new file mode 100644
index 00000000..e114eff5
--- /dev/null
+++ b/qpdf/qtest/qpdf/remove-multiple-attachments.out
@@ -0,0 +1,3 @@
+qpdf: removed attachment auto-1
+qpdf: removed attachment auto-Two
+qpdf: wrote file a.pdf
diff --git a/qpdf/qtest/qpdf/remove-multiple-attachments.pdf b/qpdf/qtest/qpdf/remove-multiple-attachments.pdf
new file mode 100644
index 00000000..c480af1c
--- /dev/null
+++ b/qpdf/qtest/qpdf/remove-multiple-attachments.pdf
Binary files differ