We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Overlay Text on Image -- Classic ASP

How do I overlay text on an image? We have a one page .DOC file with an image embedded on the enite page. We would like to overlay text at a specific location. We are using classic asp, an older aspose.words (I think 14.x). Also, can we do this without a ComWrapper? If not, then what would be the ComWrapper Code. Thanks in Advance.

@adventurousbooks,

Please ZIP and attach your input Word document and your expected document showing the desired output here for testing. You can create expected document by using MS Word. We will then investigate the scenario on our end and provide you code to achieve the same by using Aspose.Words.

EXAMPLE.zip (3.1 MB)

Here is the bundle we are trying to achieve with Aspose.Words. We use classic ASP.

Thanks you.

@adventurousbooks,

We are working on your query and will get back to you soon.

@adventurousbooks,

You can build on the following C# (.NET) code to be able to get desired output:

Document doc = new Document("E:\\Example\\book-cover-empty.doc");
DocumentBuilder builder = new DocumentBuilder(doc);

Shape bookCover = builder.InsertImage("E:\\temp\\Example\\book-cover.jpg",
                                    RelativeHorizontalPosition.Page, 0,
                                    RelativeVerticalPosition.Page, 0,
                                    -1, -1,
                                    WrapType.None);
bookCover.BehindText = true;

Shape coverPerson = builder.InsertImage("E:\\temp\\Example\\cover-person.jpg",
                        RelativeHorizontalPosition.Page, (1.37 * 72),
                        RelativeVerticalPosition.Page, (1.2 * 72),
                        -1, -1,
                        WrapType.None);


Shape txt1 = builder.InsertShape(ShapeType.TextBox,
                                RelativeHorizontalPosition.Page, 1.75 * 72,
                                RelativeVerticalPosition.Page, 3.5 * 72,
                                1.45 * 72, .25 * 72,
                                WrapType.None);
Run run1 = new Run(doc, "Kaylee Bonger");
run1.Font.Name = "Arial";
run1.Font.Italic = true;
run1.Font.Bold = true;
run1.Font.Color = Color.White;            
txt1.FirstParagraph.AppendChild(run1);
txt1.FillColor = Color.FromArgb(0, 102, 104);


Shape txt2 = builder.InsertShape(ShapeType.TextBox,
                                RelativeHorizontalPosition.Page, 0.5 * 72,
                                RelativeVerticalPosition.Page, 4 * 72,
                                3.75 * 72, 2.5 * 72,
                                WrapType.None);
Run run2 = new Run(doc, "Kaylee Bonger is a young magician who bounds through this collection of adventures with Drew Rouse while learning theage old truths:" + ControlChar.LineBreak + ControlChar.LineBreak + ControlChar.Tab + "It's not what you say, but how you say it." + ControlChar.LineBreak + ControlChar.Tab + "It's not what you hear, but how you hear it. " + ControlChar.LineBreak +ControlChar.LineBreak + "After a dramatic rescue from raging waters and helping to create an exciting bicycle race, AND SO ON .... ");
run2.Font.Name = "Arial";
run2.Font.Italic = true;
run2.Font.Size = 8;
run2.Font.Color = Color.White;
txt2.FirstParagraph.AppendChild(run2);
txt2.FillColor = Color.FromArgb(0, 102, 104);

doc.Save("E:\\Example\\19.1.pdf");

Thanks. We are using classic ASP. Will I need to build a COM Wrapper. Also, can I use 2 COMWrappers in an application. Any information would be helpful.

@adventurousbooks,

Yes, you need to build a COM Wrapper. Unfortunately, we have not tested two COM Wrappers yet but it should work as long as you are referencing the correct class methods in ASP markup code.