How to avoid printing Date/Time fields and File name fields while converting to PDF using aspose

Hi,

I have already created an application for converting the text based files(txt/Word/xls/ppt) to PDF using Aspose library. Along with this i need the Field Replacements like Date/Time Fields & Filename Fields. I don’t want to print these things while printing to PDF from any of the above mentioned text based files. Can some help me out how do i omit in printing those fields. or please share me the apis to work it out.

Thanks in Advance.

@pradeepdone,

We are looking into the requirement. We will update you soon with the solution.

@pradeepdone,

In case of Aspose.slides, slide number and date time fields are in Headers and footers. By default the header footers are not visible in presentation. You have to explicitly enable the visibility of these elements in header and footer. If you are facing any issue while converting PPT and PDF then we need the sample input presentation (PPT) and output PDF files to investigate the issue along with the information about which version of Aspose are you using.

@pradeepdone,

You can simply remove those fields before saving Word document to PDF or Printing. Please try running the following code:

Document doc = new Aspose.Words.Document(MyDir + @"in.docx");

ArrayList fieldsToRemove = new ArrayList();
foreach (Field field in doc.Range.Fields)
{
    if (field.Type == FieldType.FieldDate || field.Type == FieldType.FieldFileName)
    {
        fieldsToRemove.Add(field);
    }
}

foreach (Field field in fieldsToRemove)
    field.Remove();


//doc.Print();
//doc.Save(MyDir + @"18.2.pdf");

How do we use the same feature for other type of files. Like converting text/ppt/xls/email to pdf’s. Can you give me sample code of those.

@pradeepdone,

Sorry for the delayed response. We are looking into it. We will update you soon.

@pradeepdone,

Please access the link Managing Document Properties for details on how Excel document properties can be manipulated. Furthermore you can remove/set metadata info in resultant output PDF with Aspose.PDF API. Please visit the link Set PDF File Information for details.