I have been trying to achieve image replacement using aspose PDF for .Net and I have been unsuccesful in all ways. I have tried both approaches using Aspose.Pdf.Facades and Aspose.Pdf yet no success. Below Attaching snippet for image replacement and the concerned pdf for the same.
byte ImageBytes = System.Convert.FromBase64String(ImageDataUrl); MemoryStream ms = new MemoryStream(ImageBytes ); doc.Pages.Resources.Images.Replace(1, ms);
the above snippet fails as it is not able to locate the images in XImageCollection , although I verified the pdf across various editors and the image is detected well.
Using Aspose Pdf Facades:
byte ImageBytes = System.Convert.FromBase64String(ImageDataUrl); File.WriteAllBytes("temp.png", ImageBytes ); pdfContentEditor.ReplaceImage(1, 1, "temp.png");
The above code does not fail but results in the output with no image replacement.
Certificate1d.pdf (428.5 KB)