2017-12-08 1 views
0

내 응용 프로그램에서 JODConverter를 사용하여 기본 CSS 2가있는 HTML 파일을 PDF 파일로 변환합니다.OpenOffice HTML 및 CSS : JODConverter

파일을 변환하면 PDF가 엉망입니다. 오픈 오피스에서 직접 보려고하면 엉망이됩니다.

이 생성 된 파일입니다

enter image description here

는 이것은 내 크롬 브라우저에서 무슨이다 :

enter image description here

당신은 큰 차이가있다시피.

내 코드입니다 :

<div style="padding : 5% 25% 0% 10%; diplay : inline-block; "> 
    <div> 
    <span style="color : green; float : left; "><b>MyCompany - MyConsultant</b></span> 
    <hr style="width : 100%; border-top: dotted 1px; " /> 
    </div> 
    <div> 
    <div> 
     <div style="float : left;">Number of days</div> 
     <div style="float : right ">20,5</div> 
     <hr style="width : 100%; border-top: dotted 1px; " /> 
    </div> 
    <div> 
     <div style="float : left ">Your number</div> 
     <div style="float : right ">520,00€</div> 
     <hr style="width : 100%; border-top: dotted 1px; " /> 
    </div> 
    <div> 
     <div style="float : left ">Total HT</div> 
     <div style="float : right ">10 660,00€</div> 
     <hr style="width : 100%; border-top: dotted 1px; " /> 
    </div> 
    <div> 
     <div style="float : left ">TVA [20%]</div> 
     <div style="float : right ">2 132,00€</div> 
    </div> 
    <div> 
     <hr style="width : 100%; border-top: dotted 3px;font-weight : bold;" /> 
     <div style="float : left;font-weight : bold;">TOTAL TTC</div> 
     <div style="float : right;font-weight : bold;">12 792,00€</div> 
    </div> 
    </div> 

그리고 사람이, 그때 :) 원하는 다른 해결책, 들으

+0

어떤 운영 체제입니까? 완성을 위해 LibreOffice 나 Apache OpenOffice의 버전을 언급하십시오. –

답변

0

LibreOffice와/아파치 오픈 오피스 좋은 응용 프로그램입니다,하지만이 경우에는 그렇지를 가지고있는 경우 직업에 적합한 도구. HTML을보다 효과적으로 렌더링하는 많은 응용 프로그램이 있습니다.

나를 위해 일한이 https://superuser.com/questions/592974/how-to-print-to-save-as-pdf-from-a-command-line-with-chrome-or-chromium에서 적응.

./chrome.exe --headless --disable-gpu --print-to-pdf=file1.pdf http://www.example.com/ 

편집 :

자바에서이 전화를 걸려면 How to execute system commands (linux/bsd) using Java를 참조하십시오.

+0

그래,하지만 그걸 자바에서 구현해야합니까? –

+0

@Moatez Bouhdid : 편집 된 답변 참조. –