Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri Aug 09, 2024 9:37 am

Hi,

Thank you very much for your compromise plan.
I have reported your idea to the development team, and they will investigate whether this plan is feasible according to your requirements. Once there is a suitable implementation method, we will inform you in time.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Wed Aug 21, 2024 9:59 am

Hi,

Thank you for your patience and understanding.
Based on the compromise solution you provided, we have released a new version Spire.PDF Pack(Hot Fix) 10.8.1 that includes the fix for this issue. Please download the new version from the link below and refer to the following code for testing.

https://www.e-iceblue.com/Download/down ... t-now.html

Code: Select all
using (var pdfStream = File.OpenRead(inputFile))
using (var pdfDocument = new PdfDocument())
{   
  pdfDocument.LoadFromStream(pdfStream);   
  foreach (PdfPageBase page in pdfDocument.Pages)   
    {      
      foreach (PdfAnnotationWidget annotation in page.Annotations)      
        {         
          if (annotation is PdfMarkUpAnnotationWidget)         
            {            
              (annotation as PdfMarkUpAnnotationWidget).Opacity = 0.5f;
               using (var image = pdfDocument.SaveAsImage(0))            
               {               
                  image.Save(outputFile, System.Drawing.Imaging.ImageFormat.Png);
           }   
            }      
        }   
    }
}


Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.PDF