当前位置: 首页 > wzjs >正文

国外h5建站网络营销方案

国外h5建站,网络营销方案,html5中文网站欣赏,青岛建设网站的公司一、前置条件 1.1 创建accessKey 如何申请:https://help.aliyun.com/zh/ram/user-guide/create-an-accesskey-pair 1.2 开通服务 官方地址:https://docmind.console.aliyun.com/doc-overview 未开通服务时需要点击开通按钮,然后才能调用…

一、前置条件

1.1 创建accessKey

如何申请:https://help.aliyun.com/zh/ram/user-guide/create-an-accesskey-pair

1.2 开通服务

官方地址:https://docmind.console.aliyun.com/doc-overview

未开通服务时需要点击开通按钮,然后才能调用相关api。
在这里插入图片描述

二、代码实现

2.1 引入依赖

<dependency><groupId>com.aliyun</groupId><artifactId>tea-openapi</artifactId><version>0.2.5</version>
</dependency>
<dependency><groupId>com.aliyun</groupId><artifactId>docmind_api20220711</artifactId><version>2.0.3</version>
</dependency>
<dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>2.0.50</version>
</dependency>

2.2 pdf转换word

官方文档:https://help.aliyun.com/zh/document-mind/developer-reference/convertpdftoword

package net.lab1024.sa.admin.util;import com.aliyun.docmind_api20220711.models.*;
import com.aliyun.teaopenapi.models.Config;
import com.aliyun.docmind_api20220711.Client;
import com.aliyun.teautil.models.RuntimeOptions;import java.io.FileInputStream;
import java.util.List;public class PdfConvertUtil {private static final String OK = "200";private static final String ACCESS_KEY_ID = "xxx";private static final String ACCESS_KEY_SECRET = "xxx";public static void main(String[] args) throws Exception {String id = submitPdfToWord("C:\\Users\\admin\\Desktop\\example.pdf");// 10秒后再查询结果,等阿里云处理一会儿Thread.sleep(10000);List<GetDocumentConvertResultResponseBody.GetDocumentConvertResultResponseBodyData> data = queryPdfToWord(id);}/*** 客户端** @return* @throws Exception*/private static Client getClient() throws Exception {Config config = new Config();config.setAccessKeyId(ACCESS_KEY_ID);config.setAccessKeySecret(ACCESS_KEY_SECRET);// 访问的域名,支持ipv4和ipv6两种方式,ipv6请使用docmind-api-dualstack.cn-hangzhou.aliyuncs.comconfig.setEndpoint("docmind-api.cn-hangzhou.aliyuncs.com");return new Client(config);}/*** 提交pdf转换word转换任务** @return* @throws Exception*/public static String submitPdfToWord(String filePath) throws Exception {Client client = getClient();// 请求参数SubmitConvertPdfToWordJobAdvanceRequest advanceRequest = new SubmitConvertPdfToWordJobAdvanceRequest();advanceRequest.setFileUrlObject(new FileInputStream(filePath));advanceRequest.setFileName("example.pdf");// 运行参数RuntimeOptions runtime = new RuntimeOptions();// 发送请求SubmitConvertPdfToWordJobResponse response = client.submitConvertPdfToWordJobAdvance(advanceRequest, runtime);// 处理结果SubmitConvertPdfToWordJobResponseBody body = response.getBody();if (!OK.equals(body.getCode())) {throw new RuntimeException("pdf转换word任务提交失败");}return body.getData().getId();}/*** 查询pdf转换word转换任务** @param id* @return* @throws Exception*/public static List<GetDocumentConvertResultResponseBody.GetDocumentConvertResultResponseBodyData> queryPdfToWord(String id) throws Exception {Client client = getClient();// 请求参数GetDocumentConvertResultRequest resultRequest = new GetDocumentConvertResultRequest();resultRequest.setId(id);// todo 这里是简单处理 需要轮询120分钟,10秒一次GetDocumentConvertResultResponse response = client.getDocumentConvertResult(resultRequest);GetDocumentConvertResultResponseBody body = response.getBody();if (!OK.equals(body.getCode())) {throw new RuntimeException("pdf转换word任务查询失败");}Boolean completed = body.getCompleted();if (!completed) {throw new RuntimeException("pdf转换word任务未完成");}String status = body.getStatus();if (!"Success".equals(status)) {throw new RuntimeException("pdf转换word任务转换失败");}return body.getData();}}

2.3 pdf转换excel

官方文档:https://help.aliyun.com/zh/document-mind/developer-reference/convertpdftoexcel

package net.lab1024.sa.admin.util;import com.aliyun.docmind_api20220711.models.*;
import com.aliyun.teaopenapi.models.Config;
import com.aliyun.docmind_api20220711.Client;
import com.aliyun.teautil.models.RuntimeOptions;import java.io.FileInputStream;
import java.util.List;public class PdfConvertUtil {private static final String OK = "200";private static final String ACCESS_KEY_ID = "xxx";private static final String ACCESS_KEY_SECRET = "xxx";public static void main(String[] args) throws Exception {String id = submitPdfToExcel("C:\\Users\\admin\\Desktop\\example.pdf");// 10秒后再查询结果,等阿里云处理一会儿Thread.sleep(10000);List<GetDocumentConvertResultResponseBody.GetDocumentConvertResultResponseBodyData> data = queryPdfToExcel(id);}/*** 客户端** @return* @throws Exception*/private static Client getClient() throws Exception {Config config = new Config();config.setAccessKeyId(ACCESS_KEY_ID);config.setAccessKeySecret(ACCESS_KEY_SECRET);// 访问的域名,支持ipv4和ipv6两种方式,ipv6请使用docmind-api-dualstack.cn-hangzhou.aliyuncs.comconfig.setEndpoint("docmind-api.cn-hangzhou.aliyuncs.com");return new Client(config);}/*** 提交pdf转换excel转换任务* @return* @throws Exception*/public static String submitPdfToExcel(String filePath) throws Exception {Client client = getClient();// 请求参数SubmitConvertPdfToExcelJobAdvanceRequest advanceRequest = new SubmitConvertPdfToExcelJobAdvanceRequest();advanceRequest.setFileUrlObject(new FileInputStream(filePath));advanceRequest.setFileName("example.pdf");// 合并为1个sheetadvanceRequest.setForceMergeExcel(true);// 运行参数RuntimeOptions runtime = new RuntimeOptions();// 发送请求SubmitConvertPdfToExcelJobResponse response = client.submitConvertPdfToExcelJobAdvance(advanceRequest, runtime);// 处理结果SubmitConvertPdfToExcelJobResponseBody body = response.getBody();if (!OK.equals(body.getCode())) {throw new RuntimeException("pdf转换excel任务提交失败");}return body.getData().getId();}/*** 查询pdf转换excel转换任务* @param id* @return* @throws Exception*/public static List<GetDocumentConvertResultResponseBody.GetDocumentConvertResultResponseBodyData> queryPdfToExcel(String id) throws Exception {Client client = getClient();// 请求参数GetDocumentConvertResultRequest resultRequest = new GetDocumentConvertResultRequest();resultRequest.setId(id);// todo 这里是简单处理 需要轮询120分钟,10秒一次GetDocumentConvertResultResponse response = client.getDocumentConvertResult(resultRequest);GetDocumentConvertResultResponseBody body = response.getBody();if (!OK.equals(body.getCode())) {throw new RuntimeException("pdf转换excel任务查询失败");}Boolean completed = body.getCompleted();if (!completed) {throw new RuntimeException("pdf转换excel任务未完成");}String status = body.getStatus();if (!"Success".equals(status)) {throw new RuntimeException("pdf转换excel任务转换失败");}return body.getData();}}    
http://www.dtcms.com/wzjs/62383.html

相关文章:

  • 装饰工程 技术支持 东莞网站建设品牌网络推广怎么做
  • 买的有域名怎么做网站长沙网站优化
  • python数据分析做网站关键词首页排名优化价格
  • 微信引流推广平台seo服务 文库
  • 佛山网站建设定制黄金网站软件app大全下载
  • 四川网站建设案例单招网企业网站搜索优化网络推广
  • 网站建设分为哪几种营销方案策划
  • 怎么在公众号做影视网站网络营销推广公司
  • 简单的购物网站项目电商网站网址
  • 网站空间空间线上推广渠道有哪些方式
  • 在线客服系统多少钱石家庄seo推广公司
  • 一般网站的宽度是多少像素近期热点新闻事件50个
  • 政元软件做网站自有品牌如何推广
  • 大学生网站建设开题报告网络营销分析报告
  • 网站建设与管理以后工作方向seo效果检测步骤
  • wordpress persona宁波seo整体优化公司
  • 怎么找人做淘宝网站一个万能的营销方案
  • 福州网站建设熊掌号网络推广如何收费
  • 公司网站搜索引擎排名快速优化网站排名的方法
  • 二级域名做非法网站百度网首页
  • 小程序服务器可以做网站吗班级优化大师app下载学生版
  • onlyoffice wordpress安卓aso优化排名
  • 河北邯郸做网站的公司哪家好百度推广关键词优化
  • web开发是做网站吗网络广告营销的典型案例
  • 余姚建设公司网站aso100官网
  • 做网站难度大吗宁波seo自然优化技术
  • 国外一直小猫做图标的网站网络营销主要内容
  • 在网站上做教育直播平台多少钱短视频营销成功的案例
  • 嘉兴 做网站 推广关键词优化公司哪家效果好
  • 网站首页快照网站推广工作