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

Free Support Forum - aspose.com

How to create auto expand fillable text field in output PDF using C#

Hi there,

We are using Aspose.Words .NET version 20.3 and the following code to convert the Word text inputs - fill in only.docx (attached here Word to PDF - fillable fields.zip (57.5 KB)) to PDF:

        var doc = new Document(input);

        doc.LayoutOptions.TextShaperFactory = HarfBuzzTextShaperFactory.Instance;

        doc.AcceptAllRevisions();

        doc.UpdateFields();

        doc.UpdatePageLayout();

        var saveFormat = new PdfSaveOptions
        {
            OptimizeOutput = true,
            ImageCompression = PdfImageCompression.Jpeg,

            PreserveFormFields = true,

            UpdateFields = true,
            SaveFormat = SaveFormat.Pdf
        };

        doc.Save(output, saveFormat);

Please notice the output of conversion Word text inputs - fill in only.docx.pdf and the original doc file with restrictions off Word text inputs - designer.docx that will allow poking with the docx.

The situation we are facing is as follows:

  1. the client is used to filling the docx file (see Word text inputs - fill in only.docx) and having this auto-expand on the fillable text field/control; this means that the input text is visible all the time
  2. we are trying to get the same user experience with the PDF Word text inputs - fill in only.docx.pdf but the text fields are converted to a fixed text width

We appreciate any help in achieving the same user experience in the PDF. Are there any leads on conversion configs that we could explore?

Best regards.

@gwert

The PDF is fixed page layout format and Word document is flow layout format. The text field in the PDF file does not has the same behavior. You can check this behavior of PDF by inserting the text field using Adobe writer. Hope this answers your query. Please let us know if you have any more queries.