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;
}