Replace text with image in Doc and save to pdf

Hi,

I have a template doc(in .doc format).In that doc i want to replace a merge field name “Logo” with an image and without saving that doc I want to generate a pdf from that doc.Please provide code in C# .net version.

I don’t want any changes in that doc because that doc is a reference doc and other pdf with different logo can be generated.

@vivek.kumar,

Please try using the following code:

Document doc = new Document(MyDir + @"in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToMergeField("Logo");
Shape img = builder.InsertImage(MyDir + "Aspose.Words.jpg");
doc.Save(MyDir + @"17.11.pdf");

Hope, this helps.