We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

XFA PDF drop-down selection and open/save

Dear Aspose supporter:

I need to select value from a drop-down list and fill in text fields in XFA pdf file by C#
The pdf file is attached.

I download the trial version for VS2010 and made a simple test.
// Load XFA form
Aspose.Pdf.Document doc = new Aspose.Pdf.Document("Test.pdf");
doc.Save("New.pdf");

Issue #1)
I opened the existing XFA PDF and save it to "New.pdf"
It seems the "New.pdf" is different with "Test.pdf"

Issue #2)
There is a drop-down selection in the "Test.pdf"
How can I select a different value.

I am sure I will purchase your Aspose.pdf .net if above works well.
Thanks in advance,



Hi Jack,

lidecao:
Dear Aspose supporter:

I need to select value from a drop-down list and fill in text fields in XFA pdf file by C#
The pdf file is attached.

I download the trial version for VS2010 and made a simple test.
// Load XFA form
Aspose.Pdf.Document doc = new Aspose.Pdf.Document("Test.pdf");
doc.Save("New.pdf");

Issue #1)
I opened the existing XFA PDF and save it to "New.pdf"
It seems the "New.pdf" is different with "Test.pdf"



Thanks for your considering Aspose. Aspose.Pdf evaluation version has two limitations, evaluation watermark and at most four elements of any collection can be viewed. Please make a request for 30 days temporary license to evaluate our product without any limitation. it will resolve your first issue


We are looking into your other issue and will update you soon..

Best Regards,

lidecao:

I need to select value from a drop-down list and fill in text fields in XFA pdf file by C#
The pdf file is attached.

I download the trial version for VS2010 and made a simple test.
// Load XFA form
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(“Test.pdf”);
doc.Save(“New.pdf”);

Issue #1)
I opened the existing XFA PDF and save it to "New.pdf"
It seems the “New.pdf” is different with "Test.pdf"
Hi Jack,

Thanks for your interest in our API’s.

I have tested the scenario using latest release of Aspose.Pdf for .NET 11.4.0 and I am unable to notice any issue. As per my observations, the PDF file is properly being generated. However I have noticed that Extended Rights Feature of source file is removed once saved with Aspose.Pdf for .NET. Can you please share some details regarding the issue which you are facing, so that we can test the scenario accordingly. We are sorry for your inconvenience.

Hi Nayyer Shahbaz, thanks for your feedback.


For my issue #1) It is still there. After saving to a new PDF file,
The drop-down becomes un-selectable and all the editable fields become non-editable.

For my issue #2) I am asking how can I use your APIs to select the drop-down in the Test.PDF, hope you would answer my question.



lidecao:
Hi Nayyer Shahbaz, thanks for your feedback.

For my issue #1) It is still there. After saving to a new PDF file,
The drop-down becomes un-selectable and all the editable fields become non-editable.
Hi Jack,

Thanks for sharing the details.

When opening a Dynamic XFA form with our API and then re-saving it, the extended rights feature is lost and form fields become non-editable. However in order to preserve extended rights, please try using incremental approach as specified below.

[C#]

//
load existing file
<o:p></o:p>

var pdfDoc = new Aspose.Pdf.Document(new FileStream("c:/pdftest/Test (1) - Copy.PDF", FileMode.OpenOrCreate));

// print page count

Console.WriteLine(pdfDoc.Pages.Count);

// save PDF file to existing loaded instance

pdfDoc.Save();

lidecao:

For my issue #2) I am asking how can I use your APIs to select the drop-down in the Test.PDF, hope you would answer my question.
Hi Jack,

In order to accomplish above stated requirement, please try following the instructions specified over Working with XFA Forms. In case you encounter any issue, please share the complete name of dropdown field for which you need to update the value, so that we can further look into this matter. We are sorry for this inconvenience.

Hi Nayyer Shahbaz,


Thanks for your excellent support and the issue #1) is solved.
Now I can set values to XFA text fields but I still cannot select the drop-down.
Following is my C# codes:
// load existing file
var doc = new Aspose.Pdf.Document(new FileStream(“c:/#PDF/Test.pdf”, FileMode.OpenOrCreate));
string[] names = doc.Form.XFA.FieldNames;

// go through all XFA fieldNames
foreach (string s in names)
{
string ss = doc.Form.XFA[s];
}
// fill in field names
string sVendorContact =“data[0].logo[0].Office_adr[0].conditions[0].Vendor_Contact[0]”;
string sConfirmationNumber = “data[0].logo[0].Office_adr[0].conditions[0].Conf_no[0]”;
string sStartDate =“data[0].logo[0].Office_adr[0].conditions[0].install_date[0]”;
string sEndDate =“data[0].logo[0].Office_adr[0].conditions[0].end_date[0]”;
string sStatusDD = “data[0].logo[0].Office_adr[0].status_dd[0].STATUS[0]”;

// set field data
doc.Form.XFA[sVendorContact] = “Lide Cao”;
doc.Form.XFA[sConfirmationNumber] = “4167230947”;
doc.Form.XFA[sStartDate] = “9/12/2016”;
doc.Form.XFA[sEndDate] = “9/13/2016”;
doc.Save();

When I go through the XFA fieldNames, I could not find the drop-down name.
I think it is “data[0].logo[0].Office_adr[0].status_dd[0].STATUS[0]”, but I have no idea how to select it.

Could you have a look to help me solve the drop-down select issue?
Jack Cao

Hi Jack Cao,


Thanks for the acknowledgement.


I have tested the scenario and I I am getting an exception while trying to select dropdown value. For the sake of correction, I have logged it as PDFNEWNET-40520 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.