1 // Copyright 2015 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // This "C" (not "C++") file ensures that the public headers compile 6 // and link for "C" (and not just "C++"). 7 8 #include <stdio.h> 9 10 #include "fpdfsdk/fpdf_view_c_api_test.h" 11 12 #include "public/fpdf_annot.h" 13 #include "public/fpdf_attachment.h" 14 #include "public/fpdf_catalog.h" 15 #include "public/fpdf_dataavail.h" 16 #include "public/fpdf_doc.h" 17 #include "public/fpdf_edit.h" 18 #include "public/fpdf_ext.h" 19 #include "public/fpdf_flatten.h" 20 #include "public/fpdf_formfill.h" 21 #include "public/fpdf_fwlevent.h" 22 #include "public/fpdf_javascript.h" 23 #include "public/fpdf_ppo.h" 24 #include "public/fpdf_progressive.h" 25 #include "public/fpdf_save.h" 26 #include "public/fpdf_searchex.h" 27 #include "public/fpdf_structtree.h" 28 #include "public/fpdf_sysfontinfo.h" 29 #include "public/fpdf_text.h" 30 #include "public/fpdf_thumbnail.h" 31 #include "public/fpdf_transformpage.h" 32 #include "public/fpdfview.h" 33 34 // Scheme for avoiding LTO out of existence, warnings, etc. 35 typedef void (*fnptr)(void); // Legal generic function type for casts. 36 fnptr g_c_api_test_fnptr = NULL; // Extern, so can't know it doesn't change. 37 #define CHK(x) if ((fnptr)(x) == g_c_api_test_fnptr) return 0 38 39 // Function to call from gtest harness to ensure linker resolution. CheckPDFiumCApi()40int CheckPDFiumCApi() { 41 // fpdf_annot.h 42 CHK(FPDFAnnot_AppendAttachmentPoints); 43 CHK(FPDFAnnot_AppendObject); 44 CHK(FPDFAnnot_CountAttachmentPoints); 45 CHK(FPDFAnnot_GetAP); 46 CHK(FPDFAnnot_GetAttachmentPoints); 47 CHK(FPDFAnnot_GetColor); 48 CHK(FPDFAnnot_GetFlags); 49 CHK(FPDFAnnot_GetFontSize); 50 CHK(FPDFAnnot_GetFormFieldAtPoint); 51 CHK(FPDFAnnot_GetFormFieldFlags); 52 CHK(FPDFAnnot_GetFormFieldName); 53 CHK(FPDFAnnot_GetFormFieldType); 54 CHK(FPDFAnnot_GetFormFieldValue); 55 CHK(FPDFAnnot_GetLinkedAnnot); 56 CHK(FPDFAnnot_GetNumberValue); 57 CHK(FPDFAnnot_GetObject); 58 CHK(FPDFAnnot_GetObjectCount); 59 CHK(FPDFAnnot_GetOptionCount); 60 CHK(FPDFAnnot_GetOptionLabel); 61 CHK(FPDFAnnot_GetRect); 62 CHK(FPDFAnnot_GetStringValue); 63 CHK(FPDFAnnot_GetSubtype); 64 CHK(FPDFAnnot_GetValueType); 65 CHK(FPDFAnnot_HasAttachmentPoints); 66 CHK(FPDFAnnot_HasKey); 67 CHK(FPDFAnnot_IsChecked); 68 CHK(FPDFAnnot_IsObjectSupportedSubtype); 69 CHK(FPDFAnnot_IsSupportedSubtype); 70 CHK(FPDFAnnot_RemoveObject); 71 CHK(FPDFAnnot_SetAP); 72 CHK(FPDFAnnot_SetAttachmentPoints); 73 CHK(FPDFAnnot_SetColor); 74 CHK(FPDFAnnot_SetFlags); 75 CHK(FPDFAnnot_SetRect); 76 CHK(FPDFAnnot_SetStringValue); 77 CHK(FPDFAnnot_UpdateObject); 78 CHK(FPDFPage_CloseAnnot); 79 CHK(FPDFPage_CreateAnnot); 80 CHK(FPDFPage_GetAnnot); 81 CHK(FPDFPage_GetAnnotCount); 82 CHK(FPDFPage_GetAnnotIndex); 83 CHK(FPDFPage_RemoveAnnot); 84 85 // fpdf_attachment.h 86 CHK(FPDFAttachment_GetFile); 87 CHK(FPDFAttachment_GetName); 88 CHK(FPDFAttachment_GetStringValue); 89 CHK(FPDFAttachment_GetValueType); 90 CHK(FPDFAttachment_HasKey); 91 CHK(FPDFAttachment_SetFile); 92 CHK(FPDFAttachment_SetStringValue); 93 CHK(FPDFDoc_AddAttachment); 94 CHK(FPDFDoc_DeleteAttachment); 95 CHK(FPDFDoc_GetAttachment); 96 CHK(FPDFDoc_GetAttachmentCount); 97 98 // fpdf_catalog.h 99 CHK(FPDFCatalog_IsTagged); 100 101 // fpdf_dataavail.h 102 CHK(FPDFAvail_Create); 103 CHK(FPDFAvail_Destroy); 104 CHK(FPDFAvail_GetDocument); 105 CHK(FPDFAvail_GetFirstPageNum); 106 CHK(FPDFAvail_IsDocAvail); 107 CHK(FPDFAvail_IsFormAvail); 108 CHK(FPDFAvail_IsLinearized); 109 CHK(FPDFAvail_IsPageAvail); 110 111 // fpdf_doc.h 112 CHK(FPDFAction_GetDest); 113 CHK(FPDFAction_GetFilePath); 114 CHK(FPDFAction_GetType); 115 CHK(FPDFAction_GetURIPath); 116 CHK(FPDFBookmark_Find); 117 CHK(FPDFBookmark_GetAction); 118 CHK(FPDFBookmark_GetDest); 119 CHK(FPDFBookmark_GetFirstChild); 120 CHK(FPDFBookmark_GetNextSibling); 121 CHK(FPDFBookmark_GetTitle); 122 CHK(FPDFDest_GetDestPageIndex); 123 CHK(FPDFDest_GetLocationInPage); 124 CHK(FPDFDest_GetView); 125 CHK(FPDFLink_CountQuadPoints); 126 CHK(FPDFLink_Enumerate); 127 CHK(FPDFLink_GetAction); 128 CHK(FPDFLink_GetAnnotRect); 129 CHK(FPDFLink_GetDest); 130 CHK(FPDFLink_GetLinkAtPoint); 131 CHK(FPDFLink_GetLinkZOrderAtPoint); 132 CHK(FPDFLink_GetQuadPoints); 133 CHK(FPDF_GetMetaText); 134 CHK(FPDF_GetPageLabel); 135 136 // fpdf_edit.h 137 CHK(FPDFFont_Close); 138 CHK(FPDFFormObj_CountObjects); 139 CHK(FPDFFormObj_GetMatrix); 140 CHK(FPDFFormObj_GetObject); 141 CHK(FPDFImageObj_GetBitmap); 142 CHK(FPDFImageObj_GetImageDataDecoded); 143 CHK(FPDFImageObj_GetImageDataRaw); 144 CHK(FPDFImageObj_GetImageFilter); 145 CHK(FPDFImageObj_GetImageFilterCount); 146 CHK(FPDFImageObj_GetImageMetadata); 147 CHK(FPDFImageObj_GetMatrix); 148 CHK(FPDFImageObj_LoadJpegFile); 149 CHK(FPDFImageObj_LoadJpegFileInline); 150 CHK(FPDFImageObj_SetBitmap); 151 CHK(FPDFImageObj_SetMatrix); 152 CHK(FPDFPageObjMark_CountParams); 153 CHK(FPDFPageObjMark_GetName); 154 CHK(FPDFPageObjMark_GetParamBlobValue); 155 CHK(FPDFPageObjMark_GetParamIntValue); 156 CHK(FPDFPageObjMark_GetParamKey); 157 CHK(FPDFPageObjMark_GetParamStringValue); 158 CHK(FPDFPageObjMark_GetParamValueType); 159 CHK(FPDFPageObjMark_RemoveParam); 160 CHK(FPDFPageObjMark_SetBlobParam); 161 CHK(FPDFPageObjMark_SetIntParam); 162 CHK(FPDFPageObjMark_SetStringParam); 163 CHK(FPDFPageObj_AddMark); 164 CHK(FPDFPageObj_CountMarks); 165 CHK(FPDFPageObj_CreateNewPath); 166 CHK(FPDFPageObj_CreateNewRect); 167 CHK(FPDFPageObj_CreateTextObj); 168 CHK(FPDFPageObj_Destroy); 169 CHK(FPDFPageObj_GetBounds); 170 CHK(FPDFPageObj_GetFillColor); 171 CHK(FPDFPageObj_GetLineCap); 172 CHK(FPDFPageObj_GetLineJoin); 173 CHK(FPDFPageObj_GetMark); 174 CHK(FPDFPageObj_GetStrokeColor); 175 CHK(FPDFPageObj_GetStrokeWidth); 176 CHK(FPDFPageObj_GetType); 177 CHK(FPDFPageObj_HasTransparency); 178 CHK(FPDFPageObj_NewImageObj); 179 CHK(FPDFPageObj_NewTextObj); 180 CHK(FPDFPageObj_RemoveMark); 181 CHK(FPDFPageObj_SetBlendMode); 182 CHK(FPDFPageObj_SetFillColor); 183 CHK(FPDFPageObj_SetLineCap); 184 CHK(FPDFPageObj_SetLineJoin); 185 CHK(FPDFPageObj_SetStrokeColor); 186 CHK(FPDFPageObj_SetStrokeWidth); 187 CHK(FPDFPageObj_Transform); 188 CHK(FPDFPage_CountObjects); 189 CHK(FPDFPage_Delete); 190 CHK(FPDFPage_GenerateContent); 191 CHK(FPDFPage_GetObject); 192 CHK(FPDFPage_GetRotation); 193 CHK(FPDFPage_HasTransparency); 194 CHK(FPDFPage_InsertObject); 195 CHK(FPDFPage_New); 196 CHK(FPDFPage_RemoveObject); 197 CHK(FPDFPage_SetRotation); 198 CHK(FPDFPage_TransformAnnots); 199 CHK(FPDFPathSegment_GetClose); 200 CHK(FPDFPathSegment_GetPoint); 201 CHK(FPDFPathSegment_GetType); 202 CHK(FPDFPath_BezierTo); 203 CHK(FPDFPath_Close); 204 CHK(FPDFPath_CountSegments); 205 CHK(FPDFPath_GetDrawMode); 206 CHK(FPDFPath_GetMatrix); 207 CHK(FPDFPath_GetPathSegment); 208 CHK(FPDFPath_LineTo); 209 CHK(FPDFPath_MoveTo); 210 CHK(FPDFPath_SetDrawMode); 211 CHK(FPDFPath_SetMatrix); 212 CHK(FPDFTextObj_GetFontName); 213 CHK(FPDFTextObj_GetFontSize); 214 CHK(FPDFTextObj_GetMatrix); 215 CHK(FPDFTextObj_GetText); 216 CHK(FPDFTextObj_GetTextRenderMode); 217 CHK(FPDFTextObj_SetTextRenderMode); 218 CHK(FPDFText_LoadFont); 219 CHK(FPDFText_LoadStandardFont); 220 CHK(FPDFText_SetText); 221 CHK(FPDF_CreateNewDocument); 222 223 // fpdf_ext.h 224 CHK(FPDFDoc_GetPageMode); 225 CHK(FSDK_SetLocaltimeFunction); 226 CHK(FSDK_SetTimeFunction); 227 CHK(FSDK_SetUnSpObjProcessHandler); 228 229 // fpdf_flatten.h 230 CHK(FPDFPage_Flatten); 231 232 // fpdf_fwlevent.h - no exports. 233 234 // fpdf_formfill.h 235 CHK(FORM_CanRedo); 236 CHK(FORM_CanUndo); 237 CHK(FORM_DoDocumentAAction); 238 CHK(FORM_DoDocumentJSAction); 239 CHK(FORM_DoDocumentOpenAction); 240 CHK(FORM_DoPageAAction); 241 CHK(FORM_ForceToKillFocus); 242 CHK(FORM_GetFocusedText); 243 CHK(FORM_GetSelectedText); 244 CHK(FORM_IsIndexSelected); 245 CHK(FORM_OnAfterLoadPage); 246 CHK(FORM_OnBeforeClosePage); 247 CHK(FORM_OnChar); 248 CHK(FORM_OnFocus); 249 CHK(FORM_OnKeyDown); 250 CHK(FORM_OnKeyUp); 251 CHK(FORM_OnLButtonDoubleClick); 252 CHK(FORM_OnLButtonDown); 253 CHK(FORM_OnLButtonUp); 254 CHK(FORM_OnMouseMove); 255 CHK(FORM_OnRButtonDown); 256 CHK(FORM_OnRButtonUp); 257 CHK(FORM_Redo); 258 CHK(FORM_ReplaceSelection); 259 CHK(FORM_SetIndexSelected); 260 CHK(FORM_Undo); 261 CHK(FPDFDOC_ExitFormFillEnvironment); 262 CHK(FPDFDOC_InitFormFillEnvironment); 263 CHK(FPDFPage_FormFieldZOrderAtPoint); 264 CHK(FPDFPage_HasFormFieldAtPoint); 265 CHK(FPDF_FFLDraw); 266 #ifdef _SKIA_SUPPORT_ 267 CHK(FPDF_FFLRecord); 268 #endif 269 CHK(FPDF_GetFormType); 270 CHK(FPDF_LoadXFA); 271 CHK(FPDF_RemoveFormFieldHighlight); 272 CHK(FPDF_SetFormFieldHighlightAlpha); 273 CHK(FPDF_SetFormFieldHighlightColor); 274 275 // fpdf_javascript.h 276 CHK(FPDFDoc_CloseJavaScriptAction); 277 CHK(FPDFDoc_GetJavaScriptAction); 278 CHK(FPDFDoc_GetJavaScriptActionCount); 279 CHK(FPDFJavaScriptAction_GetName); 280 CHK(FPDFJavaScriptAction_GetScript); 281 282 // fpdf_ppo.h 283 CHK(FPDF_CopyViewerPreferences); 284 CHK(FPDF_ImportNPagesToOne); 285 CHK(FPDF_ImportPages); 286 287 // fpdf_progressive.h 288 CHK(FPDF_RenderPageBitmap_Start); 289 CHK(FPDF_RenderPage_Close); 290 CHK(FPDF_RenderPage_Continue); 291 292 // fpdf_save.h 293 CHK(FPDF_SaveAsCopy); 294 CHK(FPDF_SaveWithVersion); 295 296 // fpdf_searchex.h 297 CHK(FPDFText_GetCharIndexFromTextIndex); 298 CHK(FPDFText_GetTextIndexFromCharIndex); 299 300 // fpdf_structtree.h 301 CHK(FPDF_StructElement_CountChildren); 302 CHK(FPDF_StructElement_GetAltText); 303 CHK(FPDF_StructElement_GetChildAtIndex); 304 CHK(FPDF_StructElement_GetMarkedContentID); 305 CHK(FPDF_StructElement_GetTitle); 306 CHK(FPDF_StructElement_GetType); 307 CHK(FPDF_StructTree_Close); 308 CHK(FPDF_StructTree_CountChildren); 309 CHK(FPDF_StructTree_GetChildAtIndex); 310 CHK(FPDF_StructTree_GetForPage); 311 312 // fpdf_sysfontinfo.h 313 CHK(FPDF_AddInstalledFont); 314 CHK(FPDF_FreeDefaultSystemFontInfo); 315 CHK(FPDF_GetDefaultSystemFontInfo); 316 CHK(FPDF_GetDefaultTTFMap); 317 CHK(FPDF_SetSystemFontInfo); 318 319 // fpdf_text.h 320 CHK(FPDFLink_CloseWebLinks); 321 CHK(FPDFLink_CountRects); 322 CHK(FPDFLink_CountWebLinks); 323 CHK(FPDFLink_GetRect); 324 CHK(FPDFLink_GetTextRange); 325 CHK(FPDFLink_GetURL); 326 CHK(FPDFLink_LoadWebLinks); 327 CHK(FPDFText_ClosePage); 328 CHK(FPDFText_CountChars); 329 CHK(FPDFText_CountRects); 330 CHK(FPDFText_FindClose); 331 CHK(FPDFText_FindNext); 332 CHK(FPDFText_FindPrev); 333 CHK(FPDFText_FindStart); 334 CHK(FPDFText_GetBoundedText); 335 CHK(FPDFText_GetCharAngle); 336 CHK(FPDFText_GetCharBox); 337 CHK(FPDFText_GetCharIndexAtPos); 338 CHK(FPDFText_GetCharOrigin); 339 CHK(FPDFText_GetFillColor); 340 CHK(FPDFText_GetFontInfo); 341 CHK(FPDFText_GetFontSize); 342 CHK(FPDFText_GetFontWeight); 343 CHK(FPDFText_GetLooseCharBox); 344 CHK(FPDFText_GetMatrix); 345 CHK(FPDFText_GetRect); 346 CHK(FPDFText_GetSchCount); 347 CHK(FPDFText_GetSchResultIndex); 348 CHK(FPDFText_GetStrokeColor); 349 CHK(FPDFText_GetText); 350 CHK(FPDFText_GetTextRenderMode); 351 CHK(FPDFText_GetUnicode); 352 CHK(FPDFText_LoadPage); 353 354 // fpdf_thumbnail.h 355 CHK(FPDFPage_GetDecodedThumbnailData); 356 CHK(FPDFPage_GetRawThumbnailData); 357 CHK(FPDFPage_GetThumbnailAsBitmap); 358 359 // fpdf_transformpage.h 360 CHK(FPDFClipPath_CountPathSegments); 361 CHK(FPDFClipPath_CountPaths); 362 CHK(FPDFClipPath_GetPathSegment); 363 CHK(FPDFPageObj_GetClipPath); 364 CHK(FPDFPageObj_TransformClipPath); 365 CHK(FPDFPage_GetArtBox); 366 CHK(FPDFPage_GetBleedBox); 367 CHK(FPDFPage_GetCropBox); 368 CHK(FPDFPage_GetMediaBox); 369 CHK(FPDFPage_GetTrimBox); 370 CHK(FPDFPage_InsertClipPath); 371 CHK(FPDFPage_SetArtBox); 372 CHK(FPDFPage_SetBleedBox); 373 CHK(FPDFPage_SetCropBox); 374 CHK(FPDFPage_SetMediaBox); 375 CHK(FPDFPage_SetTrimBox); 376 CHK(FPDFPage_TransFormWithClip); 377 CHK(FPDF_CreateClipPath); 378 CHK(FPDF_DestroyClipPath); 379 380 // fpdfview.h 381 CHK(FPDFBitmap_Create); 382 CHK(FPDFBitmap_CreateEx); 383 CHK(FPDFBitmap_Destroy); 384 CHK(FPDFBitmap_FillRect); 385 CHK(FPDFBitmap_GetBuffer); 386 CHK(FPDFBitmap_GetFormat); 387 CHK(FPDFBitmap_GetHeight); 388 CHK(FPDFBitmap_GetStride); 389 CHK(FPDFBitmap_GetWidth); 390 #ifdef PDF_ENABLE_XFA 391 CHK(FPDF_BStr_Clear); 392 CHK(FPDF_BStr_Init); 393 CHK(FPDF_BStr_Set); 394 #endif 395 CHK(FPDF_CloseDocument); 396 CHK(FPDF_ClosePage); 397 CHK(FPDF_CountNamedDests); 398 CHK(FPDF_DestroyLibrary); 399 CHK(FPDF_DeviceToPage); 400 CHK(FPDF_DocumentHasValidCrossReferenceTable); 401 CHK(FPDF_GetDocPermissions); 402 CHK(FPDF_GetFileVersion); 403 CHK(FPDF_GetLastError); 404 CHK(FPDF_GetNamedDest); 405 CHK(FPDF_GetNamedDestByName); 406 CHK(FPDF_GetPageBoundingBox); 407 CHK(FPDF_GetPageCount); 408 CHK(FPDF_GetPageHeight); 409 CHK(FPDF_GetPageHeightF); 410 CHK(FPDF_GetPageSizeByIndex); 411 CHK(FPDF_GetPageSizeByIndexF); 412 CHK(FPDF_GetPageWidth); 413 CHK(FPDF_GetPageWidthF); 414 #ifdef PDF_ENABLE_V8 415 CHK(FPDF_GetRecommendedV8Flags); 416 #endif 417 CHK(FPDF_GetSecurityHandlerRevision); 418 CHK(FPDF_InitLibrary); 419 CHK(FPDF_InitLibraryWithConfig); 420 CHK(FPDF_LoadCustomDocument); 421 CHK(FPDF_LoadDocument); 422 CHK(FPDF_LoadMemDocument); 423 CHK(FPDF_LoadPage); 424 CHK(FPDF_PageToDevice); 425 #ifdef _WIN32 426 CHK(FPDF_RenderPage); 427 #endif 428 CHK(FPDF_RenderPageBitmap); 429 CHK(FPDF_RenderPageBitmapWithMatrix); 430 #ifdef _SKIA_SUPPORT_ 431 CHK(FPDF_RenderPageSkp); 432 #endif 433 #if defined(_WIN32) 434 CHK(FPDF_SetPrintMode); 435 #if defined(PDFIUM_PRINT_TEXT_WITH_GDI) 436 CHK(FPDF_SetPrintTextWithGDI); 437 #endif 438 #endif 439 CHK(FPDF_SetSandBoxPolicy); 440 #if defined(_WIN32) && defined(PDFIUM_PRINT_TEXT_WITH_GDI) 441 CHK(FPDF_SetTypefaceAccessibleFunc); 442 #endif 443 CHK(FPDF_VIEWERREF_GetDuplex); 444 CHK(FPDF_VIEWERREF_GetName); 445 CHK(FPDF_VIEWERREF_GetNumCopies); 446 CHK(FPDF_VIEWERREF_GetPrintPageRange); 447 CHK(FPDF_VIEWERREF_GetPrintPageRangeCount); 448 CHK(FPDF_VIEWERREF_GetPrintPageRangeElement); 449 CHK(FPDF_VIEWERREF_GetPrintScaling); 450 451 return 1; 452 } 453 454 #undef CHK 455