I cannot get PDF annotations to appear using pdfium viewer, but they show when using adobe. I am loading the image returned from this function into a picture box.
Furthermore, I have the following annotations on a PDF: text, shape, line.

internal static List<byte[]> GetTiffByteArrayFromPDF(string filePath, int DpiPdfX = 300, int DpiPdfY = 300)
{
List<byte[]> pdfPages = new List<byte[]>();
try
{
using (var pdfDocument = PdfDocument.Load(filePath))
{
for (int i = 0; i < pdfDocument.PageCount; i++)
{
using (MemoryStream memoryStream = new MemoryStream())
{
var pdfImage = pdfDocument.Render(i, DpiPdfX, DpiPdfY, PdfRenderFlags.CorrectFromDpi);
pdfImage.Save(memoryStream, ImageFormat.Tiff);
pdfPages.Add(memoryStream.ToArray());
}
}
}
}
catch (Exception e)
{
Log.Error(e.ToString());
Log.Error("GetTiffByteArrayFromPDF Error: " + e.Message);
Log.Error("Details: ");
Log.Error(e.ToString());
}
return pdfPages;
}
I have tried using PdfRenderFlags.Annotations alone and bitwise OR combined with PdfRenderFlags.CorrectFromDpi like PdfRenderFlags.CorrectFromDpi|PdfRenderFlags.Annotations.