Hi:

I came back with my question but this time with a pdf
file and java sample code:

Save the java code in TestCheckboxesFlattening.java
and save the pdf attachment in the same folder with
the java file, then compile and run the sample. The
ouput pdf file (test_checkbox_output.pdf) doesn't
contain anything. Is this to be expected?

import java.io.*;
import com.lowagie.text.pdf.*;

public class TestCheckboxesFlattening {

  public TestCheckboxesFlattening() {
    super();
  }
  
  public static void main(String[] args)
  {
    PdfReader pdfReader = null;
    FileOutputStream fos = null;
    File pdfTmpFile = null;
    PdfStamper pdfStamper = null;
    try
    {
      pdfTmpFile = new
File("test_checkbox_output.pdf");
      pdfReader = new PdfReader("test_checkbox.pdf");
      fos = new FileOutputStream(pdfTmpFile);
      pdfStamper = new PdfStamper(pdfReader, fos);
      AcroFields form = pdfStamper.getAcroFields();
      form.setField("Check1", "Yes");
      
      pdfStamper.setFormFlattening(true);
      pdfStamper.close();
    }
    catch (Exception ex)
    {
      ex.printStackTrace();
    }
    
  }
}

Thanks

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Attachment: test_checkbox.pdf
Description: 1206717057-test_checkbox.pdf

Reply via email to