Free Support Forum - aspose.com

Set barcode data not working

I'm created an editable PDF using Adobe LiveCycle 8. There's one barcode field in it. When I set the barcode data using the method "fillBarcodeField" method, the barcode data will not change. It retains the default value that I set in LiveCyle. If I don't call the method "allFlatten", the barcode data will change but PDF is editable.

Hi Cesar,

Please share the PDF file you're having problem with. We'll test it at our end and will let you know about the results.

We're sorry for the inconvenience.

Regards,

Attached is the PDF file that I'm working with. The barcode field is where I'm setting the data.

Thank you.

Dear Cesar,

Thanks for considering Aspose.Pdf.Kit.

I am sorry that the problem has not been reproduced at my end. It just worked, and the code is as follows:

Form form = new Form(path + "MPCIPolicyJacket.pdf", path + "MPCIPolicyJacket.out.pdf");
form.fillBarcodeField("barcode", "1234567890");
/*If you want to make it uneditable, please include this line: */
//form.partialFlatten("prodline1");
form.close();

If you still have any problem, please feel free to contact us.

Best regards.

If you include the line “form.partialFlatten(“prodline1”)” the barcode will not set correctly. In my case, the data was not converted to a barcode. Anytime you call the method “partialFlatten” or “allFlatten”, the data is not converted to a barcode.

Dear Cesar,

I am sorry that I gave you the wrong field name in partialFlatten() function, which should be 'barcode'. Please try the following code:

Form form = new Form(path + "MPCIPolicyJacket.pdf", path + "MPCIPolicyJacket.out.pdf");
form.fillBarcodeField("barcode", "1234567890");
/*If you want to make it uneditable, please include this line: */
//form.partialFlatten("barcode");
form.close();

Anyway, the problem you found revealed another problem: when a barcode field is flattened with another normal field at the same time, the barcode flattening will fail. This problem has been recorded for further investigation. Before it solved, if you want to flatten many fields, please use this workaround: flatten non-barcode fields with one Form instance, close the instance, and then new another Form instance for barcode flatten specially.

Form form1 = new Form("input.pdf", "temp.pdf");
form1.setField("some non-barcode field name", "some value");
form1.partialFlatten("some non-barcode field name");
form1.close();

Form form2 = new Form("temp.pdf", "output.pdf");
form2.fillBarcodeField("barcode", "1234567890");
form2.partialFlatten("barcode");
form2.close();

If you do not want a temp file, you can use a stream in stead. If you still have any question, please feel free to tell us.

Sorry for the inconvenience & Best regards.

The issues you have found earlier (filed as 8987) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.