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

Free Support Forum - aspose.com

Text note appearing over the floting box

the text manish is not displayed on image pdf-header1.png which is on header of pdf

Aspose.Pdf.Pdf document = new Aspose.Pdf.Pdf();

Aspose.Pdf.Watermarks _wortermark = new Aspose.Pdf.Watermarks();Aspose.Pdf.

FloatingBox _fbox = new Aspose.Pdf.FloatingBox();

_fbox.Top = 83;

Aspose.Pdf.Image imgleftImg = new Aspose.Pdf.Image();

imgleftImg.ImageInfo.File = Server.MapPath("../images/pdf-left.png");imgleftImg.ImageInfo.ImageFileType = Aspose.Pdf.

ImageFileType.Png;imgleftImg.IsNeedRepeating = true;

imgleftImg.ImageInfo.FixHeight = 718;

imgleftImg.ImageInfo.FixWidth = 30;

imgleftImg.IsImageFitToRowHeight = true;

_fbox.Paragraphs.Add(imgleftImg);

Aspose.Pdf.FloatingBox _fboxheader = new Aspose.Pdf.FloatingBox();

Aspose.Pdf.Image imgHeaderImg = new Aspose.Pdf.Image();imgHeaderImg.ImageInfo.File = Server.MapPath(

"../images/pdf-header1.png"); imgHeaderImg.ImageInfo.ImageFileType = Aspose.Pdf.ImageFileType.Png;

//imgHeaderImg.IsInList = true;

imgHeaderImg.ImageInfo.FixWidth = 600;

imgHeaderImg.ImageInfo.FixHeight = 80;

_fboxheader.ZIndex = 180;

_fboxheader.Paragraphs.Add(imgHeaderImg);

_wortermark.Add(_fbox);

_wortermark.Add(_fboxheader);

document.Watermarks = _wortermark;

Aspose.Pdf.Section pageSec = document.Sections.Add();

setSectionSettings(pageSec);

Aspose.Pdf.HeaderFooter header = new Aspose.Pdf.HeaderFooter();

pageSec.OddHeader = header;

pageSec.EvenHeader = header;

Aspose.Pdf.Table headerTable = new Aspose.Pdf.Table();

headerTable.FixedWidth = 600;

headerTable.Alignment = Aspose.Pdf.AlignmentType.Center;

headerTable.VerticalAlignment = Aspose.Pdf.VerticalAlignmentType.Bottom;

Aspose.Pdf.Row headerRow = headerTable.Rows.Add();

headerRow.FixedRowHeight = 80;

Aspose.Pdf.Cell cellHeaderRow = headerRow.Cells.Add(); cellHeaderRow.Alignment = Aspose.Pdf.AlignmentType.Left;

clsDataLayerCommonDB _clsCommanDB = new clsDataLayerCommonDB();

cellHeaderRow.Paragraphs.Add(new Aspose.Pdf.Text("manish",_clsCommanDB.StyleForNewsLink()));

header.Paragraphs.Add(headerTable);

document.Save(@"c:\download.pdf");


This message was posted using Aspose.Live 2 Forum

Hello Manish,

In order to display the text over the watermark being added to the document, please try setting the value of IsWatermarkOnTop property of Pdf class to false. But, I'm afraid in current version, if the text is placed inside the Header section and we set the value of IsWatermarkOnTop to false, still the text is being displayed behind it. For the sake of correction, I have logged it in our issue tracking system as PDFNET-15182. We will investigate this issue in details and will keep you updated on the status of a correction.

You may also check that if the text object is placed inside the Section element, and we place the Watermark over it, the text is properly being displayed. A sample PDF document is in attachment. Please take a look.

We apologize for your inconvenience.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

yes, i have also done it but i want to repeat the text as header, which is not posible using section.

let me know you finding on header text over floating box.

Hello Manish,

Thanks for your patience.

At the moment watermark support exits in page section only and our development team is working hard to make it available in the header area. However you can try using a workaround to accomplish your requirement. So In order to make the header watermark behind header text, please use floating box positioning BoxVerticalPositioningType.Paragraph, and also set the paragraph ID i.e.

headerFooter.Paragraphs[headerFooter.Paragraphs.Count - 1].ID = "float_2";
fbox2.ReferenceParagraphID = "float_2";
Please take a look over the following complete code snippet.
[C#]

//Instantiate a Pdf object by calling its empty constructor
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
//Create a section in the Pdf object
Aspose.Pdf.Section section = pdf.Sections.Add();

//Create an image object in the section
Aspose.Pdf.Image imgleftImg = new Aspose.Pdf.Image();
//Set the path of image file
imgleftImg.ImageInfo.File = @"d:/pdftest/Aspose.jpg";
FloatingBox fbox = new Aspose.Pdf.FloatingBox();
fbox.Paragraphs.Add(imgleftImg);
fbox.ZIndex = -1;
fbox.BoxHorizontalPositioning = BoxHorizontalPositioningType.Margin;
fbox.BoxHorizontalAlignment = BoxHorizontalAlignmentType.Left;
fbox.BoxVerticalPositioning = BoxVerticalPositioningType.Margin;
fbox.BoxVerticalAlignment = BoxVerticalAlignmentType.Top;
pdf.Watermarks.Add(fbox);
pdf.IsWatermarkOnTop = false;

// create sample text to be added to PDF section
for (int i = 0; i <= 5; i++)
{
section.Paragraphs.Add(new Text("page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text page text "));
}

//Instantiate HeaderFooter object
Aspose.Pdf.HeaderFooter headerFooter = new Aspose.Pdf.HeaderFooter();
// create a simple text object
Text HeaderText = new Text("header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text header text ");

// specify the color information for text object
HeaderText.TextInfo.Color = new Aspose.Pdf.Color("Pink");
// specify the font name information for text object
HeaderText.TextInfo.FontName = "Arial";
// add the text object to paragraphs collection of header object
headerFooter.Paragraphs.Add(HeaderText);
//Set the header of odd pages of the PDF document
section.OddHeader = headerFooter;
//Set the header of even pages of the PDF document
section.EvenHeader = headerFooter;

FloatingBox fbox2 = new Aspose.Pdf.FloatingBox();
// add the image to paragraphs collection of floatingbox
fbox2.Paragraphs.Add(imgleftImg);
// set the ZIndex order for FloatingBox. Floating box with negative ZIndex will be placed behind the text in the page.
fbox2.ZIndex = -1;
fbox2.BoxHorizontalPositioning = BoxHorizontalPositioningType.Margin;
fbox2.BoxHorizontalAlignment = BoxHorizontalAlignmentType.Left;
fbox2.BoxVerticalPositioning = BoxVerticalPositioningType.Paragraph;
headerFooter.Paragraphs[headerFooter.Paragraphs.Count - 1].ID = "float_2";
fbox2.ReferenceParagraphID = "float_2";
headerFooter.Paragraphs.Add(fbox2);

// save the PDF document
pdf.Save(@"d:/pdftest/Text_Over_FloatingBox.pdf");

Please take a look over the attached PDF document that I have generated using above code snippet while using Aspose.Pdf for.NET 4.7.0. In case it does not resolve your problem or you have any further query, please feel free to contact.

The issues you have found earlier (filed as 15182) have been fixed in this update.


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