The program threw an NullReferenceException
when upgrading Aspose.PDF to 24.3. What I found was because I added a watermark on the page and getting the Rectangle
of the watermark threw an exception.
The old versions we use are normal and do not have this problem. Please help to confirm the reason.
Can you please share you sample file and the sample code snippet with us so that we can test the scenario in our environment and address it accordingly.
public static void AddWatermarks()
{
Document document = new Document();
document.Pages.Add();
WatermarkArtifact artifact = new WatermarkArtifact();
artifact.SetTextAndState(
"WATERMARK",
new Aspose.Pdf.Text.TextState()
{
FontSize = 72,
ForegroundColor = Aspose.Pdf.Color.Blue,
Font = Aspose.Pdf.Text.FontRepository.FindFont("Courier")
});
artifact.ArtifactHorizontalAlignment = HorizontalAlignment.Center;
artifact.ArtifactVerticalAlignment = VerticalAlignment.Center;
artifact.Rotation = 45;
artifact.Opacity = 0.5;
artifact.IsBackground = true;
document.Pages[1].Artifacts.Add(artifact);
//Unable to get the width of the watermark
double width = document.Pages[1].Artifacts[1].Rectangle.Width;
}
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFNET-56883
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
The issues you have found earlier (filed as PDFNET-56883) have been fixed in Aspose.PDF for .NET 24.4.