|
@@ -223,6 +223,13 @@ public class FileUtils {
|
|
|
|
|
|
for(String urlStr : urlList){
|
|
|
try{
|
|
|
+ if (urlStr.indexOf("https") >= 0 && urlStr.indexOf("aliyuncs") >= 0) {
|
|
|
+ int lastIndexOf = urlStr.lastIndexOf("/");
|
|
|
+ String prefix=urlStr.substring(0,lastIndexOf+1);
|
|
|
+ String suffix=urlStr.substring(lastIndexOf+1);
|
|
|
+ urlStr = prefix+ URLEncoder.encode(suffix,"UTF-8");
|
|
|
+ }
|
|
|
+
|
|
|
//获取OSS文件输入流
|
|
|
reader = new PdfReader(CommonUtil.getOSSInputStream(urlStr));
|
|
|
|
|
@@ -500,6 +507,7 @@ public class FileUtils {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* @Description 合并PDF
|
|
|
* @Param [bos:结果存在字节数组, uris:支持 file、http、jar等传输协议]
|
|
@@ -507,7 +515,7 @@ public class FileUtils {
|
|
|
* @Author yangyj
|
|
|
* @Date 2021.10.09 10:49
|
|
|
**/
|
|
|
- public static void PdfCopyPublicMethods(ByteArrayOutputStream bos,List<String> uris){
|
|
|
+ public static void PdfCopyPublicMethods1(ByteArrayOutputStream bos,List<String> uris){
|
|
|
|
|
|
PdfReader reader = null;
|
|
|
Document doc = new Document();
|
|
@@ -547,6 +555,14 @@ public class FileUtils {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ String filePath = "D:\\tmp\\aaa.pdf";
|
|
|
+ FileOutputStream fos = null;
|
|
|
+ fos = new FileOutputStream(filePath);
|
|
|
+ //bos.reset();
|
|
|
+ fos.write(bos.toByteArray()); // 将数据写入到指定文件路径中
|
|
|
+ //bos.flush();
|
|
|
+ //bos.close();
|
|
|
+ System.out.println();
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
} finally {
|
|
@@ -557,6 +573,8 @@ public class FileUtils {
|
|
|
doc.close();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|