Skip to content

Commit

Permalink
Update environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Youthhing committed Sep 6, 2024
1 parent 215234f commit 02fe2a3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main/java/team/flight/backend/service/PdfService.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ public File generatePdfFromHtml(String htmlContent, String outputPdfPath) throws
try (OutputStream outputStream = new FileOutputStream(htmlFile)) {
outputStream.write(htmlContent.getBytes());
}
String wkhtmltopdfPath = "/usr/bin/wkhtmltopdf";
// wkhtmltopdf 명령어 실행 (html 파일 -> pdf 파일로 변환)
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command(wkhtmltopdfPath,
"--page-width", "1920px",
"--page-height", "1080px",
htmlFile.getAbsolutePath(),
outputPdfPath);
processBuilder.command("/usr/bin/wkhtmltopdf", "--page-width", "1600px", "--page-height", "900px",
htmlFile.getAbsolutePath(), outputPdfPath);

// 환경 변수 설정 (필요한 경우)
processBuilder.environment().put("PATH", "/usr/bin:/bin:/usr/sbin:/sbin");

Process process = processBuilder.start();
int exitCode = process.waitFor();
Expand Down

0 comments on commit 02fe2a3

Please sign in to comment.