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

Free Support Forum - aspose.com

How to rename a pdf file in pdf portfolio

Hi,

I have a question on renaming a pdf file in pdf Portfolio.

The code related is as follows:

foreach (var ans in answers)

{

if (ans.AnswerType.ToString() == “7”)

{

string AText = ans.AnswerText.ToString();



string attachName = AText + “-” + pid.ToString() + “-” + qid.ToString() + “-” + Session[“AcadYr”].ToString().Trim() + “.pdf”;

if (File.Exists(Server.MapPath("~/AttachmentsFiles/Program/" + attachName)) == true)

{



var fileAttach = Server.MapPath("~/AttachmentsFiles/Program/" + attachName);

FileSpecification FSAttach = new FileSpecification(fileAttach);

FSAttach.Description = AText;

//doc.Collection[idx].Name = “~/AttachmentsFiles/Program/” + idx.ToString() + attachName;

doc.Collection.Add(FSAttach);

//idx++;

}

}

}

I can’t change the pdf file names before I add those files. So what I have to do is to rename the pdf names after adding them in the portfolio. The reason to rename them is that Acrobat will order the files in portfolio automatically by name and I want the files to appear in the order they are added.

I tried to change the filenames after doc.Collection.Add(FSAttach) and it doesn’t work. But changing the filenames before doc.Collection.Add(FSAttach) like using FSAttach.Name = “XXX” results in not able to open the pdf file in portfolio(as name is changed so it can’t find the file).

Plz help me out! Thanks.

Hi there,


Thanks for your inquiry. After initial investigation, we have logged an enhancement ticket as PDFNEWNET-37134 to rename files in PDF portfolio in our issue tracking system for further investigation and implementation. We will keep you updated about the issue resolution progress via this forum thread.

We are sorry for the inconvenience caused.

Best Regards,

Hi, any update on this issue?

@Dummy2020

Regretfully, the earlier-logged ticket is not yet resolved. We will certainly send a notification in this forum thread as soon as it is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.