I’ve searched the forums [and the web], but couldn’t really find anything helpful. I use Visual Basic and I’m currently using ImageStamp in Aspose.Pdf instead of Aspose.Pdf.Facades.Stamp [see also here], but I don’t have a preference either way yet.
The image I want to add as a stamp is a resource file contained in my
project. The constructor for ImageStamp(), and I think for
Facades.Stamp() as well, requires the file path to initialise a new
object. I’ve tried using a file stream, which works in getting me the images as stamps [although it’s rather ugly], however for some reason the position of the stamps gets skewed now. I swear I have not changed anyhing in my code besides how the ImageStamp object is initialised.
Old:
Dim imageStamp as new ImageStamp("C:/path/to/file.png")
[...]
Me.workingCopy.Pages(pageNumber).AddStamp(imageStamp)
New:
Dim imageStamp As ImageStamp
Dim assembly As Assembly = GetType(Stamp).Assembly
Using reader As New StreamReader(assembly.GetManifestResourceStream("$namespace.file.png"))
imageStamp = New ImageStamp(reader.BaseStream)
[...]
Me.workingCopy.Pages(pageNumber).AddStamp(imageStamp)
End Using
Any suggestions?