Stamp Won't Apply to All Pages

Any idea why this code only puts the stamp on the first few pages, and not on all 47 pages of the attached PDF?

I have attached the code and stamp all to this email in the zip file.

The PDF can be downloaded here:

http://www.mgaims.com/supportcenter/test.pdf

Thanks.

Thanks for considering Aspose.

The problem you have is produced in my machine. We will try to find out it's causes ASAP.

Please try the following codes as an example.

Dim inFile As String = "testStamp.pdf"
Dim outFile As String = "testStamped.pdf"
Dim aStamp As Aspose.Pdf.Kit.Stamp = New Aspose.Pdf.Kit.Stamp

Dim fs As System.IO.Stream = New System.IO.FileStream("FTZ_Watermark.bmp", IO.FileMode.Open, IO.FileAccess.Read)

aStamp.BindImage(fs)
'aStamp.IsBackground = False

'Assign a value to stamp's opacity
aStamp.Opacity() = 1

Dim pages As New ArrayList
For i As Integer = 1 To 47
pages.Add(i)
Next
aStamp.Pages = DirectCast(pages.ToArray(GetType(Integer)), Integer())

Dim stamper As Aspose.Pdf.Kit.PdfFileStamp = New Aspose.Pdf.Kit.PdfFileStamp(inFile, outFile)
stamper.AddStamp(aStamp)
stamper.Close()

This is still not working. The stamp does not get applied to all of the pages… some are skipped over.

Please see the following VB.Net project:

http://www.usadjustment.com/WindowsApplication1.zip

Also the Opacity property seems to do nothing… whether I set it to 0.1 or 1.0 the stamp looks exactly the same.

Please note: the code in the attached project looks for the PDF on the desktop… I included the PDF in the zip. So either move the PDF to the desktop, or change the code to look for it somewhere else.

Thanks.

Thanks for considering Aspose.

I 've reproduced the same error. I will inform our developers to find out reasons soon.

Please try following codes.

With s
.BindImage(stream)
.SetOrigin(20, 20)

' set the image is not background.
.IsBackground = False

End With

Dear mgasystems,

Thank you for considering Aspose.

2 qustions' answer:

1. "Stamp not apply to all pages".
You must set IsBackground property to false. Just like this:
aStamp.IsBackground = False

2. "Opacity property seems to do nothing"
Your code is wrong! You have set the Opacity property twice and the second one set the Opacity to 1 at all times.

Any more question is welcome.

Thanks, that took care of it.

Do you have any plans to support transparancy in stamps, or change the way the opacity works? In this example, I can set to opacity to 1, which blocks all the underlying text. If I set it to 50%, the underlying text is also affected. I was hoping I could have only the text in the stamp be 50% opacity, and not affect the text in the PDF itself.

See attached. You can see the underlying text bleeding through the stamp, but very very faint.

Thanks for considering Aspose.

We are now trying hard to solve this problem. Thanks for your patience.

We have done a detail test to compare with our product and Acrobat Professinal in stamp function. We found that our product provide the same function just like Acrobat Professinal.

If you set the stamp as backgroud(Stamp.IsBackground = True), then the stamp's opacity property would not affect the original text.

If you set the stamp NOT as backgroud(Stamp.IsBackground = False), then the stamp's opacity property would affect the underlying text. Acrobat Professional does the same affection.

So, If you don't want to affect the underlying text, you should set the IsBackgroud property to True.

Any more question is welcome.

Unfortunately, you recommended that I turn the IsBackground property to False (see above) in order to fix the fact that the stamp was not appearing on all pages.

Why does it not show on all pages if IsBackground is set to true? Does this have something to do with a z-ordering of layers in the PDF document?

Thanks for considering Aspose.

If some pages are images themselves, IsBackground = True seems not to work because it lies on the underly of images. In this case, Stamp.Opacity() = 1 doesn't work as well.

If IsBackground = False, it appears on the first lay of every page. In this case, Stamp.Opacity() = 1 does work as well.

Please see the attached sreenshot generated with the latter case.

Well, I guess the bottom line here is… is there anyway, using the PDF and stamp above (see original post), to get that stamp to show up on all pages of that PDF at 75% opacity, and NOT have it affect the underlying text?

That is the goal of all of this, and I am unable to get that to work.

I regret to say that we could not fulfil your requirement now, I have expressed the reason above.

We are try to accomplish this feature now, though we could not know if we can fix this problem or not.