使用 pdfiumViewer的库 浏览pdf文件的时候,pdf文件的注释批注不显示,经过查找临时修改了PDFFile.cs文件 RenderPDFPageToBitmap函数予以解决:
//flags &= ~NativeMethods.FPDF.ANNOT;
flags |= NativeMethods.FPDF.ANNOT;
修改了以后,浏览pdf文件可以正常显示批注,但是修改了这个以后,是否有其他不利影响,还在研究中。
public bool RenderPDFPageToBitmap(int pageNumber, IntPtr bitmapHandle, int dpiX, int dpiY, int boundsOriginX, int boundsOriginY, int boundsWidth, int boundsHeight, int rotate, NativeMethods.FPDF flags, bool renderFormFill)
{
if (_disposed)
throw new ObjectDisposedException(GetType().Name);
using (var pageData = new PageData(_document, _form, pageNumber))
{
if (renderFormFill)
//flags &= ~NativeMethods.FPDF.ANNOT;
flags |= NativeMethods.FPDF.ANNOT;
NativeMethods.FPDF_RenderPageBitmap(bitmapHandle, pageData.Page, boundsOriginX, boundsOriginY, boundsWidth, boundsHeight, rotate, flags);
if (renderFormFill)
NativeMethods.FPDF_FFLDraw(_form, bitmapHandle, pageData.Page, boundsOriginX, boundsOriginY, boundsWidth, boundsHeight, rotate, flags);
}
return true;
}