Hi,
Please run the below source code sample and see the output image.
Image contains Bad Quality and some dots in the images. We need good quality in the image.
Rename the attachment, Remove the .txt from the attachment of msg file and run this sample code.
Please suggest the solution for this as soon as possible.
private void BtnEmailDownloadPDF attachment_Click(object sender, EventArgs e)
{
byte[] bFileAttachment;
//bFileAttachment = File.ReadAllBytes(@"C:\Email\Test\E201312120000001.msg"); //Attachment is working
bFileAttachment = File.ReadAllBytes(@"C:\Email\Test\E201312240000001.msg"); //Despeckle Changes
MemoryStream InputData = new MemoryStream(bFileAttachment);
Aspose.Email.Mail.MailMessage msgAttachment;
Aspose.Email.Mail.MessageFormat format = Aspose.Email.Mail.MessageFormat.Msg;
msgAttachment = Aspose.Email.Mail.MailMessage.Load(InputData, Aspose.Email.Mail.MessageFormat.Msg);
MemoryStream msgStream = new MemoryStream();
msgAttachment.Save(msgStream, Aspose.Email.Mail.MailMessageSaveType.MHtmlFormat);
msgStream.Position = 0;
Aspose.Pdf.Facades.PdfConverter converter = new Aspose.Pdf.Facades.PdfConverter();
MemoryStream DecryptedData = new MemoryStream();
Aspose.Pdf.Facades.PdfFileSecurity FileSecurity = new Aspose.Pdf.Facades.PdfFileSecurity(InputData, DecryptedData);
converter.BindPdf(InputData);
TiffBitmapEncoder encoder = new TiffBitmapEncoder();
encoder.Compression = TiffCompressOption.Ccitt4;
MemoryStream OutputSream = new MemoryStream();
for (int i = 0; i < converter.PageCount; i++)
{
MemoryStream pageStream = new MemoryStream();
//converter.GetNextImage(pageStream, System.Drawing.Imaging.ImageFormat.Jpeg, res, res, 100);
converter.GetNextImage(pageStream, System.Drawing.Imaging.ImageFormat.Jpeg, 100);
pageStream.Position = 0;
JpegBitmapDecoder decoder = new JpegBitmapDecoder(pageStream, BitmapCreateOptions.None, BitmapCacheOption.None);
BitmapSource sourceImage = decoder.Frames[0];
encoder.Frames.Add(BitmapFrame.Create(sourceImage));
}
encoder.Save(OutputSream);
Bitmap bmp = new Bitmap(OutputSream);
bmp.Save(@"C:\Email\Test\" + "page.tif", System.Drawing.Imaging.ImageFormat.Tiff);
}
Thanks & Regards,
P. Saravanan.
Hi Saravanan,
Thank you for writing to us.
I have analyzed your concerns that you have shared with us and it seems that your requirements are more related to Aspose.PDF rather than Aspose.Email as the intermediate MHTML conversion is not used in your code further. I have moved this thread to Total forum and our fellow support developer will soon assist you further regarding your shared concerns.
Hi Saravanan,
Thanks for your inquiry. I am afraid I am unable to test your source code due to some missing references, e.g. TiffBitmapEncoder
, JpegBitmapDecoder
. However, I have converted PDF attachments from MSG file to TIFF using the following sample code and found some quality issues in output. So, I logged an investigation ticket, PDFNEWNET-36203, in our issue tracking system for further investigation and resolution. We will keep you updated about the issue resolution progress via this forum thread.
Please correct me if there is any difference in your requirements and my understanding.
// create PdfConverter object and bind input PDF file
PdfConverter pdfConverter = new PdfConverter();
// create Resolution object with 300 as an argument
Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(300);
// specify the resolution value for PdfConverter object
pdfConverter.Resolution = resolution;
// bind the source PDF file
pdfConverter.BindPdf(myDir + "page_1.pdf");
// start the conversion process
pdfConverter.DoConvert();
// create TiffSettings object, set Compression and ColorDepth
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.Compression = CompressionType.CCITT4;
// convert to TIFF image
pdfConverter.SaveAsTIFF(myDir + "page_1_Fac.tiff", tiffSettings);
// close Converter object
pdfConverter.Close();
We are sorry for the inconvenience caused.
Best Regards,
Hi Tilal Ahmad,
Please can you let me know when this issue will fix and give me the solution. Our customer wants this fix as soon as possible. Our production is down for this issue.
Please help me out to fix this
Poor Image Quality issue in TIFF files.
Thanks & Regards,
P. Saravanan.
Hi Saravanan,
Thanks for your inquiry. As we have noticed the issue recently, I am afraid your reported issue is pending for investigation in queue with other priority tasks. As soon as it’s investigation completes then we will in a good position to share ETA with you. We will keep you updated about the issue resolution progress via this forum thread.
Thanks for your patience and cooperation.
Best Regards,
Tilal Ahmad,
Do I have any update on this? Please advise as soon.
Thanks & Regards,
P. Saravanan.
Hi Saravanan,
We are sorry for the inconvenience. I am afraid your reported issue has not been investigated yet. Our development team is working over other priority tasks, as team schedule issue investigation and resolution on first come first serve basis. However, we have recorded your concerns and also requested development team to investigate and share an ETA at their earliest. We will update you as soon as we get a feedback.
Best Regards,
Hi Tilal Ahamad,
Please can you give me ETA for this. I need to inform to my Customer. Our production is getting affected due to this issue. Please help me out as soon.
Thanks & Regards,
P. Saravanan.
Hi Saravnan,
Thanks for your patience and understanding. We have already escalated your concern to the development team, and as soon as the investigation of your issue is complete, we will share an ETA.
Moreover, as we already stated, we work on issues on a first-come-first-served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers. As another option, we have a priority support service. This allows you to post your issues in our Priority Support forum and raise the priority of these issues directly with our development teams. If possible, we will then aim to get a resolution to your issue as soon as we can. Many Priority Support customers find that this leads to their issue being fixed in the next release of the software. Please also check the following links for details.
Best Regards,
Hi Tilal,
Do I have any update on this? Still we are not getting any information from you. If you are not giving the solution for this. We have to switch over to other component.
Please provide the solution and ETA as soon.
Thanks & Regards,
P. Saravanan.
Hi Saravanan,
Thanks for your inquiry. I am afraid your issue is still pending for investigation due to other priority tasks. We will update you with ETA as soon as it’s investigation is completed.
We are sorry for the inconvenience caused.
Best Regards,
Hi Saravanan,
Thanks for your patience. Please use LZM compression type to increase the image quality. Please try the following code snippet and share the results. Hopefully, it will help you to accomplish your requirements.
PdfConverter pdfConverter = new PdfConverter();
// Create Resolution object with 300 as an argument
Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(300);
// Specify the resolution value for PdfConverter object
pdfConverter.Resolution = resolution;
// Bind the source PDF file
pdfConverter.BindPdf(myDir + "page_1.pdf");
// Start the conversion process
pdfConverter.DoConvert();
// Create TiffSettings object, set Compression and ColorDepth
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.Compression = CompressionType.LZW; // LZW compression type
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Format8bpp;
// Convert to TIFF image
pdfConverter.SaveAsTIFF(myDir + "page_1_Fac1.tiff", tiffSettings);
// Close Converter object
pdfConverter.Close();
Best Regards,
Hi Tilal ahmad,
Our customer wants the output file with this format and compression type
encoder.Compression = TiffCompressOption.Ccitt4;
Since Our customer wants this format is B/W (Group4 Fax Encoding format).
Please fix this issue in this and give the solution as soon as possible.
Thanks & Regards,
P. Saravanan.
Hi Saravanan,
Thanks for your feedback. We have recorded your concern and our development team is looking further into the issue. We will keep you updated about the issue resolution via this forum thread.
Thanks for your patience and cooperation.
Best Regards,
Hi Tilal Ahamad,
This issue is already more than 25 days. Please make this has high priority and give us the solution as soon. Our customer feel very bad in this things. Still prodcution is going with Bad Quality of images.
Kindly do the needful.
Thanks & Regards,
P. Saravanan.
Hi Saravanan,
Thanks for your feedback. We have recorded your concern and raised the issue priority as well. Our development team is working over your issue along with other priority issues and we will notify you as soon as it is resolved.
Thanks for your patience and cooperation.
Best Regards,
Hi Saravanan,
Thanks for your patience.
We have further investigated the issue PDFNEWNET-36203 reported earlier and as per our observations. Since the dots are grayscale emulation for 1-bit image and as the source/initial image is low quality and too bright, therefore the output image is also bright (actually is white-black dots grid).
In order to make the image look better, brightness parameter should be set (suitable value is 0.7 or 0.8):
tiffSettings.Brightness = 0.7f;
[C#]
// create PdfConverter object and bind input PDF file
PdfConverter pdfConverter = new PdfConverter();
// create Resolution object with 300 as argument
Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(90); // Updated to 90 as 300 appears to be excessive.
// specify the resolution value for PdfConverter object
pdfConverter.Resolution = resolution;
// bind the source PDF file
pdfConverter.BindPdf("c:/pdftest/page_5.pdf");
// start the conversion process
pdfConverter.DoConvert();
// create TiffSettings object, set Compression and ColorDepth
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.Compression = CompressionType.CCITT4;
tiffSettings.Brightness = 0.7f;
// convert to TIFF image
pdfConverter.SaveAsTIFF("c:/pdftest/page_5_Converted.tiff",
tiffSettings);
// close Converter object
pdfConverter.Close();
For your reference, I have also attached the resultant TIFF images generated over my end.
The issues you have found earlier (filed as PDFNEWNET-36203) have been fixed in Aspose.Pdf for .NET 8.9.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.