일괄 html 파일을 pdf로 변환하는 중 변환에 실패했습니다. 오류가 발생했습니다. 동일한 HTML 파일의 경우 때때로 작동합니다. 주로 더 많은 파일이있을 때마다 하나 또는 두 개의 파일이 실패합니다.PDFTron - HTML2PDF - 작업 파일 찾기가 실패했습니다.
PdfTron 버전 9 월 2016 환경 : 리눅스,이 문서 이어 자바 8
, https://www.pdftron.com/pdfnet/samplecode/HTML2PDFTest.java.html
String inputHtml = "/myfolder/output.html";
String outputPdf = "/myfolder/output.pdf";
PDFNet.initialize();
PDFDoc doc = new PDFDoc();
HTML2PDF converter = new HTML2PDF();
converter.setLandscape(false);
converter.setPaperSize(9);
converter.insertFromHtmlString(new String(Files.readAllBytes(Paths.get(inputHtml))));
if (converter.convert(doc)) {
doc.initSecurityHandler();
doc.save(outputPdf, SDFDoc.e_linearized, null);
} else {
log.error("Conversion failed. HTTP Code: " + converter.getHTTPErrorCode() + "\n" + converter.getLog());
}
출력
Conversion failed. HTTP Code: 0
Loading pages (1/6)
[> ] 0%
[======> ] 10%
[=================> ] 29%
[===================> ] 33%
[=====================> ] 36%
[============================================================] 100%
Counting pages (2/6)
[============================================================] Object 1 of 1
Resolving links (4/6)
[============================================================] Object 1 of 1
Loading headers and footers (5/6)
Printing pages (6/6)
[> ] Preparing
[==============================> ] Page 1 of 2
[============================================================] Page 2 of 2
Done
Post Process Error: Operation file seek failed
StdFile.cpp:478
DataWrite
경로 '\ myfolder \ output.pdf'에서 파일을 다시 쓰고 있습니까? –
@FahadSiddiqui, 아니요. 예를 들어 /myfolder/output.pdf가 아닙니다. 매번 고유 ID를 사용하여 새 파일 이름을 사용 중입니다. – Sheel