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

Free Support Forum - aspose.com

How to set GreyScale option for a PDF

I have converted TIFF files to PDF and i need to set Grey Scale option for the pages in the resultant PDF,
Please see the below code for creating PDF

private string CreatePDF(string DestinationFilePath,string fileName,string ClaimNumber,int InputFileID)
{
        string PDFPath = "";
        DirectoryInfo info = new DirectoryInfo(DestinationFilePath);
        FileInfo[] files = info.GetFiles("*.*", SearchOption.AllDirectories).OrderBy(t => 
        t.LastAccessTime).ToArray(); //Get images in the order of last access time
        Document doc = new Document();  
            String LicenseFile = ConfigurationManager.AppSettings["AsposeLicensePath"];
            Aspose.Pdf.License license = new Aspose.Pdf.License();
            license.SetLicense(LicenseFile);
            if (!Directory.Exists(PDFFilePath))
            {
                Directory.CreateDirectory(PDFFilePath);
            }
            doc.Save(PDFFilePath + fileName + ".pdf");
          
                PDFPath = PDFFilePath + fileName + ".pdf";
                foreach (FileInfo file in files)
                {
                    if (file.Length > 1)
                    {
                        Page asposePage = doc.Pages.Add();
                        Aspose.Pdf.Image image = new Aspose.Pdf.Image();
                        image.File = Convert.ToString(file.FullName);           
                        asposePage.Paragraphs.Add(image);
                     
                    }

                }
                string filename = PDFFilePath + fileName + ".pdf";
                doc.Save(filename); //Save PDF with images for a claim
                ClaimDetails ClaimDetails = new ClaimDetails();
                DBAction = 4;
                ClaimDetails.Status = "Success";
                ClaimDetails.Comment = "PDF Created";
                ClaimDetails.InputFileID = InputFileID;
                ClaimDetails.ClaimNumber = ClaimNumber;
                int result = dataAccess.CancellationDetailsInsert(ClaimDetails, DBAction);
                logManager.LogInfo(this.GetType(), "PDF Created in the path :" + PDFFilePath + fileName +".pdf")
        
        return PDFPath;
    }

@soniag

Thank you for contacting support.

You may create a PDF containing Greyscale pages with RgbToDeviceGrayConversionStrategy as explained in Convert a PDF from RGB colorspace to Grayscale.

In case you notice any problem then share source and generated ZIP files with us so that we may investigate it in our environment.