Hi,
we just upgraded from the previous version 4 to 5.
Now, one of our existing reports has a problem with the background image.
We use following code to add the watermark :
Dim group2 As New PageElements.TransparencyGroup(1.0F, BlendMode.Overlay)
Dim gp2 As New PageElements.AnchorGroup(334, 311, Align.Center, VAlign.Center)
Dim lpath As String = "C:\<omitted>\logo_flou_back.jpg"
Dim limage As ceTe.DynamicPDF.PageElements.Image = New ceTe.DynamicPDF.PageElements.Image(lpath, 0, 0)
group2.Add(limage)
gp2.Add(group2)
For n As Integer = 0 To document.Pages.Count - 1
document.Pages(n).Elements.Add(gp2)
Next
The image file itself is already diffused.
With version 4 this resulted in a nice perfect watermark image, with other clear text label items on top of it.
With version 5, this diffuses the text labels which are on top of the added watermark image, which is strange.
It seems that with version 4 the added watermark image is automatically placed at the bottom of the items order, but with version 5, it is places on top of everything.
Any idea how this problem/bug can be resolved ?
Thanks
Arnout Symoens
Transparant Watermark Image Problem
Re: Transparant Watermark Image Problem
Support · Dec 15, 2009Hello Arnout Symoens,
Can you please try using the latest build of our product downloading from our CustomerArea
by logging in using your current serial number. If you are evaluating then please download it from our website
.
Generally the elements added in the last will be added on top of the other existing or already added elements. So if you are adding the image in the last then it will be added on top of other elements.
Also the way you are adding the image to all the pages is not efficient. It is advised to use a Templates when adding same elements to all the pages of the document. You can refer to the Templates
on out help documentation.
If you are still having a problem then please send over the sample code you are using, input files (images etc) and the description of the expected behavior and the problem you are having to our [^a|mailto:support@cete.com|Support Team^] so that they can help you further.
Thanks,
ceTe Software Support Team.
Re: Transparant Watermark Image Problem
Forum member · Dec 16, 2009Hi,
I was already using the latest version.
By using your help, I was able to fix it with the following code :
Dim centerX, centerY As Double
Dim lpageW As Double = document.Pages(0).Dimensions.Width
Dim lpageH As Double = document.Pages(0).Dimensions.Height
Dim lpageLeftMargin As Double = document.Pages(0).Dimensions.LeftMargin
Dim lpageRightMargin As Double = document.Pages(0).Dimensions.RightMargin
Dim lpageTopMargin As Double = document.Pages(0).Dimensions.TopMargin
Dim lpageBottomMargin As Double = document.Pages(0).Dimensions.BottomMargin
centerX = (lpageW - lpageLeftMargin - lpageRightMargin) / 2
centerY = (lpageH - lpageTopMargin - lpageBottomMargin) / 2
Dim lpath As String = "C:\<omitted>\logo_flou_back.jpg"
Dim limage As ceTe.DynamicPDF.PageElements.Image = New ceTe.DynamicPDF.PageElements.Image(lpath, centerX, centerY)
limage.VAlign = VAlign.Center
limage.Align = Align.Center
Dim MyTemplate As Template = New Template()
MyTemplate.Elements.Add(limage)
document.Template = MyTemplate
This places the jpg file as a background watermark, centered on each page.
Now what would be the correct way to center a rotated text label (left to right over the full page) stamp on the page (using StampTemplate) ?
Any help appreciated.
Greetings
Arnout SYmoens
Re: Transparant Watermark Image Problem
Support · Dec 16, 2009Hello Arnout Symoens,
You will have to calculate the X, Y position according to the page size and the size of the element you are adding considering the angle if it is having any to place the element at the center of the page. There is no method which can directly place the element at the center of the page.
Yes, you will have to use a StampTemplate if you want to add the elements on top of the existing content in the PDF.
Below is a sample code for adding a normal text at the center of the page. You can use the RightToLeft property of the label if you want to display the text in right to left model. If you use the angle to the label then you will have to calculate the X, Y considering the angle also.
Page page = new Page();
Label label = new Label("Stamp Text", 0, 0, Font.Helvetica.GetTextWidth("Stamp Text", 12), 30);
label.X = (page.Dimensions.Body.Width - l.Width) / 2;
label.Y = (page.Dimensions.Body.Height - l.Height) / 2;
Thanks,
ceTe Software Support Team.