How To Apply Chemistry on Multiple Files
It is possible to use Oxygen PDF Chemistry to transform multiple files in a directory at once. This can be done by using a particular script, depending on your operating system.
The following examples assume that you installed Oxygen PDF Chemistry and modified the PATH
environment
variable to include the installation directory. Also, you can change the
INPUT_DIR, CSS, and *xml file pattern according to your needs.
- Windows
- Create a .bat file with the following
content:
@echo off rem This is the input directory set "INPUT_DIR=C:\some\input\directory" rem This is the CSS used to style the xml documents. set "CSS=C:\some\css\file" rem Iterate all the files (%%f) that match the "*.xml" pattern in the input directory. for /f "usebackq delims=|" %%f in (`dir /b "%INPUT_DIR%\*.xml"`) do chemistry.bat -in %INPUT_DIR%%%f -css %CSS% -out %INPUT_DIR%%%f.pdf
- Run the .bat file from a command prompt.
- Create a .bat file with the following
content:
- Linux/macOS
- Create a script with the following
content:
#!/bin/sh # This is the input directory INPUT_DIR=/some/input/directory" # This is the CSS used to style the xml documents. CSS=/some/css/file" # Iterate all the files ($f) that match the "*.xml" pattern in the input directory. for f in $INPUT_DIR/*.xml; do chemistry.sh -in $f -out $f.pdf -css $CSS ; done
- Run the script from the Terminal application.
- Create a script with the following
content: