Free Support Forum - aspose.com

Pages Property of Stamp class does nothing?

I can apply a stamp just fine to a 16 page PDF if I do not set the Pages property.

But when I set the Pages property to be a valid integer array, of anything, even just an array consisting of “1”, I get no stamps on my document at all.

Any ideas??

Dear mgasystems,

Thank you for considering Aspose.

Could you please attatch your pdf files here and we can reproudct it.

Here is the code that reproduces this behavior. We are using an embedded resource for the stamp (attached to this post). For “input.pdf” we were using the documentation PDF that comes with Acrobat Reader 7, although any PDF we tried displays the same behavior.

If you comment out the “s.Pages =” line, it works fine (gets applied to every page).

If you uncomment it, no stamps appear on any pages (they should be on pages 1 and 2).

Dim stamp As New PdfFileStamp(“input.pdf”, “output.pdf”)

Dim s As New Stamp

Try
Dim stream As IO.Stream = System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(“WindowsApplication1.FTZ_Watermark.bmp”)

With s
.BindImage(stream)
.SetOrigin(20, 20)
.IsBackground = True
End With

s.Pages = New Integer() {1, 2}

stamp.AddStamp(s)

Finally
If Not stamp Is Nothing Then
stamp.Close()
End If
End Try

Dear mgasystems,

We will test it and reply you ASAP.

I have test it and all is right. Could you please attatch your pdfs here?

I have tested the attached file and all is ok. Did you used the latest version of Aspose.Pdf.Kit?

Looks like I committed the #1 mistake of bug reporting… I wasn’t using the latest version!

Upgrading to 1.9 seems to fix it, sorry to waste your time.