Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Feb 10, 2012 4:46 pm

hi there, could you please tell me the best ways to do the followng using spire.doc:

1) Add an image watermark
I have tried to do this using the Spire.Doc.PictureWatermark but the image doesnt show (or it does sometimes work but then flickers and disappears after a few seconds)

2) add an image to the top right of every page and set the text wrapping to behind the text

3) add a full page sized image to every page and set the text wrapping to in-front of the text


all three of these are being saved/streamed to PDF files.


any help would be greatly appreciated!


thank you.

fatmedia
 
Posts: 13
Joined: Fri Oct 07, 2011 2:31 pm

Mon Feb 13, 2012 8:48 am

Hello fatmedia,

Thanks for your inquiry and sorry for the late reply.

We have tested the first issue you said with the latest hotfix[Spire.Doc v4.1.22] using the following code:
Code: Select all
//load the document
            Document doc = new Document();
            doc.LoadFromFile(@"..\..\test.doc", FileFormat.Doc);

            //load the picture
            Image image = Image.FromFile(@"..\..\untitled.bmp");

            //new a pictureWatermark using the picture
            PictureWatermark picMark = new PictureWatermark(image, false);

            //insert the pictureWatermark into the document
            doc.Sections[0].Document.Watermark = picMark;
     
            //save the document as PDF file
            doc.SaveToFile(@"..\..\result.pdf", FileFormat.PDF);
 
. It works fine. Would you please have a kind try with the hotfix,you can download it at http://www.e-iceblue.com/Download/download-word-for-net-now/spire-doc-hv4122.html.

For the second question,you can use the following code:
Code: Select all
//load the document
            Document doc = new Document();
            doc.LoadFromFile(@"..\..\test.doc", FileFormat.Doc);

            //create a header
            HeaderFooter header = doc.Sections[0].HeadersFooters.Header;

            //insert picture to header
            Paragraph headerParagraph = header.AddParagraph();
            DocPicture headerPicture
            = headerParagraph.AppendPicture(Image.FromFile(@"..\..\header.jpg"));

            //set the textWrapStyle
            headerPicture.TextWrappingStyle = TextWrappingStyle.Behind;

            //allocate the picture
            headerPicture.VerticalAlignment = ShapeVerticalAlignment.Top;
            headerPicture.HorizontalAlignment = ShapeHorizontalAlignment.Right;

            //save the document
            doc.SaveToFile(@"..\..\result.pdf", FileFormat.PDF);


As the third question, Spire.Doc doesn't support to set the text wrapping to in-front of the text at present. We are so sorry for the inconvenience.

If you still have any other questions,please feel free to contact us.

Have a great day.

BR
Suvi
e-iceblue support
User avatar

Suvi.Wu
 
Posts: 154
Joined: Thu Oct 20, 2011 2:53 am

Return to Spire.Doc

cron