Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdfsdk_helpers.cpp File Reference

(9c1f44f67466fea2fb20bb6f31fea388d8c65961)

#include "fpdfsdk/cpdfsdk_helpers.h"
#include <utility>
#include "build/build_config.h"
#include "constants/form_fields.h"
#include "constants/stream_dict_common.h"
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fpdfapi/render/cpdf_renderoptions.h"
#include "core/fpdfdoc/cpdf_annot.h"
#include "core/fpdfdoc/cpdf_interactiveform.h"
#include "core/fpdfdoc/cpdf_metadata.h"
#include "core/fxcrt/span_util.h"
#include "core/fxcrt/unowned_ptr.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "third_party/base/check.h"
#include "third_party/base/numerics/safe_conversions.h"
+ Include dependency graph for cpdfsdk_helpers.cpp:

Go to the source code of this file.

Functions

IPDF_PageIPDFPageFromFPDFPage (FPDF_PAGE page)
 
FPDF_PAGE FPDFPageFromIPDFPage (IPDF_Page *page)
 
CPDF_DocumentCPDFDocumentFromFPDFDocument (FPDF_DOCUMENT doc)
 
FPDF_DOCUMENT FPDFDocumentFromCPDFDocument (CPDF_Document *doc)
 
CPDF_PageCPDFPageFromFPDFPage (FPDF_PAGE page)
 
CPDFSDK_InteractiveFormFormHandleToInteractiveForm (FPDF_FORMHANDLE hHandle)
 
ByteString ByteStringFromFPDFWideString (FPDF_WIDESTRING wide_string)
 
WideString WideStringFromFPDFWideString (FPDF_WIDESTRING wide_string)
 
RetainPtr< const CPDF_ArrayGetQuadPointsArrayFromDictionary (const CPDF_Dictionary *dict)
 
RetainPtr< CPDF_ArrayGetMutableQuadPointsArrayFromDictionary (CPDF_Dictionary *dict)
 
RetainPtr< CPDF_ArrayAddQuadPointsArrayToDictionary (CPDF_Dictionary *dict)
 
bool IsValidQuadPointsIndex (const CPDF_Array *array, size_t index)
 
bool GetQuadPointsAtIndex (RetainPtr< const CPDF_Array > array, size_t quad_index, FS_QUADPOINTSF *quad_points)
 
CFX_PointF CFXPointFFromFSPointF (const FS_POINTF &point)
 
CFX_FloatRect CFXFloatRectFromFSRectF (const FS_RECTF &rect)
 
FS_RECTF FSRectFFromCFXFloatRect (const CFX_FloatRect &rect)
 
CFX_Matrix CFXMatrixFromFSMatrix (const FS_MATRIX &matrix)
 
FS_MATRIX FSMatrixFromCFXMatrix (const CFX_Matrix &matrix)
 
unsigned long NulTerminateMaybeCopyAndReturnLength (const ByteString &text, void *buffer, unsigned long buflen)
 
unsigned long Utf16EncodeMaybeCopyAndReturnLength (const WideString &text, void *buffer, unsigned long buflen)
 
unsigned long GetRawStreamMaybeCopyAndReturnLength (RetainPtr< const CPDF_Stream > stream, pdfium::span< uint8_t > buffer)
 
unsigned long DecodeStreamMaybeCopyAndReturnLength (RetainPtr< const CPDF_Stream > stream, pdfium::span< uint8_t > buffer)
 
void SetPDFSandboxPolicy (FPDF_DWORD policy, FPDF_BOOL enable)
 
FPDF_BOOL IsPDFSandboxPolicyEnabled (FPDF_DWORD policy)
 
void SetPDFUnsupportInfo (UNSUPPORT_INFO *unsp_info)
 
void ReportUnsupportedFeatures (const CPDF_Document *pDoc)
 
void ReportUnsupportedXFA (const CPDF_Document *pDoc)
 
void CheckForUnsupportedAnnot (const CPDF_Annot *pAnnot)
 
void ProcessParseError (CPDF_Parser::Error err)
 
void SetColorFromScheme (const FPDF_COLORSCHEME *pColorScheme, CPDF_RenderOptions *pRenderOptions)
 
std::vector< uint32_t > ParsePageRangeString (const ByteString &bsPageRange, uint32_t nCount)
 

Function Documentation

