2

テキストフィールドとチェックボックスを含むXHTMLファイルがあります。ITextRendererを使用してxhtmlをpdfに変換しようとしているとき。iTextはフォームフィールド(PDFのチェックボックスやテキストボックスなど)を削除しています。

私のコードは見えます

ITextRenderer renderer = new ITextRenderer ();
renderer.setDocument(new File("input.xhtml").toURI().toURL.toString());
renderer.layout();
renderer.createPDF("outputstream");

iTextを使用して上記のシナリオを処理するためのサンプルコードスニペットを提供できる人はいますか。iText5.1.3バージョンを使用しています。

私のXHTMLは次のようになります

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title>FULL</title>
      <style media="screen" type="text/css">
                    fieldset table { width:98%;border: 1px groove; margin:0 auto; }
                    fieldset table  tr { border: 1px groove; }
                    fieldset table  th { border: 1px groove; }
                    fieldset table  td { border: 1px groove; }
                    fieldset &gt; table [id=inspectionStatus] thead {border: 1px groove;background:#446BEC;text-align:center;}
                    fieldset &gt; table [id=inspectionStatus]  tr { border: 1px groove; }
                    fieldset &gt; table [id=inspectionStatus]  th { border: 1px groove; }
                    fieldset &gt; table [id=inspectionStatus]  td { border: 1px groove; }
                    fieldset table thead {border: 1px groove;background:#446BEC;text-align:center;}
                    fieldset table tbody tr th {text-align:left;background:#C6DEFF;width:28%}
                    fieldset table tbody tr td {text-align:center} [type=text] {margin-left:5%;} *[type=text]{width:90%;} 
                    fieldset table tbody tr td [type=checkbox] {margin:0 auto;} *[type=checkbox]{width:90%;} 
                    fieldset table caption {font-weight:bold;color:#0840F8;}
                    fieldset {width:98%;font-weight:bold;border:1px solid #446BEC;}
                </style>
   </head>
   <body>
     <fieldset id="PersonTable">
         <legend>Person Information</legend>
         <table id="PersonDisplay">
            <thead>
               <tr>
                  <th>Identifier</th>
                  <th>Name</th>
                  <th>Comment</th>
                  <th>Pass</th>
                  <th>Fail</th>
               </tr>
            </thead>
            <tbody>
               <tr>
                  <td>1234</td>
                  <td> William Jones</td>
                  <td>
                     <input type="text"/>
                  </td>
                  <td>
                     <input type="checkbox"/>
                  </td>
                  <td>
                     <input type="checkbox"/>
                  </td>
               </tr>
            </tbody>
         </table>
      </fieldset>
   </body>
</html>
4

1 に答える 1