summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaepark <jaepark@google.com>2016-09-09 15:39:09 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-09 15:39:09 -0700
commit75f84a56fed36111ece82d0ac96e87289622b093 (patch)
treea1e1dc33250b3ec31032a2550298cd4af36c3211
parent55a1eb01db6ceadf9c180931b2663338b8cbc2fd (diff)
downloadpdfium-chromium/2857.tar.xz
Define behaviors of FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw.chromium/2858chromium/2857chromium/2856
Previously, PDFium only supported widget annotations to draw forms. As we've implemented other annotations, the behavior of FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw changed. So, this CL clearly defines what needs to be done in FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw. This CL first assumes that PDFium users will always call FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw to render PDF pages, because otherwise they are not able to support PDF forms. FPDF_RenderPageBitmap_Retail should only deal with non-widget annotations, such as highlight, underline, text, etc. If FPDF_ANNOT flag is passed, non-widget annotations are drawn. Otherwise, they are hidden. FPDF_FFLDraw should only deal with annotations that requires user-interaction, such as widget annotations and popup annotation. Since popup annotation is associated with non-widget annotation, they should not be drawn if the associated annotation is hidden. Thus, if FPDF_ANNOT flag is passed, popup annotations are drawn. Otherwise, they are hidden. Widget annotations should be always drawn regardless of FPDF_ANNOT flag since they need to be always displayed for PDF forms. Also, roll DEPS for testing/corpus to 8485b30. BUG=pdfium:594 Review-Url: https://codereview.chromium.org/2323203002
-rw-r--r--DEPS2
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render.cpp16
-rw-r--r--core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h2
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp25
-rw-r--r--core/fpdfdoc/include/cpdf_annot.h1
-rw-r--r--fpdfsdk/cpdfsdk_annothandlermgr.cpp6
-rw-r--r--fpdfsdk/cpdfsdk_baannothandler.cpp9
-rw-r--r--fpdfsdk/cpdfsdk_widgethandler.cpp3
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.cpp3
-rw-r--r--fpdfsdk/fpdfformfill.cpp1
-rw-r--r--fpdfsdk/fpdfview.cpp2
-rw-r--r--fpdfsdk/fsdk_mgr.cpp4
-rw-r--r--fpdfsdk/include/cpdfsdk_annothandlermgr.h3
-rw-r--r--fpdfsdk/include/cpdfsdk_baannothandler.h3
-rw-r--r--fpdfsdk/include/cpdfsdk_widgethandler.h3
-rw-r--r--fpdfsdk/include/cpdfsdk_xfawidgethandler.h3
-rw-r--r--fpdfsdk/include/ipdfsdk_annothandler.h3
-rw-r--r--public/fpdf_formfill.h19
-rw-r--r--public/fpdf_progressive.h5
-rw-r--r--public/fpdfview.h5
-rw-r--r--samples/pdfium_test.cc4
21 files changed, 90 insertions, 32 deletions
diff --git a/DEPS b/DEPS
index f87e9d6de2..e3ef8e8372 100644
--- a/DEPS
+++ b/DEPS
@@ -14,7 +14,7 @@ vars = {
'gmock_revision': '29763965ab52f24565299976b936d1265cb6a271',
'gtest_revision': '8245545b6dc9c4703e6496d1efd19e975ad2b038',
'icu_revision': '2341038bf72869a5683a893a2b319a48ffec7f62',
- 'pdfium_tests_revision': '6608bf041de1104595d3e9c0c18cd411d4757446',
+ 'pdfium_tests_revision': '8485b3093524ddb7319e0381ab10c576e59d5091',
'skia_revision': '39f7a10a04a914384944d8bf62621144ac4eeaa3',
'tools_memory_revision': '427f10475e1a8d72424c29d00bf689122b738e5d',
'trace_event_revision': '54b8455be9505c2cb0cf5c26bb86739c236471aa',
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index 887ea30a42..fbb0745506 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -100,7 +100,21 @@ CPDF_RenderOptions::CPDF_RenderOptions()
m_AddFlags(0),
m_pOCContext(nullptr),
m_dwLimitCacheSize(1024 * 1024 * 100),
- m_HalftoneLimit(-1) {}
+ m_HalftoneLimit(-1),
+ m_bDrawAnnots(false) {}
+
+CPDF_RenderOptions::CPDF_RenderOptions(const CPDF_RenderOptions& rhs)
+ : m_ColorMode(rhs.m_ColorMode),
+ m_BackColor(rhs.m_BackColor),
+ m_ForeColor(rhs.m_ForeColor),
+ m_Flags(rhs.m_Flags),
+ m_Interpolation(rhs.m_Interpolation),
+ m_AddFlags(rhs.m_AddFlags),
+ m_pOCContext(rhs.m_pOCContext),
+ m_dwLimitCacheSize(rhs.m_dwLimitCacheSize),
+ m_HalftoneLimit(rhs.m_HalftoneLimit),
+ m_bDrawAnnots(rhs.m_bDrawAnnots) {}
+
FX_ARGB CPDF_RenderOptions::TranslateColor(FX_ARGB argb) const {
if (m_ColorMode == RENDER_COLOR_NORMAL) {
return argb;
diff --git a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h
index 2590dbbd2d..7c513aea9e 100644
--- a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h
+++ b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h
@@ -36,6 +36,7 @@ class CPDF_OCContext;
class CPDF_RenderOptions {
public:
CPDF_RenderOptions();
+ CPDF_RenderOptions(const CPDF_RenderOptions& rhs);
FX_ARGB TranslateColor(FX_ARGB argb) const;
int m_ColorMode;
@@ -47,6 +48,7 @@ class CPDF_RenderOptions {
CPDF_OCContext* m_pOCContext;
uint32_t m_dwLimitCacheSize;
int m_HalftoneLimit;
+ bool m_bDrawAnnots;
};
#endif // CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDEROPTIONS_H_
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 4e0b04e9b6..0cc3596a4d 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -73,6 +73,16 @@ void CPDF_Annot::GenerateAPIfNeeded() {
CPVT_GenerateAP::GenerateUnderlineAP(m_pDocument, m_pAnnotDict);
}
+bool CPDF_Annot::ShouldDrawAnnotation() {
+ if (IsAnnotationHidden(m_pAnnotDict))
+ return false;
+
+ if (m_nSubtype == CPDF_Annot::Subtype::POPUP && !m_bOpenState)
+ return false;
+
+ return true;
+}
+
void CPDF_Annot::ClearCachedAP() {
m_APMap.clear();
}
@@ -294,10 +304,7 @@ FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage,
const CFX_Matrix* pUser2Device,
AppearanceMode mode,
const CPDF_RenderOptions* pOptions) {
- if (IsAnnotationHidden(m_pAnnotDict))
- return FALSE;
-
- if (m_nSubtype == CPDF_Annot::Subtype::POPUP && !m_bOpenState)
+ if (!ShouldDrawAnnotation())
return FALSE;
// It might happen that by the time this annotation instance was created,
@@ -322,6 +329,16 @@ FX_BOOL CPDF_Annot::DrawInContext(const CPDF_Page* pPage,
CPDF_RenderContext* pContext,
const CFX_Matrix* pUser2Device,
AppearanceMode mode) {
+ if (!ShouldDrawAnnotation())
+ return FALSE;
+
+ // It might happen that by the time this annotation instance was created,
+ // it was flagged as "hidden" (e.g. /F 2), and hence CPVT_GenerateAP decided
+ // to not "generate" its AP.
+ // If for a reason the object is no longer hidden, but still does not have
+ // its "AP" generated, generate it now.
+ GenerateAPIfNeeded();
+
CFX_Matrix matrix;
CPDF_Form* pForm =
FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix);
diff --git a/core/fpdfdoc/include/cpdf_annot.h b/core/fpdfdoc/include/cpdf_annot.h
index eb9f02a717..c16decc7d6 100644
--- a/core/fpdfdoc/include/cpdf_annot.h
+++ b/core/fpdfdoc/include/cpdf_annot.h
@@ -100,6 +100,7 @@ class CPDF_Annot {
private:
void GenerateAPIfNeeded();
+ bool ShouldDrawAnnotation();
// For regular annotations, |m_pAnnotDict| is not owned. For
// our artificially created popup annotations, |m_pAnnotDict|
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index 12362e3781..0fd48d2aa0 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -93,9 +93,11 @@ IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
+ CFX_Matrix* pUser2Device,
+ bool bDrawAnnots) {
ASSERT(pAnnot);
- GetAnnotHandler(pAnnot)->OnDraw(pPageView, pAnnot, pDevice, pUser2Device);
+ GetAnnotHandler(pAnnot)->OnDraw(pPageView, pAnnot, pDevice, pUser2Device,
+ bDrawAnnots);
}
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index 10071045ff..f0d67f4617 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -62,13 +62,16 @@ void CPDFSDK_BAAnnotHandler::DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
void CPDFSDK_BAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
+ CFX_Matrix* pUser2Device,
+ bool bDrawAnnots) {
#ifdef PDF_ENABLE_XFA
if (pAnnot->IsXFAField())
return;
#endif // PDF_ENABLE_XFA
- static_cast<CPDFSDK_BAAnnot*>(pAnnot)->DrawAppearance(
- pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
+ if (bDrawAnnots && pAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::POPUP) {
+ static_cast<CPDFSDK_BAAnnot*>(pAnnot)->DrawAppearance(
+ pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
+ }
}
void CPDFSDK_BAAnnotHandler::OnDelete(CPDFSDK_Annot* pAnnot) {}
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index b490daa8ba..8a061e5541 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -92,7 +92,8 @@ void CPDFSDK_WidgetHandler::DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
void CPDFSDK_WidgetHandler::OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
+ CFX_Matrix* pUser2Device,
+ bool bDrawAnnots) {
if (pAnnot->IsSignatureWidget()) {
static_cast<CPDFSDK_BAAnnot*>(pAnnot)->DrawAppearance(
pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index 74220118ce..8621f77dbd 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -46,7 +46,8 @@ CPDFSDK_Annot* CPDFSDK_XFAWidgetHandler::NewAnnot(CXFA_FFWidget* pAnnot,
void CPDFSDK_XFAWidgetHandler::OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
+ CFX_Matrix* pUser2Device,
+ bool bDrawAnnots) {
ASSERT(pPageView);
ASSERT(pAnnot);
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 449eac0870..2ac6c60999 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -114,6 +114,7 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
options.m_BackColor = 0xffffff;
}
options.m_AddFlags = flags >> 8;
+ options.m_bDrawAnnots = flags & FPDF_ANNOT;
#ifdef PDF_ENABLE_XFA
options.m_pOCContext = new CPDF_OCContext(pPDFDoc, CPDF_OCContext::View);
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 1c0af1dc10..4e20751f5d 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -896,7 +896,7 @@ void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext,
pContext->m_pAnnots.reset(new CPDF_AnnotList(pPage));
FX_BOOL bPrinting = pContext->m_pDevice->GetDeviceClass() != FXDC_DISPLAY;
pContext->m_pAnnots->DisplayAnnots(pPage, pContext->m_pContext.get(),
- bPrinting, &matrix, TRUE, nullptr);
+ bPrinting, &matrix, FALSE, nullptr);
}
pContext->m_pRenderer.reset(new CPDF_ProgressiveRenderer(
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index 694e3154ce..c8f387e903 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -12,6 +12,7 @@
#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
#include "core/fpdfdoc/include/cpdf_docjsactions.h"
#include "core/fpdfdoc/include/cpdf_interform.h"
#include "core/fxcrt/include/cfx_retain_ptr.h"
@@ -581,7 +582,8 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
CPDFSDK_AnnotIterator annotIterator(this, true);
while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) {
CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr();
- pAnnotHandlerMgr->Annot_OnDraw(this, pSDKAnnot, pDevice, pUser2Device);
+ pAnnotHandlerMgr->Annot_OnDraw(this, pSDKAnnot, pDevice, pUser2Device,
+ pOptions->m_bDrawAnnots);
}
}
diff --git a/fpdfsdk/include/cpdfsdk_annothandlermgr.h b/fpdfsdk/include/cpdfsdk_annothandlermgr.h
index 540bd985ac..f4be66a432 100644
--- a/fpdfsdk/include/cpdfsdk_annothandlermgr.h
+++ b/fpdfsdk/include/cpdfsdk_annothandlermgr.h
@@ -48,7 +48,8 @@ class CPDFSDK_AnnotHandlerMgr {
virtual void Annot_OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device);
+ CFX_Matrix* pUser2Device,
+ bool bDrawAnnots);
virtual void Annot_OnMouseEnter(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
diff --git a/fpdfsdk/include/cpdfsdk_baannothandler.h b/fpdfsdk/include/cpdfsdk_baannothandler.h
index 5425b0bf36..ba50df3ccb 100644
--- a/fpdfsdk/include/cpdfsdk_baannothandler.h
+++ b/fpdfsdk/include/cpdfsdk_baannothandler.h
@@ -44,7 +44,8 @@ class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler {
void OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) override;
+ CFX_Matrix* pUser2Device,
+ bool bDrawAnnots) override;
void OnCreate(CPDFSDK_Annot* pAnnot) override;
void OnLoad(CPDFSDK_Annot* pAnnot) override;
void OnDelete(CPDFSDK_Annot* pAnnot) override;
diff --git a/fpdfsdk/include/cpdfsdk_widgethandler.h b/fpdfsdk/include/cpdfsdk_widgethandler.h
index b8cb182bf9..d34510d092 100644
--- a/fpdfsdk/include/cpdfsdk_widgethandler.h
+++ b/fpdfsdk/include/cpdfsdk_widgethandler.h
@@ -44,7 +44,8 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler {
void OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) override;
+ CFX_Matrix* pUser2Device,
+ bool bDrawAnnots) override;
void OnCreate(CPDFSDK_Annot* pAnnot) override;
void OnLoad(CPDFSDK_Annot* pAnnot) override;
void OnDelete(CPDFSDK_Annot* pAnnot) override;
diff --git a/fpdfsdk/include/cpdfsdk_xfawidgethandler.h b/fpdfsdk/include/cpdfsdk_xfawidgethandler.h
index 10eb1eeb87..dec2675ed8 100644
--- a/fpdfsdk/include/cpdfsdk_xfawidgethandler.h
+++ b/fpdfsdk/include/cpdfsdk_xfawidgethandler.h
@@ -39,7 +39,8 @@ class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler {
void OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) override;
+ CFX_Matrix* pUser2Device,
+ bool bDrawAnnots) override;
void OnCreate(CPDFSDK_Annot* pAnnot) override;
void OnLoad(CPDFSDK_Annot* pAnnot) override;
void OnDelete(CPDFSDK_Annot* pAnnot) override;
diff --git a/fpdfsdk/include/ipdfsdk_annothandler.h b/fpdfsdk/include/ipdfsdk_annothandler.h
index 289d48007f..d2f9010b76 100644
--- a/fpdfsdk/include/ipdfsdk_annothandler.h
+++ b/fpdfsdk/include/ipdfsdk_annothandler.h
@@ -43,7 +43,8 @@ class IPDFSDK_AnnotHandler {
virtual void OnDraw(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) = 0;
+ CFX_Matrix* pUser2Device,
+ bool bDrawAnnots) = 0;
virtual void OnCreate(CPDFSDK_Annot* pAnnot) = 0;
virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0;
virtual void OnDelete(CPDFSDK_Annot* pAnnot) = 0;
diff --git a/public/fpdf_formfill.h b/public/fpdf_formfill.h
index 248bcd2b02..09674b007c 100644
--- a/public/fpdf_formfill.h
+++ b/public/fpdf_formfill.h
@@ -1483,7 +1483,8 @@ DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle);
/**
* Function: FPDF_FFLDraw
-* Render FormFeilds on a page to a device independent bitmap.
+* Render FormFields and popup window on a page to a device independent
+*bitmap.
* Parameters:
* hHandle - Handle to the form fill module. Returned by
*FPDFDOC_InitFormFillEnvironment.
@@ -1508,13 +1509,15 @@ DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle);
* Return Value:
* None.
* Comments:
-* This method is designed to only render annotations and FormFields on
-*the page.
-* Without FPDF_ANNOT specified for flags, Rendering functions such as
-*FPDF_RenderPageBitmap or FPDF_RenderPageBitmap_Start will only render page
-*contents(without annotations) to a bitmap.
-* In order to implement the FormFill functions,Implementation should
-*call this method after rendering functions finish rendering the page contents.
+* This function is designed to render annotations that are
+*user-interactive, which are widget annotation (for FormFields) and popup
+*annotation.
+* With FPDF_ANNOT flag, this function will render popup annotation
+*when users mouse-hover on non-widget annotation. Regardless of FPDF_ANNOT flag,
+*this function will always render widget annotations for FormFields.
+* In order to implement the FormFill functions, implementation should
+*call this function after rendering functions, such as FPDF_RenderPageBitmap or
+*FPDF_RenderPageBitmap_Start, finish rendering the page contents.
**/
DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
FPDF_BITMAP bitmap,
diff --git a/public/fpdf_progressive.h b/public/fpdf_progressive.h
index f352ff9d00..ffc812df77 100644
--- a/public/fpdf_progressive.h
+++ b/public/fpdf_progressive.h
@@ -66,7 +66,10 @@ typedef struct _IFSDK_PAUSE {
// 2 (rotated 180 degrees), 3 (rotated 90 degrees
// counter-clockwise).
// flags - 0 for normal display, or combination of flags
-// defined above.
+// defined in fpdfview.h. With FPDF_ANNOT flag, it
+// renders all annotations that does not require
+// user-interaction, which are all annotations except
+// widget and popup annotations.
// pause - The IFSDK_PAUSE interface.A callback mechanism
// allowing the page rendering process
// Return value:
diff --git a/public/fpdfview.h b/public/fpdfview.h
index cbb577b2fd..499124d6e8 100644
--- a/public/fpdfview.h
+++ b/public/fpdfview.h
@@ -595,7 +595,10 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
// 2 (rotated 180 degrees)
// 3 (rotated 90 degrees counter-clockwise)
// flags - 0 for normal display, or combination of flags
-// defined above.
+// defined above. With FPDF_ANNOT flag, it renders all
+// annotations that does not require user-interaction,
+// which are all annotations except widget and popup
+// annotations.
// Return value:
// None.
DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 421df39bf3..b78075e788 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -573,9 +573,9 @@ bool RenderPage(const std::string& name,
if (bitmap) {
FPDF_DWORD fill_color = alpha ? 0x00000000 : 0xFFFFFFFF;
FPDFBitmap_FillRect(bitmap, 0, 0, width, height, fill_color);
- FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0);
+ FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, FPDF_ANNOT);
- FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, 0);
+ FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, FPDF_ANNOT);
int stride = FPDFBitmap_GetStride(bitmap);
const char* buffer =
reinterpret_cast<const char*>(FPDFBitmap_GetBuffer(bitmap));