以下工作并将转换/tmp/file.docx
为/tmp/file.pdf
.
libreoffice3.5. --headless --convert-to pdf --outdir /tmp /tmp/file.docx
我将如何转换https://www.mysite.com/getfile.php?id=123(这将返回一个 docx 文件)并将其另存为/tmp/file_123.pdf
?我希望它需要 wget、管道和输入/输出重定向。
谢谢
编辑 - 对 zebediah49 帖子的回应
> 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]
编辑 - 对 rekire 的第一个解决方案的回应
> 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
编辑 - 对 rekire 的第二个解决方案的回应
> 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