Free Support Forum - aspose.com

Keep Fields Unique issues

Hello,

I have encountered a problem when concatenating two pdf files together with the keep fields unique option set to false.

I have attached multiple files of the original document and the results along with screen shots so you can see exactally what I am describing.

After concatenating the original.pdf with a copy of itself and setting keep fields unique to false, fields with the comb of characters option set no longer enter correctly as seen in the unique_false.pdf and unique_false.png.

When doing the same thing with keep fields unique set to true, the field works properly as seen in the unique_true.pdf and unique_true.png.

Also, I noticed one other issue that you can see between the two images. The purple bar for highlighting fillable fields does not show in the file where keep fields unique is set to false.

This is the code i am using to concatenate the files:

Aspose.Pdf.Facades.PdfFileEditor editor = new Aspose.Pdf.Facades.PdfFileEditor();
editor.KeepFieldsUnique = false;
editor.Concatenate("c:\\temp\\original.pdf", "c:\\temp\\original2.pdf", "c:\\temp\\result.pdf");Aspose.Pdf.Facades.PdfFileEditor editor = new Aspose.Pdf.Facades.PdfFileEditor();
editor.KeepFieldsUnique = false;
editor.Concatenate("c:\\temp\\original.pdf", "c:\\temp\\original2.pdf", "c:\\temp\\result.pdf");

Thank You

Hello again,

I have come up with a workaround that I wanted to share in case anyone else runs into this problem while it is being looked into.

I have found that if I set the unique suffix property during the merge to something which I could use as a stopping point, I can search all of the fields in the form during a fill field command and then update only the ones I would have been able to with the keep unique option set to false.

This is the code I came up with:

Aspose.Pdf.Facades.PdfFileEditor editor = new Aspose.Pdf.Facades.PdfFileEditor();
editor.KeepFieldsUnique = true;
editor.UniqueSuffix = "_PurpleMonkey_%NUM%";
editor.Concatenate("c:\\temp\\original.pdf", "c:\\temp\\original2.pdf", "c:\\temp\\temp.pdf");

string field = "EIN3-9";
string value = "1234567";

Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form();
form.BindPdf("c:\\temp\\temp.pdf");
String[] allfields = form.FieldNames;

foreach (string s in allfields)
{
string realName = s.Contains("_PurpleMonkey_") ? s.Remove(s.IndexOf("_PurpleMonkey_")) : s;

if (realName == field)
form.FillField(s, value);
}

form.Save("c:\\temp\\result.pdf");

As long as there is not a field with the same name as the unique suffix, this workaround works well enough.

Hi Brandon,


Thanks for using our products.

When concatenating PDF form containing similar field names, its recommended to provide value against UniqueSuffix property and I am glad to hear that your problem has been resolved. Please continue using our products and in case you still face the same issue or you have any further query, please feel free to contact.

Hi Brandon,


In addition to Nayyer reply, We have managed
to reproduce the issue at our end and logged it as
PDFNEWNET-34918 in our issue tracking system for further
investigation and resolution. We will keep you updated regarding issue status
via this thread.


Sorry for the inconvenience faced.


Best Regards,

The issues you have found earlier (filed as PDFNEWNET-34918) have been fixed in Aspose.Pdf for .NET 7.8.0update.


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

Thank you for the update. However, only one of the two problems was corrected in the latest release. The problem with the 'Highlight Existing Fields' bar not showing in adobe reader after setting KeepFieldsUnique to false still does not work. It displays just fine when KeepFieldsUnique is set to true.

The image I included shows how the document opens when the property is set to true (left) and when it is set to false (right).

Thank You.

Hi Brandon,


Thanks for your feedback. As per my observation, both documents with or without ‘Highlight Existing Fields’ are fill-able and fields are already highlighted. And furthermore, Adobe Acrobat concatenates documents without subjected bar. For further investigation and understanding, could you please share some more details about ‘Highlight Existing Fields’ functionality/requirement? So we check it at our end and provide you more information.

Sorry for the inconvenience faced.

Best Regards,

I have managed to find what the problem is. Even though the 'Highlight Fields' bar does not appear after the files are merged using the 'KeepFieldsUnique = false' setting, there is a setting in acrobat that can be applied by javascript through the page open to automatically turn on the highlights. I have also found where that setting is in acrobat itself.

The issue was only a problem in older versions of acrobat (6 & 7), where the default to highlight fields is set to off and without the bar it was hard for users to figure out how to highlight the fillable fields.

This is how I added it to the document just incase someone has it turned off in acrobat:

Aspose.Pdf.Document doc = new Aspose.Pdf.Document("c:\\temp\\temp.pdf");
doc.Pages[1].Actions.OnOpen = new Aspose.Pdf.InteractiveFeatures.JavascriptAction("app.runtimeHighlight = true");
doc.Save("c:\\temp\\temp2.pdf");

If you have a better way to add this to the document please let me know, otherwise, I am fine with this solution.

Thanks.

Hi Brandon,


Thanks for your feedback. Its good to know that you have managed to get your desired results and also thanks for sharing the solution definitely it would help other community members, looking for similar functionality.

Please fee free to contact us for any further assistance.

Best Regards,