9.4.  Extract Attachments

The utility ExtractEmbeddedFiles creates a separate file for every attachment which is embedded in the PDF document.

The attachments are exported byte for byte, so all file formats are supported.

Program Start

::
:: Extract embedded files from a PDF document. Each in a separate output file.
::

@echo off
setlocal
set CLASSPATH=./lib/bouncycastle-jdk15on-153/*;%CLASSPATH%
set CLASSPATH=./lib/commons-logging-1.2/*;%CLASSPATH%
set CLASSPATH=./lib/pdfbox-2.0.0/*;%CLASSPATH%
set CLASSPATH=./lib/pdfunit-2016.05/*;%CLASSPATH%

set TOOL=com.pdfunit.tools.ExtractEmbeddedFiles
set OUT_DIR=./tmp
set IN_FILE=umsatzsteuervoranmeldung-2010.pdf
set PASSWD=

java  %TOOL%  %IN_FILE%  %OUT_DIR%  %PASSWD%
endlocal

Input

The PDF document umsatzsteuervoranmeldung-2010.pdf contains the file PrePress-Qualität.joboptions.

Output

The name of the generated file contains both the name of the PDF document and the name of the embedded file: _embedded-file_umsatzsteuervoranmeldung-2010_PrePress-Qualität.joboptions.out.

A small snippet of its content: