Hello,
We are using Apose.PDF.Drawing 25.2
When we create a LineAnnotation and set the Opacity property to value lower then 1, it is not taken into account in the generated PDF when it is opened with Acrobat, Chrome or Wondershare PDFElement. As soon as the annotation is moved in Accrobat, the line appearance is updated with the value set Through Aspose Opacity property.
We have not noticed this stange behaviour with the other drawing annotations (SquareAnnotation, CircleAnnotation, …).
Is there any other property to use with the LineAnnotation? Is it a bug?
Regards
zones_page.pdf (24.9 KB)
@tfipsrd
It seems that you are experiencing an issue with the Opacity property of the LineAnnotation in Aspose.PDF.Drawing version 25.2. When you set the Opacity to a value lower than 1, it does not reflect in the generated PDF until the annotation is moved in Acrobat, which is indeed unusual behavior.
Currently, the LineAnnotation class allows you to set various properties such as color, width, and styles for the line. However, it appears that the Opacity property may not be functioning as expected for LineAnnotations, unlike other annotation types such as SquareAnnotation or CircleAnnotation, where opacity settings are applied correctly.
As a workaround, you might want to consider the following steps:
-
Update Aspose.PDF: Ensure you are using the latest version of Aspose.PDF, as bugs are often fixed in newer releases. Check the release notes for any updates related to annotations.
-
Reapply the Opacity: After creating the LineAnnotation, try reapplying the Opacity property after the PDF document is generated. This might force the viewer to refresh the appearance of the annotation.
-
Contact Support: If the issue persists, it may be beneficial to report this behavior to Aspose support as a potential bug. Provide them with a sample code snippet and the specific version you are using.
Here is a simple code snippet to create a LineAnnotation with opacity:
using Aspose.Pdf;
using Aspose.Pdf.Annotations;
// Create a new PDF document
Document pdfDocument = new Document();
// Add a page to the document
Page page = pdfDocument.Pages.Add();
// Create a LineAnnotation
LineAnnotation lineAnnotation = new LineAnnotation(page, new Aspose.Pdf.Rectangle(100, 100, 200, 200))
{
Color = Color.Red,
Opacity = 0.5f, // Set opacity
LineWidth = 2
};
// Add the annotation to the page
page.Annotations.Add(lineAnnotation);
// Save the document
pdfDocument.Save("output.pdf");
If you continue to face issues, please consider checking the Aspose documentation or forums for any similar reports or solutions.
If you have any further questions or need additional assistance, feel free to ask!
Hi
I’ve tried the workaround (reapply the opacity), but it does not help, result is the same.
@tfipsrd
Can you please share the sample code snippet that you are using at your end? Is it similar to what bot has shared in previous response?
Yes, it is the similar to what bot has provided.
@tfipsrd
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-59508
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.