We are converting email attachments to TIFF images in C#. But we are not able to convert the attachments to TIFF when the attachments having color pages.
Hi Anish,
Thanks for your inquiry. The shared document have size 0kb. It would be great if you please share following detail for investigation purposes. I will investigate the issue on my side and provide you more information.
- Please attach your input Word document.
- Please attach the output Tiff file that shows the undesired behavior.
Thanks for the reply Tahir.
Hi Anish,
Thanks for sharing the detail. Your query is related to Aspose.Pdf. I am moving this forum thread to Aspose.Pdf forum. My colleagues from Aspose.Pdf team will reply you shortly.
Hi Anish,
//open document<o:p></o:p>
Document pdfDocument = new Document("c:/pdftest/merged+(4).pdf");
//create Resolution object
Resolution resolution = new Resolution(300);
//create TiffSettings object
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.Compression = CompressionType.CCITT4;
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Default;
tiffSettings.SkipBlankPages = false;
//create TIFF device
TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
//convert a particular page and save the image to stream
tiffDevice.Process(pdfDocument,
“c:/pdftest/merged+(4)_output.tif”);
Thanks Nayyer for the codes.
Hi Anish,
Thanks Nayyer.
anishvj:
Ok Thanks Nayyer.
anishvj:
var pdfDocument = new Document();<o:p></o:p>
pdfDocument.Pages.Add();
//Specify the location of input text file
String FILE_NAME = "c:/pdftest/convertlog.txt ";
if (File.Exists(FILE_NAME))
{
System.IO.TextReader objReader = new System.IO.StreamReader(FILE_NAME);
// Read the file till the end of the file has come
do
{
//Create a new text paragraph & pass text to its constructor as argument
Aspose.Pdf.Text.TextFragment text1 = new Aspose.Pdf.Text.TextFragment(objReader.ReadLine());
// add the text object to paragraphs collection of section
pdfDocument.Pages[1].Paragraphs.Add(text1);
// Read till the end of file
} while (objReader.Peek() != -1);
// Close the StreamReader object
objReader.Close();
}
else
MessageBox.Show("File Does Not Exist");
// Save the PDF file
//pdfDocument.Save("c:/pdftest/FinalMergedFile.pdf");
pdfDocument.ProcessParagraphs();
//create Resolution object
Resolution resolution = new Resolution(300);
//create TiffSettings object
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.Compression = CompressionType.CCITT4;
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Default;
tiffSettings.SkipBlankPages = false;
//create TIFF device
TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
//convert a particular page and save the image to stream
tiffDevice.Process(pdfDocument, "c:/pdftest/TXT_PDFoutput.tif");
pdfDocument.Dispose();
For further details, please visit
Please visit the following ink for required information on How to Save Document as a Multipage TIFFanishvj:
and WORD to TIFF.
Thanks.
Hi Anish, anishvj:
Thanks I got it.
Hi Anish,
Thanks for the reply.
Hi Anish,
Document pdfDocument = new Document(“c:/pdftest/Herrington±+%23+PA0016467846-01++Supp.+%23+2.pdf”);<o:p></o:p>
Resolution resolution = new Resolution(96);
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.Compression = CompressionType.CCITT4;
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Default;
tiffSettings.SkipBlankPages = false;
TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
tiffDevice.Process(pdfDocument,
“c:/pdftest/Herrington±+%23+PA0016467846-01++Supp.+%23+2_compressed.tiff”);
Thanks for the details Nayyer.
Hi Anish,
ok , thanks nayyer.