Skip to content

Commit

Permalink
修复了热门文档预览图无法显示的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarrettluo committed Apr 1, 2023
1 parent f5e4aa6 commit 4ccc93e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ FROM openjdk:8-jre-alpine
# 指定维护者的名字
MAINTAINER luojiarui [email protected]

# 在docker中添加fontconfig 和 字体
# 该过程比较慢,可以参考https://lhalcyon.com/alpine-font-issue/
ENV LANG en_US.UTF-8RUN apk add --update ttf-dejavu fontconfig && rm -rf /var/cache/apk/*


# 将当前目录下的jar包复制到docker容器的/目录下
ADD ./target/document-sharing-site-1.0-SNAPSHOT.jar /app.jar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public BaseApiResult getHotTrend() {
top1.put("commentNum", documentVO.getCommentNum());
top1.put("collectNum", documentVO.getCollectNum());
top1.put("likeNum", (int) Math.round(redisService.score(RedisServiceImpl.DOC_KEY, topFileDocument.getId())));
top1.put("thumbId", documentVO.getThumbId());
top1.put("thumbId", topFileDocument.getThumbId());


List<Object> others = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected void makePreviewFile(InputStream inStream, TaskData taskData) {
try {
OutputStream outStream = getOutFileStream(taskData.getPreviewFilePath());
boolean shouldShowMessages = true;
Converter converter = new PptxToPDFConverter(inStream, outStream, shouldShowMessages,
Converter converter = new PptxToPDFConverter(inStream, outStream, true,
true);
converter.convert();
} catch (Exception e) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/jiaruiblog/util/poi/MainClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
public class MainClass {

public static void main(String[] args) throws Exception {

String inPath = "/Users/molly/Downloads/《如何与领导达成共识》-孙淑静.pptx";
// 中文文件依赖 linux 必须有字体包 https://blog.csdn.net/Darling_qi/article/details/120485688
String inPath = "/Users/molly/Downloads/2022年共青团“学习二十大、永远跟党走、奋进新征程”专题组织生活会.pptx";
String outPath = "/Users/molly/Downloads/1x44x6.pdf";
InputStream inStream = getInFileStream(inPath);
OutputStream outStream = getOutFileStream(outPath);
Expand Down

0 comments on commit 4ccc93e

Please sign in to comment.