feat: 历史文件格式转为pdf

This commit is contained in:
han0
2025-01-15 09:16:11 +08:00
parent 77d0ff37a8
commit 7305f10fb5
6 changed files with 139 additions and 21 deletions

View File

@@ -0,0 +1,26 @@
package mjkf.xinke;
import cn.hutool.core.io.FileUtil;
import mjkf.xinke.main.service.PdfService;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.annotation.Resource;
import java.io.File;
@SpringBootTest(classes = Application.class)
@RunWith(SpringJUnit4ClassRunner.class)
public class PdfTest {
@Resource
PdfService pdfService;
@org.junit.Test
public void test() throws Exception {
var inputStream = pdfService.convertFilePdf(new File("C:\\Users\\Administrator\\Documents\\%E5%8E%86%E5%8F%B2%E6%96%87%E4%BB%B6.xlsx"));
FileUtil.writeFromStream(inputStream, new File("test.pdf"));
}
}