Hi! I have an issue with stamps using Aspose 8.0. We are using stamps to modify a PDF document but when there is an image in the section, the stamp becomes bold. I have attached the image used in the code sample and the resulting PDF.
If the 3 lines mentioned by the comment are removed/commented, the generated PDF will have a stamp that is not bold.
The problem seems to be related to the image file type (PNG) because when I try a JPG, the stamp is not bold.
public static void StampBold()
{
Pdf pdf = new Pdf();
Section section = new Section(pdf);
section.IsLandscape = true;
pdf.Sections.Add(section);
section.Paragraphs.Add(new Text(“I am a normal text”));
// Comment the next 4 lines to observe that without the Image, the stamp is not bold
var graphique = new Image();
graphique.ImageInfo.File = @“D:\graphEsperanceVie.png”;
graphique.ImageInfo.ImageFileType = ImageFileType.Png;
section.Paragraphs.Add(graphique);
string filename = @“d:\BeforeStamp.pdf”;
pdf.Save(filename);
using (Aspose.Pdf.Document document = new Aspose.Pdf.Document(filename))
{
var stamp = new Aspose.Pdf.TextStamp(“I am a stamp! Why am I bold? I didn’t set FontStyles to Bold…”);
stamp.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont(“Arial”);
stamp.TextState.FontSize = 10;
stamp.TextState.FontStyle = Aspose.Pdf.Text.FontStyles.Regular;
stamp.VerticalAlignment = Aspose.Pdf.VerticalAlignment.Top;
stamp.TopMargin = 50;
document.Pages[1].AddStamp(stamp);
filename = @“D:\AfterStamp.pdf”;
document.Save(filename);
}
Process.Start(filename);
}
Thanks for investigating the issue,
Jean-François Rouleau