Hi all,
We created a PDF form with workbench and designer (version 6.5). After the form is submitted we want to send the pdf read only and flatten to other systems in our company.
I have written following code to flatten the pdf form :
private static OutputClient outClient;
public static void main(String[] args) throws Throwable {
try {
LCConnectionManager.setDefaultEnvironment(Environment.DEPLOY);
outClient = LCConnectionManager.instance().getOutputClient();
if (args.length == 2) {
//Reference an interactive PDF document to transform
FileInputStream fileInputStream = new FileInputStream(args[0]);
Document inPDFDoc = new Document(fileInputStream);
//Transform the PDF document to a non-interactive PDF document
Document transformedDocument = outClient.transformPDF(inPDFDoc, TransformationFormat.PDF, null, null, null);
//Save the non-interactive PDF document
File myFile = new File(args[1]);
transformedDocument.copyToFile(myFile);
}
} catch (Throwable t) {
throw t;
}
}
This works, the form is flatten. But when we hide buttons and fields while filling in the form or just before submitting the form, all the hidden fields and buttons are visible in the flatten pdf. So the method transformPDF of the OutputClient class doesn't see which parts are set to hidden on the submitted form.
Can anyone give some advice on this, which method should I use, are there alternatives ?