Hello,
Thanks for your inquiry.
I simulated a PDF and tested the TryCompressImage method with our latest
Spire.PDF Pack(Hot Fix) Version:7.11.1, but I didn't reproduce your issue. The image of output PDF displayed correctly. Below is my testing code. I also attached the output PDF for your reference.
- Code: Select all
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(@"input.pdf");
//Disable the incremental update
doc.FileInfo.IncrementalUpdate = false;
//Traverse all pages
foreach (PdfPageBase page in doc.Pages)
{
if (page != null)
{
if (page.ImagesInfo != null)
{
foreach (PdfImageInfo info in page.ImagesInfo)
{
page.TryCompressImage(info.Index);
}
}
}
}
//Save the document
doc.SaveToFile(@"output.pdf");
If you were using an old version, I suggest you first try again with the latest one. If your issue still exists after trying, to help further look into the caused reason. please share us with the following more information. Thanks in advance.
1. Your testing PDF.
2. Your system information (E.g. Win7, 64 bit) and region setting (E.g. China, Chinese).
3. The target platform of your project(E.g. NET framework 4.7.2).
Sincerely,
Lisa
E-iceblue support team
Login to view the files attached to this post.