◆ AddQuadPointsArrayToDictionary()

RetainPtr< CPDF_Array > AddQuadPointsArrayToDictionary ( CPDF_Dictionary * dict)

Definition at line 235 of file cpdfsdk_helpers.cpp.

◆ ByteStringFromFPDFWideString()

ByteString ByteStringFromFPDFWideString ( FPDF_WIDESTRING wide_string)

Definition at line 208 of file cpdfsdk_helpers.cpp.

References fxcrt::WideString::ToUTF8(), and WideStringFromFPDFWideString().

Referenced by FPDFAttachment_SetStringValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CFXFloatRectFromFSRectF()

CFX_FloatRect CFXFloatRectFromFSRectF ( const FS_RECTF & rect)

Definition at line 268 of file cpdfsdk_helpers.cpp.

References CFX_FloatRect::CFX_FloatRect().

Referenced by FPDF_RenderPageBitmapWithMatrix(), FPDFAnnot_SetRect(), and FPDFPage_TransFormWithClip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CFXMatrixFromFSMatrix()

CFX_Matrix CFXMatrixFromFSMatrix ( const FS_MATRIX & matrix)

Definition at line 276 of file cpdfsdk_helpers.cpp.

References CFX_Matrix::CFX_Matrix().

Referenced by FPDF_RenderPageBitmapWithMatrix(), FPDFPage_TransFormWithClip(), and FPDFPageObj_SetMatrix().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CFXPointFFromFSPointF()

CFX_PointF CFXPointFFromFSPointF ( const FS_POINTF & point)

Definition at line 264 of file cpdfsdk_helpers.cpp.

◆ CheckForUnsupportedAnnot()

void CheckForUnsupportedAnnot ( const CPDF_Annot * pAnnot)

Definition at line 392 of file cpdfsdk_helpers.cpp.

References CPDF_Annot::FILEATTACHMENT, CPDF_Annot::GetAnnotDict(), CPDF_Dictionary::GetByteStringFor(), CPDF_Annot::GetSubtype(), pdfium::form_fields::kFT, pdfium::form_fields::kSig, CPDF_Annot::MOVIE, fxcrt::ByteString::operator!=(), fxcrt::ByteString::operator==(), CPDF_Annot::RICHMEDIA, CPDF_Annot::SCREEN, CPDF_Annot::SOUND, CPDF_Annot::THREED, and CPDF_Annot::WIDGET.

Referenced by CPDFSDK_PageView::LoadFXAnnots().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CPDFDocumentFromFPDFDocument()

CPDF_Document * CPDFDocumentFromFPDFDocument ( FPDF_DOCUMENT doc)

Definition at line 190 of file cpdfsdk_helpers.cpp.

Referenced by FPDF_CopyViewerPreferences(), FPDF_CountNamedDests(), FPDF_DocumentHasValidCrossReferenceTable(), FPDF_GetDocPermissions(), FPDF_GetDocUserPermissions(), FPDF_GetFileIdentifier(), FPDF_GetFileVersion(), FPDF_GetFormType(), FPDF_GetMetaText(), FPDF_GetNamedDest(), FPDF_GetNamedDestByName(), FPDF_GetPageCount(), FPDF_GetPageLabel(), FPDF_GetPageSizeByIndexF(), FPDF_GetSecurityHandlerRevision(), FPDF_GetSignatureCount(), FPDF_GetSignatureObject(), FPDF_GetTrailerEnds(), FPDF_GetXFAPacketContent(), FPDF_GetXFAPacketCount(), FPDF_GetXFAPacketName(), FPDF_ImportNPagesToOne(), FPDF_ImportPages(), FPDF_ImportPagesByIndex(), FPDF_LoadPage(), FPDF_MovePages(), FPDF_NewXObjectFromPage(), FPDF_VIEWERREF_GetDuplex(), FPDF_VIEWERREF_GetName(), FPDF_VIEWERREF_GetNumCopies(), FPDF_VIEWERREF_GetPrintPageRange(), FPDF_VIEWERREF_GetPrintScaling(), FPDFAction_GetDest(), FPDFAction_GetURIPath(), FPDFAttachment_SetFile(), FPDFAvail_GetFirstPageNum(), FPDFBookmark_Find(), FPDFBookmark_GetDest(), FPDFBookmark_GetFirstChild(), FPDFBookmark_GetNextSibling(), FPDFCatalog_IsTagged(), FPDFDest_GetDestPageIndex(), FPDFDoc_AddAttachment(), FPDFDoc_DeleteAttachment(), FPDFDoc_GetAttachment(), FPDFDoc_GetAttachmentCount(), FPDFDoc_GetJavaScriptAction(), FPDFDoc_GetJavaScriptActionCount(), FPDFDoc_GetPageMode(), FPDFDOC_InitFormFillEnvironment(), FPDFImageObj_GetRenderedBitmap(), FPDFLink_GetDest(), FPDFPage_Delete(), FPDFPage_New(), FPDFPageObj_CreateTextObj(), FPDFPageObj_NewImageObj(), FPDFPageObj_NewTextObj(), FPDFText_LoadFont(), FPDFText_LoadStandardFont(), and FPDFTextObj_GetRenderedBitmap().

