Set PDF file information - facades

Contents
[ ]

PdfFileInfo class allows you to set file specific information of a PDF document. You need to create an object of PdfFileInfo class and then set different file specific properties like Author, Title, Keyword, and Creator etc. Finally, save the updated PDF file using saveNewInfo(..) method of the PdfFileInfo object.

The following code snippet shows you how to set PDF file information.

 public static void SetPdfInfo()
    {
        PdfFileInfo fileInfo = new PdfFileInfo(_dataDir + "sample.pdf");
        // Set PDF information
        fileInfo.setAuthor("Aspose");
        fileInfo.setTitle ("Hello World!");
        fileInfo.setKeywords("Peace and Development");
        fileInfo.setCreator ("Aspose");
        
        // Save updated file
        fileInfo.saveNewInfo(_dataDir + "SetfileInfo_out.pdf");
    }

Set Meta Info

setMetaInfo method allows you to add any information. In our example, we added a field. Check next code snippet:

   public static void SetMetaInfo()
    {
        // Create instance of PdffileInfo object
        PdfFileInfo fInfo = new PdfFileInfo(_dataDir + "sample.pdf");
       
        // Set new customer attribute as meta info
        fInfo.setMetaInfo("Reviewer", "Aspose.PDF user");

        // Save updated file
        fInfo.saveNewInfo(_dataDir + "SetMetaInfo_out.pdf");

    }