You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package main
import (
"encoding/base64"
"fmt"
"io/ioutil"
"net/http"
)
/**
功能:显示预览
作者:黄海
时间:2020-07-15
*/
func showPreview(input string){
uEnc := base64.URLEncoding.EncodeToString([]byte(input))
//生成预览OFFICE的服务地址
url := "http://10.10.24.100:9000/support/preview/previewOffice"
resp, _ := http.Get(url+"?p="+uEnc)
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
func main() {
//(1)传入本地文件路径
// 如果要用在url中需要使用URLEncoding
//input:="C:\\Users\\Administrator\\Desktop\\技术讨论会\\20A4782A-512C-40ED-8AF9-FCFC7CD29E5B.docx"
//showPreview(input)
//2传入http参数
//input="https://dsideal.obs.cn-north-1.myhuaweicloud.com/Material/02/0200C9BE-07C6-4EFC-A945-8554C7D41790.doc"
//showPreview(input)
//input:=`E:\Work\ShlProjectJava\src\main\java\com\shl\zuowen\model\zuowenModel.java`
//showPreview(input)
//Java的调用方法示例
//https://blog.csdn.net/orangleliu/article/details/38309367
}