Stamp becomes bold when an Image is in the section

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

Hi there,


Thanks for your inquiry. I’m afraid I’m unable to replicate the reported issue. Please find attached PDF documents and view these at same zoom level. Compare AfterStampwoimage.pdf and AfterStamp.pdf with AfterStampimagebold.pdf, hopefully it will help to observe the difference. If issue persist then please share your output stamped PDF documents with and without image. So we will look into it and provide you more information accordingly.

Sorry for the inconvenience faced

Best Regards,

Hi! I opened your 3 PDFs and I can see my issue. If I read your message correctly, you do not see the difference between the 3 PDFs? What is the code change between the 2 PDFs that have the image?


I have attached screenshots of each PDF so you can clearly see what I see on my side. In ScreenshotWithoutImage,jpg, the stamp is regular. In ScreenshotWithImage.jpg, the stamp looks bold. In ScreenshotWithImageBolder.jpg, it seems the stamp is bolder. I have also attached the PDF I was supposed to send you first (the one with the image and the bold stamp).

You can also see that in all my screenshots, the zoom level was 74,4%. So at same zoom level, the stamp does not look the same.

Can you see the difference in the screenshots? Do you see the difference in the 2 PDF files that I uploaded?

Thanks,

Jean-François Rouleau

Hi there,


Thanks for your feedback. One of my shared Pdf document with image is with regular font style and other with bold. After further investigation, I’m able to notice your reported issue, as stamp text with image section become a bit bold whereas with bold font style stamp becomes bolder. I’ve logged the issue as PDFNEWNET-35306 for further investigation and resolution. We will nofity you via this thread once its resolved.

Sorry for the inconvenience faced.

Best Regards,

Hi Jean-François,


Thanks for your patience. While investigating the issue, we’ve found that the above reported issue has been fixed in result of some other fix. Please find enclosed sample output. Can you please download, try latest version of Aspose.Pdf for .NET and confirm the results. So we close the ticket or investigate further accordingly to your feedback.

Best Regards,