◆ CPDFPageFromFPDFPage()

CPDF_Page * CPDFPageFromFPDFPage ( FPDF_PAGE page)

Definition at line 198 of file cpdfsdk_helpers.cpp.

References IPDF_Page::AsPDFPage(), and IPDFPageFromFPDFPage().

Referenced by FORM_DoPageAAction(), FPDF_GetPageAAction(), FPDF_GetPageBoundingBox(), FPDF_RenderPage_Close(), FPDF_RenderPage_Continue(), FPDF_RenderPageBitmap(), FPDF_RenderPageBitmapWithColorScheme_Start(), FPDF_RenderPageBitmapWithMatrix(), FPDF_StructTree_GetForPage(), FPDFAnnot_GetFormFieldAtPoint(), FPDFImageObj_GetImageMetadata(), FPDFImageObj_GetRenderedBitmap(), FPDFImageObj_SetBitmap(), FPDFLink_Enumerate(), FPDFLink_GetAnnot(), FPDFLink_GetLinkAtPoint(), FPDFLink_GetLinkZOrderAtPoint(), FPDFPage_CountObjects(), FPDFPage_CreateAnnot(), FPDFPage_Flatten(), FPDFPage_FormFieldZOrderAtPoint(), FPDFPage_GenerateContent(), FPDFPage_GetAnnot(), FPDFPage_GetAnnotCount(), FPDFPage_GetAnnotIndex(), FPDFPage_GetArtBox(), FPDFPage_GetBleedBox(), FPDFPage_GetCropBox(), FPDFPage_GetMediaBox(), FPDFPage_GetObject(), FPDFPage_GetRotation(), FPDFPage_GetThumbnailAsBitmap(), FPDFPage_GetTrimBox(), FPDFPage_HasFormFieldAtPoint(), FPDFPage_HasTransparency(), FPDFPage_InsertClipPath(), FPDFPage_InsertObject(), FPDFPage_RemoveAnnot(), FPDFPage_RemoveObject(), FPDFPage_SetArtBox(), FPDFPage_SetBleedBox(), FPDFPage_SetCropBox(), FPDFPage_SetMediaBox(), FPDFPage_SetRotation(), FPDFPage_SetTrimBox(), FPDFPage_TransformAnnots(), FPDFPage_TransFormWithClip(), FPDFText_LoadPage(), FPDFTextObj_GetRenderedBitmap(), and TEST_F().

+ Here is the call graph for this function:

◆ DecodeStreamMaybeCopyAndReturnLength()

unsigned long DecodeStreamMaybeCopyAndReturnLength ( RetainPtr< const CPDF_Stream > stream,
pdfium::span< uint8_t > buffer )

Definition at line 312 of file cpdfsdk_helpers.cpp.

◆ FormHandleToInteractiveForm()

CPDFSDK_InteractiveForm * FormHandleToInteractiveForm ( FPDF_FORMHANDLE hHandle)

Definition at line 202 of file cpdfsdk_helpers.cpp.

References CPDFSDKFormFillEnvironmentFromFPDFFormHandle(), and CPDFSDK_FormFillEnvironment::GetInteractiveForm().

Referenced by FPDF_RemoveFormFieldHighlight(), FPDF_SetFormFieldHighlightAlpha(), FPDF_SetFormFieldHighlightColor(), FPDFAnnot_GetFontSize(), FPDFAnnot_GetFormControlIndex(), FPDFAnnot_GetFormFieldAtPoint(), FPDFPage_FormFieldZOrderAtPoint(), and FPDFPage_HasFormFieldAtPoint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FPDFDocumentFromCPDFDocument()

