Edit online

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
    1. 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
    2. Run the .bat file from a command prompt.
  • Linux/macOS
    1. 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
    2. Run the script from the Terminal application.