From f21e4f264ab285817bfad1698dbb8b8b300c9ece Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 17 Feb 2021 20:14:04 -0500 Subject: Add file attachment example --- examples/qtest/attach-file.test | 35 +++++++++++++++ examples/qtest/attach-file/input.pdf | 79 ++++++++++++++++++++++++++++++++++ examples/qtest/attach-file/output.pdf | Bin 0 -> 5287 bytes examples/qtest/attach-file/potato.png | Bin 0 -> 2692 bytes 4 files changed, 114 insertions(+) create mode 100644 examples/qtest/attach-file.test create mode 100644 examples/qtest/attach-file/input.pdf create mode 100644 examples/qtest/attach-file/output.pdf create mode 100644 examples/qtest/attach-file/potato.png (limited to 'examples/qtest') diff --git a/examples/qtest/attach-file.test b/examples/qtest/attach-file.test new file mode 100644 index 00000000..9d8e7504 --- /dev/null +++ b/examples/qtest/attach-file.test @@ -0,0 +1,35 @@ +#!/usr/bin/env perl +require 5.008; +use warnings; +use strict; + +chdir("attach-file") or die "chdir testdir failed: $!\n"; + +require TestDriver; + +cleanup(); + +my $td = new TestDriver('attach-file'); + +$td->runtest("attach file", + {$td->COMMAND => + "pdf-attach-file --infile input.pdf" . + " --attachment ./potato.png" . + " --outfile a.pdf" . + " --mimetype image/png"}, + {$td->STRING => + "pdf-attach-file: attaching ./potato.png as potato.png\n", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); +$td->runtest("check output", + {$td->FILE => "a.pdf"}, + {$td->FILE => "output.pdf"}); + +cleanup(); + +$td->report(2); + +sub cleanup +{ + unlink "a.pdf"; +} diff --git a/examples/qtest/attach-file/input.pdf b/examples/qtest/attach-file/input.pdf new file mode 100644 index 00000000..a7e01f91 --- /dev/null +++ b/examples/qtest/attach-file/input.pdf @@ -0,0 +1,79 @@ +%PDF-1.3 +1 0 obj +<< + /Type /Catalog + /Pages 2 0 R +>> +endobj + +2 0 obj +<< + /Type /Pages + /Kids [ + 3 0 R + ] + /Count 1 +>> +endobj + +3 0 obj +<< + /Type /Page + /Parent 2 0 R + /MediaBox [0 0 612 792] + /Contents 4 0 R + /Resources << + /ProcSet 5 0 R + /Font << + /F1 6 0 R + >> + >> +>> +endobj + +4 0 obj +<< + /Length 44 +>> +stream +BT + /F1 24 Tf + 72 720 Td + (Potato) Tj +ET +endstream +endobj + +5 0 obj +[ + /PDF + /Text +] +endobj + +6 0 obj +<< + /Type /Font + /Subtype /Type1 + /Name /F1 + /BaseFont /Helvetica + /Encoding /WinAnsiEncoding +>> +endobj + +xref +0 7 +0000000000 65535 f +0000000009 00000 n +0000000063 00000 n +0000000135 00000 n +0000000307 00000 n +0000000403 00000 n +0000000438 00000 n +trailer << + /Size 7 + /Root 1 0 R +>> +startxref +556 +%%EOF diff --git a/examples/qtest/attach-file/output.pdf b/examples/qtest/attach-file/output.pdf new file mode 100644 index 00000000..d41cef4f Binary files /dev/null and b/examples/qtest/attach-file/output.pdf differ diff --git a/examples/qtest/attach-file/potato.png b/examples/qtest/attach-file/potato.png new file mode 100644 index 00000000..da425324 Binary files /dev/null and b/examples/qtest/attach-file/potato.png differ -- cgit v1.2.3-54-g00ecf