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

Free Support Forum - aspose.com

Adding image into document won't work for pdf

I have test your example AddImageToEachPage in Aspose_Words_NET-master
It works fine for saving as .docx but when I change it to save as .pdf ,
the image won’t show then

Hi Markwe,

Thanks for your inquiry. Have you tried Aspose.Words 15.8.0 version? Have you tried calling Document.UpdatePageLayout before saving to PDF? Please attach your 1) input Word document, 2) output Word document showing the correct output and 3) output PDF file showing incorrect output here for testing. We will investigate the issue on our end and provide you more information.

Best regards,

Hi, I’m using the 15.8.1.0, just add a line

doc.Save(dataDir + "TestFile Out.pdf");

under your AddImageToEachPage example , the word document did contain the image but the pdf didn’t, please check. Thanks.

Hi Markwe,

Thanks for your inquiry.

Regarding the usage of the ‘interim build’ of Aspose.Words i.e. 15.8.1, it was only meant for a particular few customers who required it. We strongly recommend you please use the latest official release of Aspose.Words that is 15.8.0. You can download it from following link. It worked fine on my end (see attached Docs.zip).

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

The image can be seen on 5th pages of both DOCX and PDF files.

Best regards,

Hi,

I have changed the words .net to version 15.8.0 as your suggest, same result,
my test is very simple, just use your example “AddImageToEachPage” but change

// doc.Save(dataDir + "TestFile Out.docx");
doc.Save(dataDir + "TestFile Out.pdf");

The TestFile Out.pdf won’t show the image(please refer the attachment)

BTW, I can’t open your pdf nor docx, it show me all X.

Cheers

Hi,

Just now I have noticed that there is an image on the page 5 but how come my
example only produced 4 pages? are we using the same example?
AddImageToEachPage in Aspose_Words_NET-master, attached please see my output docx(which is ok and contain the image in each page).

Cheers

@markweix

Thanks for your inquiry. I am using code from following example:

github.com

There are some limitations when using Aspose.Words in evaluation mode (without license):

http://www.aspose.com/docs/display/wordsnet/Evaluate+Aspose.Words

Could you please attach your input Word document here for testing? We will investigate the issue on our end and provide you more information.

Best regards,

Hi,

I can now see the image in pdf by doing it this way,

doc.Save(dataDir + "TestFile Out.doc");
Document doc1 = new Document(dataDir + "TestFile Out.doc");
doc1.Save(dataDir + "TestFile Out.pdf");

doc.Save(dataDir + “TestFile Out.pdf”); won’t work, are you sure this is caused by the evaluation version.

Cheers

Hi Markwe,

Thanks for your inquiry. Yes, the document truncates at the end and Aspose.Words puts an evaluation red message at the top because of evaluation version. Can you please try following code (using licensed version).

doc.Save(dataDir + "TestFile Out.doc");
Document doc1 = new Document(dataDir + "TestFile Out.doc");
doc1.Save(dataDir + "TestFile Out.pdf");

doc.UpdatePageLayout();

doc.Save(dataDir + "TestFile Out.pdf"); won’t work, are you sure this is caused by the evaluation version.

In case the problem still remains, please attach your input Word document here for testing. We will investigate the issue on our end and provide you more information.

Best regards,