本文整理汇总了C++中CPDF_Page类的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Page类的具体用法?C++ CPDF_Page怎么用?C++ CPDF_Page使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPDF_Page类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FPDF_RenderPageBitmap_Start
DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int flags,
IFSDK_PAUSE* pause) {
if (!bitmap || !pause || pause->version != 1)
return FPDF_RENDER_FAILED;
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage)
return FPDF_RENDER_FAILED;
CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext;
pPage->SetRenderContext(WrapUnique(pContext));
CFX_FxgeDevice* pDevice = new CFX_FxgeDevice;
pContext->m_pDevice.reset(pDevice);
CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap);
pDevice->Attach(pBitmap, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false);
IFSDK_PAUSE_Adapter IPauseAdapter(pause);
FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
rotate, flags, FALSE, &IPauseAdapter);
if (pContext->m_pRenderer) {
return CPDF_ProgressiveRenderer::ToFPDFStatus(
pContext->m_pRenderer->GetStatus());
}
return FPDF_RENDER_FAILED;
}
示例2: FPDF_RenderPage_Continue
DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,IFSDK_PAUSE * pause)
{
if (page == NULL)
return FPDF_RENDER_FAILED;
if (!pause)
return FPDF_RENDER_FAILED;
if (pause->version !=1)
return FPDF_RENDER_FAILED;
CPDF_Page* pPage = (CPDF_Page*)page;
// FXMT_CSLOCK_OBJ(&pPage->m_PageLock);
CRenderContext * pContext = (CRenderContext*)pPage->GetPrivateData((void*)1);
if (pContext && pContext->m_pRenderer)
{
IFSDK_PAUSE_Adapter IPauseAdapter(pause);
pContext->m_pRenderer->Continue(&IPauseAdapter);
CPDF_ProgressiveRenderer::RenderStatus status = CPDF_ProgressiveRenderer::Failed;
status = pContext->m_pRenderer->GetStatus();
return status;
}
return FPDF_RENDER_FAILED;
}
示例3: FPDF_RenderPageBitmap
DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y,
int size_x, int size_y, int rotate, int flags)
{
if (bitmap == NULL || page == NULL) return;
CPDF_Page* pPage = (CPDF_Page*)page;
CRenderContext* pContext = new CRenderContext;
pPage->SetPrivateData((void*)1, pContext, DropContext);
#ifdef _SKIA_SUPPORT_
pContext->m_pDevice = new CFX_SkiaDevice;
if (flags & FPDF_REVERSE_BYTE_ORDER)
((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap,0,TRUE);
else
((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
#else
pContext->m_pDevice = new CFX_FxgeDevice;
if (flags & FPDF_REVERSE_BYTE_ORDER)
((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap,0,TRUE);
else
((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
#endif
Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate, flags,TRUE,NULL);
delete pContext;
pPage->RemovePrivateData((void*)1);
}
示例4: FPDFPage_New
DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
int page_index,
double width,
double height) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;
if (page_index < 0)
page_index = 0;
if (pDoc->GetPageCount() < page_index)
page_index = pDoc->GetPageCount();
CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(page_index);
if (!pPageDict)
return NULL;
CPDF_Array* pMediaBoxArray = new CPDF_Array;
pMediaBoxArray->Add(new CPDF_Number(0));
pMediaBoxArray->Add(new CPDF_Number(0));
pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(width)));
pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(height)));
pPageDict->SetAt("MediaBox", pMediaBoxArray);
pPageDict->SetAt("Rotate", new CPDF_Number(0));
pPageDict->SetAt("Resources", new CPDF_Dictionary);
CPDF_Page* pPage = new CPDF_Page;
pPage->Load(pDoc, pPageDict);
pPage->ParseContent();
return pPage;
}
示例5: FPDFPage_New
DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, int page_index, double width, double height)
{
if (!document)
return NULL;
// CPDF_Parser* pParser = (CPDF_Parser*)document;
CPDF_Document* pDoc = (CPDF_Document*)document;
if(page_index < 0)
page_index = 0;
if(pDoc->GetPageCount()<page_index)
page_index = pDoc->GetPageCount();
// if (page_index < 0 || page_index >= pDoc->GetPageCount())
// return NULL;
CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(page_index);
if(!pPageDict)
return NULL;
CPDF_Array* pMediaBoxArray = FX_NEW CPDF_Array;
pMediaBoxArray->Add(FX_NEW CPDF_Number(0));
pMediaBoxArray->Add(FX_NEW CPDF_Number(0));
pMediaBoxArray->Add(FX_NEW CPDF_Number(FX_FLOAT(width)));
pMediaBoxArray->Add(FX_NEW CPDF_Number(FX_FLOAT(height)));
pPageDict->SetAt("MediaBox", pMediaBoxArray);
pPageDict->SetAt("Rotate", FX_NEW CPDF_Number(0));
pPageDict->SetAt("Resources", FX_NEW CPDF_Dictionary);
CPDF_Page* pPage = FX_NEW CPDF_Page;
pPage->Load(pDoc,pPageDict);
pPage->ParseContent();
return pPage;
}
示例6: GetContentsRect
FX_BOOL GetContentsRect( CPDF_Document * pDoc, CPDF_Dictionary* pDict, CPDF_RectArray * pRectArray )
{
CPDF_Page* pPDFPage = FX_NEW CPDF_Page;
pPDFPage->Load( pDoc, pDict, FALSE );
pPDFPage->ParseContent();
FX_POSITION pos = pPDFPage->GetFirstObjectPosition();
while (pos)
{
CPDF_PageObject* pPageObject = pPDFPage->GetNextObject(pos);
if (!pPageObject)continue;
CPDF_Rect rc;
rc.left = pPageObject->m_Left;
rc.right = pPageObject->m_Right;
rc.bottom = pPageObject->m_Bottom;
rc.top = pPageObject->m_Top;
if (IsValiableRect(rc, pDict->GetRect("MediaBox")))
{
pRectArray->Add(rc);
}
}
delete pPDFPage;
return TRUE;
}
示例7: QueryWherePopup
void CFFL_InteractiveFormFiller::QueryWherePopup(
const CPWL_Wnd::PrivateData* pAttached,
float fPopupMin,
float fPopupMax,
bool* bBottom,
float* fPopupRet) {
auto* pData = static_cast<const CFFL_PrivateData*>(pAttached);
CPDFSDK_Widget* pWidget = pData->pWidget;
CPDF_Page* pPage = pWidget->GetPDFPage();
CFX_FloatRect rcPageView(0, pPage->GetPageHeight(), pPage->GetPageWidth(), 0);
rcPageView.Normalize();
CFX_FloatRect rcAnnot = pWidget->GetRect();
float fTop = 0.0f;
float fBottom = 0.0f;
switch (pWidget->GetRotate() / 90) {
default:
case 0:
fTop = rcPageView.top - rcAnnot.top;
fBottom = rcAnnot.bottom - rcPageView.bottom;
break;
case 1:
fTop = rcAnnot.left - rcPageView.left;
fBottom = rcPageView.right - rcAnnot.right;
break;
case 2:
fTop = rcAnnot.bottom - rcPageView.bottom;
fBottom = rcPageView.top - rcAnnot.top;
break;
case 3:
fTop = rcPageView.right - rcAnnot.right;
fBottom = rcAnnot.left - rcPageView.left;
break;
}
constexpr float kMaxListBoxHeight = 140;
const float fMaxListBoxHeight =
pdfium::clamp(kMaxListBoxHeight, fPopupMin, fPopupMax);
if (fBottom > fMaxListBoxHeight) {
*fPopupRet = fMaxListBoxHeight;
*bBottom = true;
return;
}
if (fTop > fMaxListBoxHeight) {
*fPopupRet = fMaxListBoxHeight;
*bBottom = false;
return;
}
if (fTop > fBottom) {
*fPopupRet = fTop;
*bBottom = false;
} else {
*fPopupRet = fBottom;
*bBottom = true;
}
}
示例8: FPDFPage_HasTransparency
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page)
{
if(!page) return FALSE;
CPDF_Page* pPage = (CPDF_Page*)page;
return pPage->BackgroundAlphaNeeded();
}
示例9: FPDFPage_GetObject
DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page,
int index) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!IsPageObject(pPage))
return nullptr;
return pPage->GetPageObjectList()->GetPageObjectByIndex(index);
}
示例10: IsFillingAllowed
bool CFFL_InteractiveFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) {
if (pWidget->GetFieldType() == FormFieldType::kPushButton)
return false;
CPDF_Page* pPage = pWidget->GetPDFPage();
uint32_t dwPermissions = pPage->GetDocument()->GetUserPermissions();
return (dwPermissions & FPDFPERM_FILL_FORM) ||
(dwPermissions & FPDFPERM_ANNOT_FORM) ||
(dwPermissions & FPDFPERM_MODIFY);
}
示例11: FPDFPage_CountObject
DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
!pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
"Page")) {
return -1;
}
return pPage->CountObjects();
}
示例12: FPDFPage_GetObject
DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page,
int index) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
"Page")) {
return NULL;
}
return pPage->GetObjectByIndex(index);
}
示例13: FPDFPage_InsertObject
DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_obj)
{
CPDF_Page* pPage = (CPDF_Page*)page;
if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || !pPage->m_pFormDict->GetElement("Type")->GetDirect()
|| pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare("Page"))
{
return;
}
CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_obj;
if(pPageObj == NULL)
return;
FX_POSITION LastPersition = pPage->GetLastObjectPosition();
pPage->InsertObject(LastPersition, pPageObj);
switch(pPageObj->m_Type)
{
case FPDF_PAGEOBJ_PATH:
{
CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj;
pPathObj->CalcBoundingBox();
break;
}
case FPDF_PAGEOBJ_TEXT:
{
// CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj;
// pPathObj->CalcBoundingBox();
break;
}
case FPDF_PAGEOBJ_IMAGE:
{
CPDF_ImageObject* pImageObj = (CPDF_ImageObject*)pPageObj;
pImageObj->CalcBoundingBox();
break;
}
case FPDF_PAGEOBJ_SHADING:
{
CPDF_ShadingObject* pShadingObj = (CPDF_ShadingObject*)pPageObj;
pShadingObj->CalcBoundingBox();
break;
}
case FPDF_PAGEOBJ_FORM:
{
CPDF_FormObject* pFormObj = (CPDF_FormObject*)pPageObj;
pFormObj->CalcBoundingBox();
break;
}
default:
break;
}
// pPage->ParseContent();
//pPage->GenerateContent();
}
示例14: PDF_GetTextStream_Unicode
void PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_Document* pDoc, CPDF_Dictionary* pPage, FX_DWORD flags)
{
buffer.EstimateSize(0, 10240);
CPDF_Page page;
page.Load(pDoc, pPage);
CPDF_ParseOptions options;
options.m_bTextOnly = TRUE;
options.m_bSeparateForm = FALSE;
page.ParseContent(&options);
_PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL);
}
示例15: FPDF_RenderPage_Close
DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage)
return;
CPDF_PageRenderContext* pContext = pPage->GetRenderContext();
if (!pContext)
return;
pContext->m_pDevice->RestoreState(false);
pPage->SetRenderContext(std::unique_ptr<CPDF_PageRenderContext>());
}