The following works and will convert /tmp/file.docx to /tmp/file.pdf.
libreoffice3.5. --headless --convert-to pdf --outdir /tmp /tmp/file.docx
How would I convert https://www.mysite.com/getfile.php?id=123 (which will return a docx file) and save it as /tmp/file_123.pdf? I would expect it would require wget, piping, and input/output redirecting.
Thank you
EDIT – RESPONSE TO zebediah49’s Post
> libreoffice3.5 --headless --convert-to pdf --outdir /tmp <(wget -O - "http://www.mysite.com/demo/lib/m.php?cid=9&controller=detail&task=displayDocument&id=56&x=fc872c033770e3bc8706e6a90bcdff02")
--2012-07-03 14:09:03-- http://www.mysite.com/demo/lib/m.php?cid=9&controller=detail&task=displayDocument&id=56&x=fc872c033770e3bc8706e6a90bcdff02
Resolving www.mysite.com... 99.999.999.999
Connecting to www.mysite.com|99.999.999.999|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 29696 (29K) [application/msword]
Saving to: `STDOUT'
0K .......... .......... ......... 100% 14.2M=0.002s
2012-07-03 14:09:03 (14.2 MB/s) - `-' saved [29696/29696]
EDIT – RESPONSE TO rekire’s first solution
> wget http://www.mysite.com/demo/lib/m.php?cid=9&controller=detail&task=displayDocument&id=56&x=fc872c033770e3bc8706e6a90bcdff02 --no-check-certificate -O /tmp/file.docx
--2012-07-03 14:34:12-- http://www.mysite.com/demo/lib/m.php?cid=9
Resolving www.mysite.com... bash: --no-check-certificate: command not found
99.999.999.999
Connecting to www.mysite.com|99.999.999.999|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1236 (1.2K) [text/html]
Saving to: `m.php?cid=9.8'
0K . 100% 42.1M=0s
2012-07-03 14:34:12 (42.1 MB/s) - `m.php?cid=9.8' saved [1236/1236]
> libreoffice3.5 --headless --convert-to pdf --outdir /tmp /tmp/file.docx
EDIT – RESPONSE TO rekire’s second solution
> TMPFILE=`mktemp -u`
> wget http://www.mysite.com/demo/lib/m.php?cid=9&controller=detail&task=displayDocument&id=56&x=fc872c033770e3bc8706e6a90bcdff02 --no-check-certificate -O $TMPFILE
--2012-07-03 14:24:09-- http://www.mysite.com/demo/lib/m.php?cid=9
Resolving www.mysite.com... bash: --no-check-certificate: command not found
99.999.999.999
Connecting to www.mysite.com|99.999.999.999|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1236 (1.2K) [text/html]
Saving to: `m.php?cid=9.5'
0K . 100% 42.1M=0s
2012-07-03 14:24:09 (42.1 MB/s) - `m.php?cid=9.5' saved [1236/1236]
> libreoffice3.5 --headless --convert-to pdf --outdir /tmp $TMPFILE
Based on your command this two lines should work:
Or like zebediah49 said with a unique filename:
Please note: The outfile will be overwritten in every run so you should use also unique names for the output file.