FPDF_DOCUMENT FPDFDocumentFromCPDFDocument ( CPDF_Document * doc)

Definition at line 194 of file cpdfsdk_helpers.cpp.

◆ FPDFPageFromIPDFPage()

FPDF_PAGE FPDFPageFromIPDFPage ( IPDF_Page * page)

Definition at line 186 of file cpdfsdk_helpers.cpp.

◆ FSMatrixFromCFXMatrix()

FS_MATRIX FSMatrixFromCFXMatrix ( const CFX_Matrix & matrix)

Definition at line 280 of file cpdfsdk_helpers.cpp.

References CFX_Matrix::a, CFX_Matrix::b, CFX_Matrix::c, CFX_Matrix::d, CFX_Matrix::e, and CFX_Matrix::f.

Referenced by FPDFPageObj_GetMatrix(), and FPDFText_GetMatrix().

+ Here is the caller graph for this function:

◆ FSRectFFromCFXFloatRect()

FS_RECTF FSRectFFromCFXFloatRect ( const CFX_FloatRect & rect)

Definition at line 272 of file cpdfsdk_helpers.cpp.

References CFX_FloatRect::bottom, CFX_FloatRect::left, CFX_FloatRect::right, and CFX_FloatRect::top.

Referenced by FPDFAnnot_GetRect(), and FPDFLink_GetAnnotRect().

+ Here is the caller graph for this function:

◆ GetMutableQuadPointsArrayFromDictionary()

RetainPtr< CPDF_Array > GetMutableQuadPointsArrayFromDictionary ( CPDF_Dictionary * dict)

Definition at line 229 of file cpdfsdk_helpers.cpp.

◆ GetQuadPointsArrayFromDictionary()

RetainPtr< const CPDF_Array > GetQuadPointsArrayFromDictionary ( const CPDF_Dictionary * dict)

Definition at line 224 of file cpdfsdk_helpers.cpp.

References CPDF_Dictionary::GetArrayFor().

+ Here is the call graph for this function:

◆ GetQuadPointsAtIndex()

bool GetQuadPointsAtIndex ( RetainPtr< const CPDF_Array > array,
size_t quad_index,
FS_QUADPOINTSF * quad_points )

Definition at line 243 of file cpdfsdk_helpers.cpp.

◆ GetRawStreamMaybeCopyAndReturnLength()

unsigned long GetRawStreamMaybeCopyAndReturnLength ( RetainPtr< const CPDF_Stream > stream,
pdfium::span< uint8_t > buffer )

Definition at line 305 of file cpdfsdk_helpers.cpp.

◆ IPDFPageFromFPDFPage()

IPDF_Page * IPDFPageFromFPDFPage ( FPDF_PAGE page)

Definition at line 182 of file cpdfsdk_helpers.cpp.

Referenced by CPDFPageFromFPDFPage(), FORM_DoPageAAction(), FORM_OnBeforeClosePage(), FPDF_ClosePage(), FPDF_DeviceToPage(), FPDF_GetPageHeightF(), FPDF_GetPageWidthF(), FPDF_PageToDevice(), FPDFLink_GetAnnot(), FPDFPage_CreateAnnot(), FPDFPage_GetAnnot(), and CPDFSDK_BAAnnotTest::SetUpBAAnnot().

+ Here is the caller graph for this function:

◆ IsPDFSandboxPolicyEnabled()

FPDF_BOOL IsPDFSandboxPolicyEnabled ( FPDF_DWORD policy)

Definition at line 333 of file cpdfsdk_helpers.cpp.

Referenced by FPDF_CreateNewDocument(), and fxjs::FX_GetDateTime().

+ Here is the caller graph for this function:

◆ IsValidQuadPointsIndex()

bool IsValidQuadPointsIndex ( const CPDF_Array * array,
size_t index )

Definition at line 239 of file cpdfsdk_helpers.cpp.

◆ NulTerminateMaybeCopyAndReturnLength()

unsigned long NulTerminateMaybeCopyAndReturnLength ( const ByteString & text,
void * buffer,
unsigned long buflen )

Definition at line 284 of file cpdfsdk_helpers.cpp.

References fxcrt::ByteString::c_str().

