挫折後我終於解決了我的問題的時間的一種方式。 我發現在這個環節解決版本簽名: https://groups.google.com/forum/#!msg/flying-saucer-users/5yXdrIpNnSs/YwY-oETKXD8J
你只需要使用包含getCharBBox(I)[我方法iText的版本。 你也可以使用itext5 XML Worker或者itext7 pdfHTML來完成你的html到pdf的轉換。
由於布魯諾Lowagie建議,但對於我的情況我使用docx4j將xhtml轉換爲docx,我真的需要渲染器需要的itext版本。 Itext-2.1.x和飛碟9.0.2解決了我的問題。這兩個版本的趨勢https://groups.google.com/forum/#!msg/flying-saucer-users/5yXdrIpNnSs/YwY-oETKXD8J指定的趨勢是相互兼容的:
我確實仔細檢查了9.0.2的發佈版本是否使用iText 2.1.x的正確簽名(請參見下文)。
皮特
private void setMetricDefaults(); 簽名:()V 代碼: 0:aload_0 1:ldc#12; // float -50.0f 3:putfield#8; // Field _underlinePosition:F 6:aload_0 7:ldc#13; // float 50.0f 9:putfield#9; // Field _underlineThickness:F 12:aload_0 13:getfield#4; // Field _font:Lcom/lowagie/text/pdf/BaseFont; 16:bipush 120 18:invokevirtual#14; //方法com/lowagie/text/pdf/BaseFont.getCharBBox:(I)[I
希望這可以幫助遇到同樣問題的其他人。
你需要的方法死於老年。 –
更嚴重的一點是:什麼阻止您使用[XML Worker](http://developers.itextpdf.com/faq/category/parsing-xml-and-xhtml)(iText 5)或[pdfHTML](http ://itextpdf.com/itext7/pdfHTML)(iText 7)? –
我已經下載了itext 5.但我仍然想修復docx4j lib用於獲取docx輸出的錯誤。請如果theres出這個錯誤的方式請告訴我。我真的失去了這個錯誤 –