The annotation isn‘t displayed on the image converted from the page

Hi Aspose team,

When I use Aspose.Pdf for .NET, I found a problem.
.
When I add a text annotation to the pdf page, then convert this page into an image, I find that the annotation I added will not be displayed on the converted image (I used the sample code and tried jepg, png, bmp, emf, etc.).

But when I save the above pdf and open it with Adobe, I can see the annotation I added. And if I make some modification and saving the pdf, then do the convert using Aspose.Pdf, The annotation I added before will be displayed on the image normally this time.

Here is the file TextAnnotation.pdf (27.9 KB), and code snippet for adding text annotation:

public void AddAnnotation(int currentPage, string name, string commentText, Rectangle rect)
{
	Page page = _document.Pages[currentPage];
	
	TextAnnotation textAnnotation = new TextAnnotation(page, rect);
	textAnnotation.Name = name;
	textAnnotation.Title = "Sample";
	textAnnotation.Subject = "Sample";
	textAnnotation.State = AnnotationState.None;
	textAnnotation.Color = Color.Blue;
	textAnnotation.Contents = commentText;
	textAnnotation.Icon = TextIcon.Comment;
	textAnnotation.Flags = AnnotationFlags.NoZoom | AnnotationFlags.NoRotate | AnnotationFlags.Print;
	Border border = new Border(textAnnotation);
	border.Width = 1;

	page.Annotations.Add(textAnnotation);
}

The annotations directly added by Adobe can be displayed correctly on the converted image. Did I miss or mistake something when adding the annotation? How can I get the correct image with the annotation I added?

Best Regards!

@Glority_Developer

We were able to notice the issue at our side while using Aspose.PDF for .NET 20.12. However, could you please share below information with us for our reference so that we can log the issue accordingly and share the issue ID with you:

  • The sample code snippet to convert PDF to Image
  • The sample PDF document annotated using Adobe Reader along with generated output image.

The code snippets to convert PDF to Image,

  • Code snippet 1,

      Document pdfDocument = new Document(inputFileName);
      string fileDir = Path.GetDirectoryName(inputFileName);
      using (FileStream imageStream = new FileStream(fileDir + "//image.png", FileMode.Create))
      {
      	Resolution resolution = new Resolution(500);
      	PngDevice PngDevice = new PngDevice(resolution);
      	PngDevice.Process(pdfDocument.Pages[1], imageStream);
      	imageStream.Close();
      }
    
  • Code snippet 2,

      public BitmapImage GetPageImage(int currentPage)
      {
      	Page page = _document.Pages[currentPage];	
      	try
      	{
      		var memory = page.ConvertToPNGMemoryStream();
    
      		BitmapImage bitmap = new BitmapImage();
      		bitmap.BeginInit();
      		bitmap.StreamSource = memory;
      		bitmap.EndInit();
    
      		return bitmap;
      	}
      	catch (Exception e)
      	{
      		var ex = e.InnerException;
      	}
      	return null;
      }
    

The sample PDF document annotated using Adobe Reader AdobeAnnotation.pdf (35.0 KB) and the generated output image(by code snippet 1) AdobeAnnotation_image.png (480.7 KB)

@Glority_Developer

We have logged an issue as PDFNET-49196 in our issue tracking system with all relevant details of the case. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi Aspose team,

Did you have any progress on it? Looking forward to hearing from you.

@Glority_Developer

We regret to share that earlier logged ticket has not been resolved yet. We will surely post an update in this forum thread as soon as we have some regarding ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi Aspose team,

Did you have any progress on it? Will it be fixed within 1-2 months?

@Glority_Developer

We really regret to inform that the earlier logged ticket is not fully investigated yet and we are not certain about its fix ETA as it will be resolved on a first come first serve basis. We have recorded your concerns and will surely consider them during issue analysis. Please give us some time.

We apologize for your inconvenience.

Hi Aspose team,

Is this bug fixed or is there any progress?

@Glority_Developer

Regretfully, the issue could not get resolved due to other pending issue in the queue. However, we will surely let you know via this forum thread as soon as the ticket is fixed. We really apologize for the inconvenience and the delay you have been facing.

Aspose-

Is there an update on this? It is impeding our development also.

@ChadAll

We are afraid that the earlier logged ticket is not yet resolved. Your concerns have been recorded and we will surely inform you once we make some progress towards ticket resolution. We apologize for the inconvenience.

This is ridiculous with an issue has been logged from 2020 and still happening in 2025 without any fixes. Please update if you have any ways to fix this?

@cuongthieu

First of all, please accept our humble apology for the inconvenience you have been facing. Please confirm if you are with @ChadAll OR @Glority_Developer ? Can you please try flattening the PDF document first before converting it into image and let us know if issue still persists with the latest version of the API?

var pdfdocument = new Document(dataDir + "input.pdf");
pdfdocument.Flatten();

I’m with Glory. Attached the sample document and .Fatten() did not work.
Original_Doc.pdf (118.7 KB)

@cuongthieu

We could not find any text annotation inside the PDF you have shared. May be we are not looking into right direction. Can you please share where it exists on page by sharing a screenshot? We are sorry for the trouble.

Can you let me know why all the text disappeared after the image conversion?

@cuongthieu

The issue of disappearing text does not look related to the text annotations. It seems related to specific PDF structure. Similar cases are already under the phase of investigation and we have been working on resolving them in parallel to other fixes to the API.

A new ticket as PDFNET-59795 has been opened in our issue management system to investigate the reasons behind such behavior of the API against this type of PDF document. We have recorded your concerns as well and will surely consider them during the analysis. As soon as we make some progress towards ticket resolution, we will inform you.

We apologize for the inconvenience caused.

Thank you, do you have any estimation on when can we expect for the fix?

@cuongthieu

Tickets are prioritized on first come first serve basis in Free Support Model. However, we have raised your concerns already internally and will try to schedule both old and new ticket(s). As soon as some progress is made or we have any updates about their resolution ETA, we will inform you via this forum thread. Please spare us some time.

We are sorry for the inconvenience.