Referenced by FPDFAction_GetFilePath(), FPDFImageObj_GetImageFilter(), and FPDFSignatureObj_GetSubFilter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ParsePageRangeString()

std::vector< uint32_t > ParsePageRangeString ( const ByteString & bsPageRange,
uint32_t nCount )

Definition at line 466 of file cpdfsdk_helpers.cpp.

◆ ProcessParseError()

void ProcessParseError ( CPDF_Parser::Error err)

Definition at line 429 of file cpdfsdk_helpers.cpp.

References CPDF_Parser::FILE_ERROR, CPDF_Parser::FORMAT_ERROR, FXSYS_SetLastError(), CPDF_Parser::HANDLER_ERROR, CPDF_Parser::PASSWORD_ERROR, and CPDF_Parser::SUCCESS.

Referenced by FPDFAvail_GetDocument().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReportUnsupportedFeatures()

void ReportUnsupportedFeatures ( const CPDF_Document * pDoc)

Definition at line 348 of file cpdfsdk_helpers.cpp.

References CPDF_Document::GetRoot(), CPDF_Dictionary::KeyExist(), and fxcrt::ByteString::operator==().

+ Here is the call graph for this function:

◆ ReportUnsupportedXFA()

void ReportUnsupportedXFA ( const CPDF_Document * pDoc)

Definition at line 387 of file cpdfsdk_helpers.cpp.

References CPDF_Document::GetExtension().

Referenced by FPDFDOC_InitFormFillEnvironment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetColorFromScheme()

void SetColorFromScheme ( const FPDF_COLORSCHEME * pColorScheme,
CPDF_RenderOptions * pRenderOptions )

Definition at line 452 of file cpdfsdk_helpers.cpp.

References CPDF_RenderOptions::ColorScheme::path_fill_color, CPDF_RenderOptions::ColorScheme::path_stroke_color, CPDF_RenderOptions::SetColorScheme(), CPDF_RenderOptions::ColorScheme::text_fill_color, and CPDF_RenderOptions::ColorScheme::text_stroke_color.

+ Here is the call graph for this function:

◆ SetPDFSandboxPolicy()

void SetPDFSandboxPolicy ( FPDF_DWORD policy,
FPDF_BOOL enable )

Definition at line 319 of file cpdfsdk_helpers.cpp.

Referenced by FPDF_SetSandBoxPolicy().

+ Here is the caller graph for this function:

◆ SetPDFUnsupportInfo()

void SetPDFUnsupportInfo ( UNSUPPORT_INFO * unsp_info)

Definition at line 344 of file cpdfsdk_helpers.cpp.

Referenced by FSDK_SetUnSpObjProcessHandler().

+ Here is the caller graph for this function:

◆ Utf16EncodeMaybeCopyAndReturnLength()

unsigned long Utf16EncodeMaybeCopyAndReturnLength ( const WideString & text,
void * buffer,
unsigned long buflen )

Definition at line 294 of file cpdfsdk_helpers.cpp.

References fxcrt::ByteString::c_str(), and fxcrt::WideString::ToUTF16LE().

Referenced by FORM_GetFocusedText(), FORM_GetSelectedText(), FPDF_GetMetaText(), FPDFAnnot_GetFormAdditionalActionJavaScript(), FPDFAnnot_GetFormFieldAlternateName(), FPDFAnnot_GetFormFieldExportValue(), FPDFAnnot_GetFormFieldName(), FPDFAnnot_GetFormFieldValue(), FPDFAnnot_GetOptionLabel(), FPDFAnnot_GetStringValue(), FPDFAttachment_GetName(), FPDFAttachment_GetStringValue(), FPDFBookmark_GetTitle(), and FPDFTextObj_GetText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ WideStringFromFPDFWideString()

WideString WideStringFromFPDFWideString ( FPDF_WIDESTRING wide_string)

Definition at line 212 of file cpdfsdk_helpers.cpp.

References fxcrt::WideString::FromUTF16LE().

Referenced by ByteStringFromFPDFWideString(), FORM_ReplaceAndKeepSelection(), FORM_ReplaceSelection(), FPDFAnnot_SetAP(), FPDFAnnot_SetStringValue(), FPDFBookmark_Find(), FPDFDoc_AddAttachment(), FPDFText_SetText(), and GetPlatformString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: