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

Free Support Forum - aspose.com

Doc to pdf : background image lost

Hello,


I process a mailmerge and I add a background image to the document.

The background image is correct in the .doc document but when I save it into a pdf file, the background is not showing.

Here the code to adding the background after the merge :

PageInfo pi = document.GetPageInfo (0);
Shape bg = new Shape (document, ShapeType.Image);
bg.ImageData.SetImage (this.fileRetriever(urlOrPathImage));
bg.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
bg.HorizontalAlignment = Aspose.Words.Drawing.HorizontalAlignment.Left;
bg.RelativeVerticalPosition = RelativeVerticalPosition.Page;
bg.VerticalAlignment = Aspose.Words.Drawing.VerticalAlignment.Top;
bg.Left = 0;
bg.Top = 0;
bg.Width = pi.WidthInPoints;
bg.Height = pi.HeightInPoints;
bg.BehindText = true;

Aspose.Words.Paragraph bpParagraph = new Aspose.Words.Paragraph (document);
bpParagraph.AppendChild (bg);

foreach (Aspose.Words.Section sect in document.Sections) {

// There could be up to three different headers in each section, since we want
// the watermark to appear on all pages, insert into all headers.
InsertParagraphIntoHeader (bpParagraph, sect, HeaderFooterType.HeaderPrimary);
InsertParagraphIntoHeader (bpParagraph, sect, HeaderFooterType.HeaderFirst);
InsertParagraphIntoHeader (bpParagraph, sect, HeaderFooterType.HeaderEven);
}

I’ve attached you the two result files.

Can you help me with this ?

Thank by advance.
Regards.

And here the code for the saving part :

this.internalDocument.UpdateTableLayout();
this.internalDocument.Save(pathToSave, this.pdfSaveOptions);

the pdfSaveOptions Object has a warning callback, I can’t provide you the output if you want to.

Hi Edwige,


Thanks for your inquiry. To resolve this problem, please call doc.UpdatePageLayout() method before saving to PDF after the UpdateTableLayout method call. This is needed because UpdateTableLayout method was called before saving to PDF. I hope, this helps.

Best regards,

Hello,


Yes, it works.
Thanks a lot.

Regards.

Hello,


I have quite the same problem but with a wordart part. It not appears in the pdf.

I send you the doc and the pdf. The headband “Vendu” is not in the pdf file.

Is this a way to get it into the pdf file ?

Regards.

Hi Edwige,


Thanks for your inquiry. After an initial test, I was unable to reproduce this issue on my side when using Aspose.Words for .NET 14.8.0. It would be great if you please create a standalone runnable console application that helps us reproduce your problem on our end and attach it here for testing. As soon as you get this simple application ready, we’ll start further investigation into your issue and provide you more information.

Best regards,

Hello,


Thanks for your reply.

When I open the document .doc and save it as a pdf, the problem occurs.
I’m using Aspose.Words .NET 14.8 but I am using Mono (version 2.10.8.1 on Debian 2.10.8.1-8).
Can it be the source of the issue ?

Regards,
Edwige.
Hi Edwige,

Thanks for sharing the development environment details. I tested the scenario and have managed to reproduce the same problem on my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-10778. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

Hello,


Thanks for your reply.

Regards,
Edwige.

The issues you have found earlier (filed as WORDSNET-10778) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Great. Thanks a lot.
:slight_smile:

Edwige.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan