An api server converts office files to pdf with microsoft office. Using powershell script from escottj/Doc2PDF
This server runs on Windows only because we're using Microsoft Office to generate the perfect formated PDFs.
I used RailsInstaller to do this. Before today I never used ruby on Windows, It worked perfectly, so it should be easy. Just click to run. Windows 7 x64 with sp1 for me, I didn't test any other version, but I think it will work.
Note: PowerShell is required for this server.
After the 1st step, you will have git installed, run it:
git clone https://github.com/0000sir/Doc2PDF-Server.git
Install gems with bundler
cd Doc2PDF-Server
bundle install
You may need to change gems source in Gemfile, I used ruby-china mirrro.
Simply use rails s for running
rails s -b 0.0.0.0 -p 80
That's it.
The API is really simple.
- URL: http://example.org/files
- Params:
-
- file: The office file you want to convert
This will commit your file to the server. And it will return a file stream of your pdf file.
This shell command can do the test
curl -F "file=@2016.xls" -d "mime=application/ms-excel" http://192.168.1.5:3000/files -o test.pdf
NOTICE submit file mime type to avoid miss conversion (Optional)
- URL http://example.org/files/{md5sum}
- Params:
-
- md5sum: md5 sum of your file.