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

Free Support Forum - aspose.com

RenameField not working


I am having a problem with the RenameField function if the merge field contains a “.”. The rename will happen but it will only rename everything after the “.” in the field name. Please see the below code (I’ve attached the PDF).

Dim pdfFacades As New Aspose.Pdf.Facades.Form(“Test.pdf”)

For Each field In pdfFacades.FieldNames
pdfFacades.RenameField(field, “NewFieldName”)



Hi Daniel,

Thanks for your inquiry. I have tested your scenario with shared document and noticed the reported issue. For further investigation, I have logged an issue in our issue tracking system as PDFNEWNET-39366 and also linked your request to it. We will keep you updated via this thread regarding the issue status.

We are sorry for the inconvenience caused.

Best Regards,

I’ve noticed this behavior as well. Is there a work around, or any progress on a solution?

Hi Gary,

Thanks for your inquiry. I am afraid above form field renaming issue is still not resolved as product team is busy in resolving other issues in the queue, reported earlier. We will notify you as soon as we made some significant progress towards issues resolution.

We are sorry for the inconvenience caused.

Best Regards,

Has this issue been solved? It doesn’t seem to be resolved.



Thank you for contacting support.

We would like to request you to try using below code snippet with Aspose.PDF for .NET 18.3 in your environment and then share your kind feedback with us.

        FileStream Stream = new FileStream(dataDir + "input.pdf", FileMode.Open);
        Form form = new Aspose.Pdf.Facades.Form(Stream);

        string[] allfields  = form.FieldNames;

        for (int counter = 0; counter < form.FieldNames.Length; counter++)
            form.RenameField(allfields[counter], "TEST " + (counter+1));
        form.Save(dataDir + "Test_18.3.pdf");

In case you face any problem, please share the source and generated files with us so that we may proceed to help you out.

Thank you for your answer. My code was the same as yours except that I was not using a filestream.
So I tried with your code and it doesn’t work as expected: if a field contains a dot character, you cannot get rid of it.

here is the code:

        string filename = @"C:\temp\TaxReturnRPartI_NL.pdf";
        string targetfile = @"C:\temp\TaxReturnRPartI_NL_WithoutDotFields.pdf";

        FileStream Stream = new FileStream(filename, FileMode.Open);
        Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(Stream);

        string[] allfields = form.FieldNames;

        for (int counter = 0; counter < form.FieldNames.Length; counter++)
            string field = allfields[counter];
            string newField = field.Replace('.', '_');
            form.RenameField(field, newField);

And here are the PDF files:

TaxReturnRPartI_NL_WithoutDotFields.pdf (2.1 MB)
TaxReturnRPartI_NL.pdf (2.1 MB)

Thank you
kind regards


We have been able to reproduce the issue and the data has been updated in respective ticket. Its priority has also been raised. We will notify you as soon as this issue will be resolved. We appreciate your patience in this regard.

Is there any news when this bug will be solved?

Based on this discussion thread, this bug exists at least since September 2015 !

Thank you
Kind regards.


We would like to share with you that RenameField works fine with one-level fields, so technically PDFNET-39366 is an enhancement ticket that is pending since long owing to more critical and important tickets. Nevertheless, we have recorded your concerns and will schedule this ticket soon. We appreciate your patience and comprehension in this regard.

Moreover, we also offer Paid Support, where issues are used to be investigated with higher priority. Our customers, who have paid support subscription, report their issue there which are meant to be investigated urgently. In case your reported issue is a blocker, you may please consider subscribing for Paid Support. For further information, please visit Paid Support FAQs.

Thank you Farhan for your answer.
Although I find it arguable that you do not consider it a bug I will not make a fuss out of it.
At least with your answer I now know that you won’t solve it unless we want to pay for Paid support so we will just look for another alternative and we’ll stop waiting for a fix.


We have stated it to be an enhancement ticket after initial investigations in our environment and we did not mean that we would not fix it without Paid Support. As shared earlier, its priority has been raised to next level and we will accommodate it in our development schedule as soon as we can. We really appreciate your patience and comprehension in this regard.

A post was split to a new topic: Issue with Rename Field