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

Free Support Forum - aspose.com

PDF Fields Overlay - Input Not Displayed Properly

Good Morning,

I am having some good luck using your products to
perform the following actions in C#:

1. Convert Word documents to
PDF
2. Copy form fields from different PDF onto the new PDF, saved
as a different file.

The problem I’ve run into is that when I
open the new PDF with the overlayed form fields and type characters in,
all of the characters bunch up in the first space on top of each other after exiting the fields.



Here is the code I’m using for the conversion:



var asposeFile = new Aspose.Words.Document(path,
Aspose.Words.LoadFormat.Docx, string.Empty);

asposeFile.Save(strSavePath, Aspose.Words.SaveFormat.Pdf);



And here is the code I’m using for the overlay:



var formEditor = new Aspose.Pdf.Kit.FormEditor(oldPdfFile, pdfNew);

Aspose.Pdf.Kit.Form pdfForm = new Aspose.Pdf.Kit.Form(pdfBase);



foreach (string fieldName in pdfForm.FieldNames) {

if (pdfForm.GetFieldType(fieldName) !=
Aspose.Pdf.Kit.FieldType.Radio) {

formEditor.CopyOuterField(pdfBase, fieldName);

}

}

pdfForm.Save();

formEditor.Save();



My primary coding source for this has been this post:



I've also attached the original document, converted PDF, base PDF, and the End Result pdf for you.

I am so close to having this automated, if this issue can be corrected I will be done.

Thanks a lot for any help you can give me,

~DJ Quimby

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. As I can see part of proccesing which is related to Aspose.Words works fine. So, I will move this request to Aspose.Pdf.Kit forum. My colleagues will answer you shortly.

Best regards,

Update: I have not been able to rectify the issue of letters jumbling on top of themselves in the form fields, and I noticed that the gentlemen posting in the topic referenced in my initial post also observed the same behavior.

Also, CopyOuterFields is incapable of copying radio buttons, and the documentation indicates this as so. Is there any way to add a radio button via a workaround? I tried the following with no results:

if (pdfForm.GetFieldType(fieldName) != Aspose.Pdf.Kit.FieldType.Radio) {
formEditor.CopyOuterField(pdfBase, fieldName);
}
else {
//get field type
Aspose.Pdf.Kit.FieldType myType = pdfForm.GetFieldType(fieldName);
//get field value
String myValue = pdfForm.GetField(fieldName);
//get field appearance
Aspose.Pdf.Kit.FormFieldFacade myFacade = pdfForm.GetFieldFacade(fieldName);
formEditor.AddField(Aspose.Pdf.Kit.FieldType.Radio,
fieldName, myFacade.PageNumber, myFacade.Box.Left,
myFacade.Box.Bottom, myFacade.Box.Left + myFacade.Box.Width,
myFacade.Box.Bottom + myFacade.Box.Height);
}

When a radio button is found, the ‘else’ block is executed. The AddField method then throws the error “An error has occurred: Need at least one option, please call FormEditor.setOptions(String[]).: v4.9.0.0”. I do not see this member within FormEditor, so I don’t know what the error means or how to resolve it.

Please advise,

~DJ

Hi DJ,

We’re investigating this issue at our end. Please spare us some time and you’ll be updated with the results accordingly.

We’re sorry for the inconvenience.
Regards,

Hi DJ,

I have reproduced the issue of character overlapping and logged it as PDFKITNET-21409 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.

As far as copying the radio fields are concerned, I have logged a new feature request as PDFKITNET-21410 in our issue tracking system. We’ll try to provide the support for it in future and notify you via this thread.

We’re sorry for the inconvenience.
Regards,