I used the following code to replace an image in the embedded picture content control in a word document.
string docxFilePath = @"c:\temp\replaced.docx";
NodeCollection shapes = asposeWordDoc.GetChildNodes(NodeType.Shape, true);
Image replacementImage = Image.FromFile(@"c:\temp\replacementImage.jpg");
foreach (Aspose.Words.Drawing.Shape nshape in shapes)
{
if (nshape.AlternativeText.ToLower().Trim() == variableName.ToLower().Trim())
//nshape.ImageData.SetImage(replacementImage );
{
nshape.ImageData.SetImage(imagePath);
replacedCount++;
}
}
asposeWordDoc.Save(docxFilePath);
What resulted is a docx that seems to have my images replaced correctly. I tried to attach the
docx file but your forum doesn’t allow upload (probably because there are embedded image files)
However. when I tried to convert this docx into Aspose PDF by the following code…
Stream stream = File.OpenRead(docxfilepath);
Aspose.Pdf.Document pdfdoc = new Aspose.Pdf.Document(stream);
I am getting exception Startxref not found during the instatiation of the PDF Document.
I have no idea what that is… Can you tell me why ?
Thanks.