Hi, I added some form fields in a word document and also I convert the word doc to pdf in the end, now I want to know how I can set the cursor position inside the form field to be always on the left. Now the cursor position is where I click the first time inside the form field. I also i want to know if I can set an empty form field but with a fixed length. Thanks!
Unfortunately, your question is not clear enough therefore we request you to please elaborate your inquiry further by providing complete details of your usecase.
Is this possible by using MS Word? If yes, then please list complete steps you have performed in Microsoft Word to generate your expected PDF document here for our reference. Also, please ZIP and attach your simplified Word document and MS Word generated DOCX/PDF file here for testing. We will then investigate this scenario on our end and provide you more information.
Hi again, so what I do is that, I create a word doc and I add in that doc some form fields like this:
builder.InsertTextInput(“Form field”, TextFormFieldType.Regular, “Form field”, " ", 0);
In the end I’m converting the word doc to pdf.
The form fields are ok, but when I want to fill the form fields with a value and I click in the form field box, the cursor is where I put the mouse cursor and I want to be in the left.
form field.jpg (23.9 KB)
We have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-17666. We will further look into the details of this requirement and will keep you updated on the status of the linked issue.
Regarding WORDSNET-17666, we have completed the work on your issue and concluded to close this issue as ‘Not a Bug’. Please see the following analysis details:
Currently it is not possible to create empty AcroForm field with fixed length with Aspose.Words. Aspose.Words always sets the PDF AcroForm field size according to the form field text size in the DOM (document object model). Maybe, we could try to think something out like trimming spaces in form field text or adding/reusing some fields in the Aspose.Words DOM. But we do not think we should work on it now because it would be a non-priority request and following workaround seems to be feasible.
As a workaround you could create a pseudo-empty form field by filling it with spaces. But AcroForm field in output PDF will not be actually empty and also here comes your first problem with cursor position. As another workaround you could edit Aspose.Words output PDF in third-party PDF editing tools (like Aspose.PDF) to alter the AcroForm size and text. AcroForms in output PDF could be located by the name which is preserved from Aspose.Words DOM. Hope, this helps.
Hi, thank you very much for your response, I’ll consider your advice in order to solve my problem. Have a nice day!
Thanks for your feedback. If we can help you with anything else, please feel free to ask.