The PDFreactor Docker image (available at https://hub.docker.com/r/realobjects/pdfreactor/) generally can only access files and documents available through HTTP or within its own file system.


When trying to convert local files with the PDFreactor command line (or through the REST API in general), the PDFreactor Web Service will try to retrieve these files. The command line will always provide the path to local files to the PDFreactor Web Service as a file URL, which be automatically resolved to an absolute URL. For example, let's take a look at the following command:


$ /Applications/PDFreactor/bin/pdfreactor.py -i foo.html -o foo.pdf -s http://localhost:8080/service/rest


The path foo.html would be resolved to file:///Applications/PDFreactor/bin/foo.html. If the PDFreactor Web Service is running in a Docker container, it would not be able to access this file, since a file corresponding to this file URL does not exist in the Docker container. 


One solution would be to also map the directory containing the file to be converted into the Docker container, and then construct the file URL to be used as input for the PDFreactor Web Service accordingly. Assuming the file to convert is available in the path /home/demouser/docs/, you could map it into the PDFreactor container as follows:


docker run -v home/demouser/docs:/docs -p 8080:9423 realobjects/pdfreactor 

 

So the corresponding file URL path from the perspective of the container would be file:///docs/foo.html for exampe.


Now you could convert through the command line as follows:


$ /Applications/PDFreactor/bin/pdfreactor.py -i file:///docs/foo.html -o foo.pdf -s http://localhost:8080/service/rest