Hi Jonathan,
Hope you are doing well.
Regarding the image color issue, we found that the display effect of the generated PDF in different PDF readers is different. When opened in Adobe Reader, the colors of the picture are pale, which is the same as opening with Adobe Photoshop. But when opened in Chrome and Foxit Editor, the colors of the picture are not pale, as shown in the attached screenshot.
Meanwhile, I tried to use our Spire.PDF to extract the image of the generated PDF, but I found that the color of the extracted image did not become pale. Below is the code I used, you can try it with the latest
Spire.PDF Pack(Hot Fix) Version:6.8.1. We suspect that this issue may be related to Adobe's internal display mechanism. We are very sorry that we are currently unable to find a solution to solve it.
- Code: Select all
PdfDocument Doc = new PdfDocument();
PdfPageBase Page;
PdfImage Image = PdfImage.FromFile(@"input.png");
Page = Doc.Pages.Add(new SizeF(Image.Width, Image.Height), new PdfMargins(0), PdfPageRotateAngle.RotateAngle0,
PdfPageOrientation.Landscape);
//New method to add layer
var layer = Doc.Layers.AddLayer("Image");
Doc.Pages[0].Canvas.DrawRectangle(PdfBrushes.Black, new RectangleF(0, 0, Page.Size.Width, Page.Size.Height));
PdfCanvas pcC = layer.CreateGraphics(Doc.Pages[0].Canvas);
pcC.DrawImage(Image, 0, 0, Image.Width, Image.Height);
//Save
Doc.SaveToFile(@"output.pdf");
Doc.Close();
//Extract image
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(@"output.pdf");
IList<Image> images = new List<Image>();
foreach (Image image in doc.Pages[0].ExtractImages())
{
images.Add(image);
}
int index = 0;
foreach (Image image in images)
{
String imageFileName
= String.Format(@"Image-{0}.png", index++);
image.Save(imageFileName, ImageFormat.Png);
}
Sincerely,
Rachel
E-iceblue support team
Login to view the files attached to this post.