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
fpdf_doc_embeddertest.cpp
Go to the documentation of this file.
1// Copyright 2015 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <array>
6#include <set>
7#include <string>
8#include <vector>
9
10#include "core/fpdfapi/parser/cpdf_dictionary.h"
11#include "core/fpdfapi/parser/cpdf_document.h"
12#include "core/fpdfapi/parser/cpdf_reference.h"
13#include "core/fxcrt/bytestring.h"
14#include "core/fxcrt/fx_safe_types.h"
15#include "core/fxge/cfx_defaultrenderdevice.h"
16#include "fpdfsdk/cpdfsdk_helpers.h"
17#include "public/cpp/fpdf_scopers.h"
18#include "public/fpdf_doc.h"
19#include "public/fpdf_edit.h"
20#include "public/fpdfview.h"
21#include "testing/embedder_test.h"
22#include "testing/fx_string_testhelpers.h"
23#include "testing/gtest/include/gtest/gtest.h"
24
25namespace {
26
27// Look for "/Type/Page" but ignore "/Type/Pages".
28int CountPageEntries(const std::string& data) {
29 static constexpr char kNeedle[] = "/Type/Page";
30 static constexpr size_t kNeedleLen = std::size(kNeedle) - 1;
31
32 size_t pos = 0;
33 int count = 0;
34 while (pos < data.size()) {
35 const size_t found_pos = data.find(kNeedle, pos);
36 if (found_pos == std::string::npos) {
37 break;
38 }
39
40 FX_SAFE_SIZE_T next_pos = found_pos;
41 next_pos += kNeedleLen;
42 pos = next_pos.ValueOrDefault(std::string::npos);
43 if (pos < data.size() && data[pos] == 's') {
44 // Ignore "/Type/Pages".
45 ++pos;
46 } else {
47 ++count;
48 }
49 }
50 return count;
51}
52
53// Look for ">stream\r\n".
54int CountStreamEntries(const std::string& data) {
55 static constexpr char kNeedle[] = ">stream\r\n";
56 static constexpr size_t kNeedleLen = std::size(kNeedle) - 1;
57
58 size_t pos = 0;
59 int count = 0;
60 while (pos < data.size()) {
61 const size_t found_pos = data.find(kNeedle, pos);
62 if (found_pos == std::string::npos) {
63 break;
64 }
65
66 FX_SAFE_SIZE_T next_pos = found_pos;
67 next_pos += kNeedleLen;
68 pos = next_pos.ValueOrDefault(std::string::npos);
69 ++count;
70 }
71 return count;
72}
73
74} // namespace
75
77
79 ASSERT_TRUE(OpenDocument("hello_world.pdf"));
80 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document());
81
82 std::set<FPDF_PAGE> unique_pages;
83 std::vector<ScopedFPDFPage> owned_pages(4);
84 for (auto& ref : owned_pages) {
85 ref.reset(FPDF_LoadPage(document(), 0));
86 unique_pages.insert(ref.get());
87 }
88#ifdef PDF_ENABLE_XFA
89 EXPECT_EQ(1u, unique_pages.size());
90 EXPECT_EQ(1u, pDoc->GetParsedPageCountForTesting());
91#else // PDF_ENABLE_XFA
92 EXPECT_EQ(4u, unique_pages.size());
93 EXPECT_EQ(4u, pDoc->GetParsedPageCountForTesting());
94#endif // PDF_ENABLE_XFA
95}
96
98 ASSERT_TRUE(OpenDocument("named_dests.pdf"));
99
100 // NULL argument cases.
101 EXPECT_EQ(-1, FPDFDest_GetDestPageIndex(nullptr, nullptr));
102 EXPECT_EQ(-1, FPDFDest_GetDestPageIndex(document(), nullptr));
103
104 // Page number directly in item from Dests NameTree.
105 FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First");
106 EXPECT_TRUE(dest);
107 EXPECT_EQ(1, FPDFDest_GetDestPageIndex(document(), dest));
108
109 // Page number via object reference in item from Dests NameTree.
110 dest = FPDF_GetNamedDestByName(document(), "Next");
111 EXPECT_TRUE(dest);
112 EXPECT_EQ(1, FPDFDest_GetDestPageIndex(document(), dest));
113
114 // Page number directly in item from Dests dictionary.
115 dest = FPDF_GetNamedDestByName(document(), "FirstAlternate");
116 EXPECT_TRUE(dest);
117 EXPECT_EQ(11, FPDFDest_GetDestPageIndex(document(), dest));
118
119 // Invalid object reference in item from Dests NameTree.
120 dest = FPDF_GetNamedDestByName(document(), "LastAlternate");
121 EXPECT_TRUE(dest);
122 EXPECT_EQ(-1, FPDFDest_GetDestPageIndex(document(), dest));
123}
124
126 ASSERT_TRUE(OpenDocument("named_dests.pdf"));
127
128 unsigned long numParams;
129 FS_FLOAT params[4];
130
131 numParams = 42;
132 std::fill_n(params, 4, 42.4242f);
133 EXPECT_EQ(static_cast<unsigned long>(PDFDEST_VIEW_UNKNOWN_MODE),
134 FPDFDest_GetView(nullptr, &numParams, params));
135 EXPECT_EQ(0U, numParams);
136 EXPECT_FLOAT_EQ(42.4242f, params[0]);
137
138 numParams = 42;
139 std::fill_n(params, 4, 42.4242f);
140 FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First");
141 EXPECT_TRUE(dest);
142 EXPECT_EQ(static_cast<unsigned long>(PDFDEST_VIEW_XYZ),
143 FPDFDest_GetView(dest, &numParams, params));
144 EXPECT_EQ(3U, numParams);
145 EXPECT_FLOAT_EQ(0, params[0]);
146 EXPECT_FLOAT_EQ(0, params[1]);
147 EXPECT_FLOAT_EQ(1, params[2]);
148 EXPECT_FLOAT_EQ(42.4242f, params[3]);
149
150 numParams = 42;
151 std::fill_n(params, 4, 42.4242f);
152 dest = FPDF_GetNamedDestByName(document(), "Next");
153 EXPECT_TRUE(dest);
154 EXPECT_EQ(static_cast<unsigned long>(PDFDEST_VIEW_FIT),
155 FPDFDest_GetView(dest, &numParams, params));
156 EXPECT_EQ(0U, numParams);
157 EXPECT_FLOAT_EQ(42.4242f, params[0]);
158
159 numParams = 42;
160 std::fill_n(params, 4, 42.4242f);
161 dest = FPDF_GetNamedDestByName(document(), "FirstAlternate");
162 EXPECT_TRUE(dest);
163 EXPECT_EQ(static_cast<unsigned long>(PDFDEST_VIEW_XYZ),
164 FPDFDest_GetView(dest, &numParams, params));
165 EXPECT_EQ(3U, numParams);
166 EXPECT_FLOAT_EQ(200, params[0]);
167 EXPECT_FLOAT_EQ(400, params[1]);
168 EXPECT_FLOAT_EQ(800, params[2]);
169 EXPECT_FLOAT_EQ(42.4242f, params[3]);
170
171 numParams = 42;
172 std::fill_n(params, 4, 42.4242f);
173 dest = FPDF_GetNamedDestByName(document(), "LastAlternate");
174 EXPECT_TRUE(dest);
175 EXPECT_EQ(static_cast<unsigned long>(PDFDEST_VIEW_XYZ),
176 FPDFDest_GetView(dest, &numParams, params));
177 EXPECT_EQ(3U, numParams);
178 EXPECT_FLOAT_EQ(0, params[0]);
179 EXPECT_FLOAT_EQ(0, params[1]);
180 EXPECT_FLOAT_EQ(-200, params[2]);
181 EXPECT_FLOAT_EQ(42.4242f, params[3]);
182}
183
185 ASSERT_TRUE(OpenDocument("named_dests.pdf"));
186
187 FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First");
188 EXPECT_TRUE(dest);
189
190 FPDF_BOOL hasX = 0;
191 FPDF_BOOL hasY = 0;
192 FPDF_BOOL hasZoom = 0;
193 FS_FLOAT x = -1.0f;
194 FS_FLOAT y = -1.0f;
195 FS_FLOAT zoom = -1.0f;
196
197 // NULL argument case
198 EXPECT_FALSE(FPDFDest_GetLocationInPage(nullptr, &hasX, &hasY, &hasZoom, &x,
199 &y, &zoom));
200
201 // Actual argument case.
202 EXPECT_TRUE(
203 FPDFDest_GetLocationInPage(dest, &hasX, &hasY, &hasZoom, &x, &y, &zoom));
204 EXPECT_TRUE(hasX);
205 EXPECT_TRUE(hasY);
206 EXPECT_TRUE(hasZoom);
207 EXPECT_EQ(0, x);
208 EXPECT_EQ(0, y);
209 EXPECT_EQ(1, zoom);
210}
211
213 ASSERT_TRUE(OpenDocument("bug_1506.pdf"));
214
215 FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First");
216 ASSERT_TRUE(dest);
217 EXPECT_EQ(3, FPDFDest_GetDestPageIndex(document(), dest));
218}
219
221 ASSERT_TRUE(OpenDocument("bug_1506.pdf"));
222
223 std::vector<FPDF_PAGE> pages;
224 for (int i : {0, 2})
225 pages.push_back(LoadPage(i));
226
227 FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First");
228 ASSERT_TRUE(dest);
229 EXPECT_EQ(3, FPDFDest_GetDestPageIndex(document(), dest));
230
231 for (FPDF_PAGE page : pages)
232 UnloadPage(page);
233}
234
236 ASSERT_TRUE(OpenDocument("bug_1506.pdf"));
237
238 std::vector<FPDF_PAGE> pages;
239 for (int i : {0, 1, 3})
240 pages.push_back(LoadPage(i));
241
242 FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First");
243 ASSERT_TRUE(dest);
244 EXPECT_EQ(3, FPDFDest_GetDestPageIndex(document(), dest));
245
246 for (FPDF_PAGE page : pages)
247 UnloadPage(page);
248}
249
251 ASSERT_TRUE(OpenDocument("bug_680376.pdf"));
252
253 // Page number directly in item from Dests NameTree.
254 FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First");
255 EXPECT_TRUE(dest);
256 EXPECT_EQ(-1, FPDFDest_GetDestPageIndex(document(), dest));
257}
258
260 ASSERT_TRUE(OpenDocument("bug_821454.pdf"));
261
262 FPDF_PAGE page = LoadPage(0);
263 ASSERT_TRUE(page);
264
265 // Cover some invalid argument cases while we're at it.
266 EXPECT_FALSE(FPDFLink_GetLinkAtPoint(nullptr, 150, 360));
267 EXPECT_EQ(-1, FPDFLink_GetLinkZOrderAtPoint(nullptr, 150, 360));
268
269 FPDF_LINK link1 = FPDFLink_GetLinkAtPoint(page, 150, 360);
270 ASSERT_TRUE(link1);
271 FPDF_LINK link2 = FPDFLink_GetLinkAtPoint(page, 150, 420);
272 ASSERT_TRUE(link2);
273
274 EXPECT_EQ(0, FPDFLink_GetLinkZOrderAtPoint(page, 150, 360));
275 EXPECT_EQ(1, FPDFLink_GetLinkZOrderAtPoint(page, 150, 420));
276
277 FPDF_DEST dest1 = FPDFLink_GetDest(document(), link1);
278 ASSERT_TRUE(dest1);
279 FPDF_DEST dest2 = FPDFLink_GetDest(document(), link2);
280 ASSERT_TRUE(dest2);
281
282 // Cover more invalid argument cases while we're at it.
283 EXPECT_FALSE(FPDFLink_GetDest(nullptr, nullptr));
284 EXPECT_FALSE(FPDFLink_GetDest(nullptr, link1));
285 EXPECT_FALSE(FPDFLink_GetDest(document(), nullptr));
286
287 EXPECT_EQ(0, FPDFDest_GetDestPageIndex(document(), dest1));
288 EXPECT_EQ(0, FPDFDest_GetDestPageIndex(document(), dest2));
289
290 {
291 FPDF_BOOL has_x_coord;
292 FPDF_BOOL has_y_coord;
293 FPDF_BOOL has_zoom;
294 FS_FLOAT x;
295 FS_FLOAT y;
296 FS_FLOAT zoom;
297 FPDF_BOOL success = FPDFDest_GetLocationInPage(
298 dest1, &has_x_coord, &has_y_coord, &has_zoom, &x, &y, &zoom);
299 ASSERT_TRUE(success);
300 EXPECT_TRUE(has_x_coord);
301 EXPECT_TRUE(has_y_coord);
302 EXPECT_FALSE(has_zoom);
303 EXPECT_FLOAT_EQ(100.0f, x);
304 EXPECT_FLOAT_EQ(200.0f, y);
305 }
306 {
307 FPDF_BOOL has_x_coord;
308 FPDF_BOOL has_y_coord;
309 FPDF_BOOL has_zoom;
310 FS_FLOAT x;
311 FS_FLOAT y;
312 FS_FLOAT zoom;
313 FPDF_BOOL success = FPDFDest_GetLocationInPage(
314 dest2, &has_x_coord, &has_y_coord, &has_zoom, &x, &y, &zoom);
315 ASSERT_TRUE(success);
316 EXPECT_TRUE(has_x_coord);
317 EXPECT_TRUE(has_y_coord);
318 EXPECT_FALSE(has_zoom);
319 EXPECT_FLOAT_EQ(150.0f, x);
320 EXPECT_FLOAT_EQ(250.0f, y);
321 }
322
323 UnloadPage(page);
324}
325
327 ASSERT_TRUE(OpenDocument("launch_action.pdf"));
328 EXPECT_EQ(static_cast<unsigned long>(PDFACTION_UNSUPPORTED),
329 FPDFAction_GetType(nullptr));
330
331 EXPECT_FALSE(FPDFAction_GetDest(nullptr, nullptr));
332 EXPECT_FALSE(FPDFAction_GetDest(document(), nullptr));
333 EXPECT_EQ(0u, FPDFAction_GetFilePath(nullptr, nullptr, 0));
334 EXPECT_EQ(0u, FPDFAction_GetURIPath(nullptr, nullptr, nullptr, 0));
335 EXPECT_EQ(0u, FPDFAction_GetURIPath(document(), nullptr, nullptr, 0));
336}
337
339 ASSERT_TRUE(OpenDocument("launch_action.pdf"));
340
341 FPDF_PAGE page = LoadPage(0);
342 ASSERT_TRUE(page);
343
344 // The target action is nearly the size of the whole page.
345 FPDF_LINK link = FPDFLink_GetLinkAtPoint(page, 100, 100);
346 ASSERT_TRUE(link);
347
348 FPDF_ACTION action = FPDFLink_GetAction(link);
349 ASSERT_TRUE(action);
350 EXPECT_EQ(static_cast<unsigned long>(PDFACTION_LAUNCH),
352
353 const char kExpectedResult[] = "test.pdf";
354 const unsigned long kExpectedLength = sizeof(kExpectedResult);
355 unsigned long bufsize = FPDFAction_GetFilePath(action, nullptr, 0);
356 EXPECT_EQ(kExpectedLength, bufsize);
357
358 char buf[1024];
359 EXPECT_EQ(bufsize, FPDFAction_GetFilePath(action, buf, bufsize));
360 EXPECT_STREQ(kExpectedResult, buf);
361
362 // Other public methods are not appropriate for launch actions.
363 EXPECT_FALSE(FPDFAction_GetDest(document(), action));
364 EXPECT_EQ(0u, FPDFAction_GetURIPath(document(), action, buf, sizeof(buf)));
365
366 UnloadPage(page);
367}
368
370 ASSERT_TRUE(OpenDocument("uri_action.pdf"));
371
372 FPDF_PAGE page = LoadPage(0);
373 ASSERT_TRUE(page);
374
375 // The target action is nearly the size of the whole page.
376 FPDF_LINK link = FPDFLink_GetLinkAtPoint(page, 100, 100);
377 ASSERT_TRUE(link);
378
379 FPDF_ACTION action = FPDFLink_GetAction(link);
380 ASSERT_TRUE(action);
381 EXPECT_EQ(static_cast<unsigned long>(PDFACTION_URI),
383
384 const char kExpectedResult[] = "https://example.com/page.html";
385 const unsigned long kExpectedLength = sizeof(kExpectedResult);
386 unsigned long bufsize = FPDFAction_GetURIPath(document(), action, nullptr, 0);
387 ASSERT_EQ(kExpectedLength, bufsize);
388
389 char buf[1024];
390 EXPECT_EQ(bufsize, FPDFAction_GetURIPath(document(), action, buf, bufsize));
391 EXPECT_STREQ(kExpectedResult, buf);
392
393 // Other public methods are not appropriate for URI actions
394 EXPECT_FALSE(FPDFAction_GetDest(document(), action));
395 EXPECT_EQ(0u, FPDFAction_GetFilePath(action, buf, sizeof(buf)));
396
397 UnloadPage(page);
398}
399
401 ASSERT_TRUE(OpenDocument("uri_action_nonascii.pdf"));
402
403 FPDF_PAGE page = LoadPage(0);
404 ASSERT_TRUE(page);
405
406 // The target action is nearly the size of the whole page.
407 FPDF_LINK link = FPDFLink_GetLinkAtPoint(page, 100, 100);
408 ASSERT_TRUE(link);
409
410 FPDF_ACTION action = FPDFLink_GetAction(link);
411 ASSERT_TRUE(action);
412 EXPECT_EQ(static_cast<unsigned long>(PDFACTION_URI),
414
415 // FPDFAction_GetURIPath() may return data in any encoding, or even with bad
416 // encoding.
417 const char kExpectedResult[] =
418 "https://example.com/\xA5octal\xC7"
419 "chars";
420 const unsigned long kExpectedLength = sizeof(kExpectedResult);
421 unsigned long bufsize = FPDFAction_GetURIPath(document(), action, nullptr, 0);
422 ASSERT_EQ(kExpectedLength, bufsize);
423
424 char buf[1024];
425 EXPECT_EQ(bufsize, FPDFAction_GetURIPath(document(), action, buf, bufsize));
426 EXPECT_STREQ(kExpectedResult, buf);
427
428 UnloadPage(page);
429}
430
432 ASSERT_TRUE(OpenDocument("annots.pdf"));
433 FPDF_PAGE page = LoadPage(0);
434 ASSERT_TRUE(page);
435 {
436 FPDF_LINK first_link = FPDFLink_GetLinkAtPoint(page, 69.00, 653.00);
437 ScopedFPDFAnnotation first_annot(FPDFLink_GetAnnot(page, first_link));
438 EXPECT_EQ(0, FPDFPage_GetAnnotIndex(page, first_annot.get()));
439
440 FPDF_LINK second_link = FPDFLink_GetLinkAtPoint(page, 80.00, 633.00);
441 ScopedFPDFAnnotation second_annot(FPDFLink_GetAnnot(page, second_link));
442 EXPECT_EQ(1, FPDFPage_GetAnnotIndex(page, second_annot.get()));
443
444 // Also test invalid arguments.
445 EXPECT_FALSE(FPDFLink_GetAnnot(nullptr, nullptr));
446 EXPECT_FALSE(FPDFLink_GetAnnot(page, nullptr));
447 EXPECT_FALSE(FPDFLink_GetAnnot(nullptr, second_link));
448 }
449
450 UnloadPage(page);
451}
452
454 ASSERT_TRUE(OpenDocument("goto_action.pdf"));
455
456 FPDF_PAGE page = LoadPage(0);
457 ASSERT_TRUE(page);
458
459 // The target action is nearly the size of the whole page.
460 FPDF_LINK link = FPDFLink_GetLinkAtPoint(page, 100, 100);
461 ASSERT_TRUE(link);
462
463 FPDF_ACTION action = FPDFLink_GetAction(link);
464 ASSERT_TRUE(action);
465 EXPECT_EQ(static_cast<unsigned long>(PDFACTION_GOTO),
467
468 EXPECT_TRUE(FPDFAction_GetDest(document(), action));
469
470 // Other public methods are not appropriate for GoTo actions.
471 char buf[1024];
472 EXPECT_EQ(0u, FPDFAction_GetFilePath(action, buf, sizeof(buf)));
473 EXPECT_EQ(0u, FPDFAction_GetURIPath(document(), action, buf, sizeof(buf)));
474
475 UnloadPage(page);
476}
477
479 ASSERT_TRUE(OpenDocument("gotoe_action.pdf"));
480
481 FPDF_PAGE page = LoadPage(0);
482 ASSERT_TRUE(page);
483
484 // The target action is nearly the size of the whole page.
485 FPDF_LINK link = FPDFLink_GetLinkAtPoint(page, 100, 100);
486 ASSERT_TRUE(link);
487
488 FPDF_ACTION action = FPDFLink_GetAction(link);
489 ASSERT_TRUE(action);
490 EXPECT_EQ(static_cast<unsigned long>(PDFACTION_EMBEDDEDGOTO),
492
493 FPDF_DEST dest = FPDFAction_GetDest(document(), action);
494 EXPECT_TRUE(dest);
495
496 unsigned long num_params = 42;
497 FS_FLOAT params[4];
498 std::fill_n(params, 4, 42.4242f);
499 EXPECT_EQ(static_cast<unsigned long>(PDFDEST_VIEW_FIT),
500 FPDFDest_GetView(dest, &num_params, params));
501 EXPECT_EQ(0u, num_params);
502 EXPECT_FLOAT_EQ(42.4242f, params[0]);
503
504 const char kExpectedResult[] = "ExampleFile.pdf";
505 const unsigned long kExpectedLength = sizeof(kExpectedResult);
506 char buf[1024];
507 unsigned long bufsize = FPDFAction_GetFilePath(action, nullptr, 0);
508 EXPECT_EQ(kExpectedLength, bufsize);
509 EXPECT_EQ(kExpectedLength, FPDFAction_GetFilePath(action, buf, bufsize));
510 EXPECT_STREQ(kExpectedResult, buf);
511
512 UnloadPage(page);
513}
514
516 ASSERT_TRUE(OpenDocument("nonesuch_action.pdf"));
517
518 FPDF_PAGE page = LoadPage(0);
519 ASSERT_TRUE(page);
520
521 // The target action is nearly the size of the whole page.
522 FPDF_LINK link = FPDFLink_GetLinkAtPoint(page, 100, 100);
523 ASSERT_TRUE(link);
524
525 FPDF_ACTION action = FPDFLink_GetAction(link);
526 ASSERT_TRUE(action);
527 EXPECT_EQ(static_cast<unsigned long>(PDFACTION_UNSUPPORTED),
529
530 // No public methods are appropriate for unsupported actions.
531 char buf[1024];
532 EXPECT_FALSE(FPDFAction_GetDest(document(), action));
533 EXPECT_EQ(0u, FPDFAction_GetFilePath(action, buf, sizeof(buf)));
534 EXPECT_EQ(0u, FPDFAction_GetURIPath(document(), action, buf, sizeof(buf)));
535
536 UnloadPage(page);
537}
538
540 unsigned short buf[128];
541
542 // Open a file with no bookmarks.
543 ASSERT_TRUE(OpenDocument("named_dests.pdf"));
544
545 // NULL argument cases.
546 EXPECT_EQ(0u, FPDFBookmark_GetTitle(nullptr, buf, sizeof(buf)));
547 EXPECT_FALSE(FPDFBookmark_GetFirstChild(nullptr, nullptr));
548 EXPECT_FALSE(FPDFBookmark_GetFirstChild(document(), nullptr));
549 EXPECT_FALSE(FPDFBookmark_GetNextSibling(nullptr, nullptr));
550 EXPECT_FALSE(FPDFBookmark_GetNextSibling(document(), nullptr));
551 EXPECT_FALSE(FPDFBookmark_Find(nullptr, nullptr));
552 EXPECT_FALSE(FPDFBookmark_Find(document(), nullptr));
553 EXPECT_FALSE(FPDFBookmark_GetDest(nullptr, nullptr));
554 EXPECT_FALSE(FPDFBookmark_GetDest(document(), nullptr));
555 EXPECT_FALSE(FPDFBookmark_GetAction(nullptr));
556}
557
559 unsigned short buf[128];
560
561 // Open a file with many bookmarks.
562 ASSERT_TRUE(OpenDocument("bookmarks.pdf"));
563
564 FPDF_BOOKMARK child = FPDFBookmark_GetFirstChild(document(), nullptr);
565 EXPECT_TRUE(child);
566 EXPECT_EQ(34u, FPDFBookmark_GetTitle(child, buf, sizeof(buf)));
567 EXPECT_EQ(L"A Good Beginning", GetPlatformWString(buf));
568 EXPECT_EQ(0, FPDFBookmark_GetCount(child));
569 EXPECT_EQ(0, FPDFBookmark_GetCount(nullptr));
570
571 EXPECT_FALSE(FPDFBookmark_GetDest(document(), child));
572 EXPECT_FALSE(FPDFBookmark_GetAction(child));
573
574 FPDF_BOOKMARK grand_child = FPDFBookmark_GetFirstChild(document(), child);
575 EXPECT_FALSE(grand_child);
576
577 FPDF_BOOKMARK sibling = FPDFBookmark_GetNextSibling(document(), child);
578 EXPECT_TRUE(sibling);
579 EXPECT_EQ(24u, FPDFBookmark_GetTitle(sibling, buf, sizeof(buf)));
580 EXPECT_EQ(L"Open Middle", GetPlatformWString(buf));
581 EXPECT_TRUE(FPDFBookmark_GetAction(sibling));
582 EXPECT_EQ(1, FPDFBookmark_GetCount(sibling));
583
584 FPDF_BOOKMARK sibling2 = FPDFBookmark_GetNextSibling(document(), sibling);
585 EXPECT_TRUE(sibling2);
586 EXPECT_EQ(42u, FPDFBookmark_GetTitle(sibling2, buf, sizeof(buf)));
587 EXPECT_EQ(L"A Good Closed Ending", GetPlatformWString(buf));
588 EXPECT_EQ(-2, FPDFBookmark_GetCount(sibling2));
589
590 EXPECT_FALSE(FPDFBookmark_GetNextSibling(document(), sibling2));
591
592 grand_child = FPDFBookmark_GetFirstChild(document(), sibling);
593 EXPECT_TRUE(grand_child);
594 EXPECT_EQ(46u, FPDFBookmark_GetTitle(grand_child, buf, sizeof(buf)));
595 EXPECT_EQ(L"Open Middle Descendant", GetPlatformWString(buf));
596 EXPECT_EQ(0, FPDFBookmark_GetCount(grand_child));
597 EXPECT_TRUE(FPDFBookmark_GetDest(document(), grand_child));
598
599 EXPECT_FALSE(FPDFBookmark_GetNextSibling(document(), grand_child));
600}
601
603 unsigned short buf[128];
604
605 // Open a file with many bookmarks.
606 ASSERT_TRUE(OpenDocument("bookmarks.pdf"));
607
608 // Find the first one, based on its known title.
609 ScopedFPDFWideString title = GetFPDFWideString(L"A Good Beginning");
610 FPDF_BOOKMARK child = FPDFBookmark_Find(document(), title.get());
611 EXPECT_TRUE(child);
612
613 // Check that the string matches.
614 EXPECT_EQ(34u, FPDFBookmark_GetTitle(child, buf, sizeof(buf)));
615 EXPECT_EQ(L"A Good Beginning", GetPlatformWString(buf));
616
617 // Check that it is them same as the one returned by GetFirstChild.
618 EXPECT_EQ(child, FPDFBookmark_GetFirstChild(document(), nullptr));
619
620 // Try to find one using a non-existent title.
621 ScopedFPDFWideString bad_title = GetFPDFWideString(L"A BAD Beginning");
622 EXPECT_FALSE(FPDFBookmark_Find(document(), bad_title.get()));
623}
624
625// Check circular bookmarks will not cause infinite loop.
627 // Open a file with circular bookmarks.
628 ASSERT_TRUE(OpenDocument("bookmarks_circular.pdf"));
629
630 // Try to find a title.
631 ScopedFPDFWideString title = GetFPDFWideString(L"anything");
632 EXPECT_FALSE(FPDFBookmark_Find(document(), title.get()));
633}
634
636 ASSERT_TRUE(OpenDocument("hello_world.pdf"));
637 EXPECT_EQ(1, FPDF_GetPageCount(document()));
638
639 FPDFPage_Delete(nullptr, 0);
640 EXPECT_EQ(1, FPDF_GetPageCount(document()));
641
642 FPDFPage_Delete(document(), -1);
643 EXPECT_EQ(1, FPDF_GetPageCount(document()));
644 FPDFPage_Delete(document(), 1);
645 EXPECT_EQ(1, FPDF_GetPageCount(document()));
646
647 FPDFPage_Delete(document(), 0);
648 EXPECT_EQ(0, FPDF_GetPageCount(document()));
649}
650
652 struct PageData {
653 int width;
654 int height;
655 const char* checksum;
656 };
657 const std::array<const PageData, 5> expected_page_data = {{
658 {200, 250,
659 []() {
660 return CFX_DefaultRenderDevice::UseSkiaRenderer()
661 ? "4b6590a267eae90b8be1607e808fb57f"
662 : "1e5d1cf19ffbb9cf9dbf099483cea327";
663 }()},
664 {250, 200,
665 []() {
666 return CFX_DefaultRenderDevice::UseSkiaRenderer()
667 ? "e8edd3655f6629ff489bd8c3bb110c82"
668 : "65c80685916aa36e767dd2270ba4d72b";
669 }()},
670 {200, 250,
671 []() {
672 return CFX_DefaultRenderDevice::UseSkiaRenderer()
673 ? "a2bde6b68d7981e665ab25bc633746aa"
674 : "a53b21c68edf43c1cddb5c06e361bb45";
675 }()},
676 {200, 250,
677 []() {
678 return CFX_DefaultRenderDevice::UseSkiaRenderer()
679 ? "a8c5b3e626f665eddf593c6d4c32ae9e"
680 : "dcd768be15efb9c6e5093cf74508752c";
681 }()},
682 {200, 250,
683 []() {
684 return CFX_DefaultRenderDevice::UseSkiaRenderer()
685 ? "72eb157853ae2d19b70ea62e3f5ac202"
686 : "7a3f8f79ebcb350854c0d69607729ec5";
687 }()},
688 }};
689
690 // Render the original document. (page indices 0-4)
691 ASSERT_TRUE(OpenDocument("rectangles_multi_pages.pdf"));
692 EXPECT_EQ(5, FPDF_GetPageCount(document()));
693 for (int i = 0; i < 5; ++i) {
694 FPDF_PAGE page = LoadPage(i);
695 ASSERT_TRUE(page);
696 ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
697 const PageData& expected = expected_page_data[i];
698 CompareBitmap(bitmap.get(), expected.width, expected.height,
699 expected.checksum);
700 UnloadPage(page);
701 }
702
703 // Delete the first page and render again. (original page indices 1-4)
704 FPDFPage_Delete(document(), 0);
705 EXPECT_EQ(4, FPDF_GetPageCount(document()));
706 for (int i = 0; i < 4; ++i) {
707 FPDF_PAGE page = LoadPage(i);
708 ASSERT_TRUE(page);
709 ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
710 const PageData& expected = expected_page_data[i + 1];
711 CompareBitmap(bitmap.get(), expected.width, expected.height,
712 expected.checksum);
713 UnloadPage(page);
714 }
715
716 // Delete the last page and render again. (original page indices 1-3)
717 FPDFPage_Delete(document(), 3);
718 EXPECT_EQ(3, FPDF_GetPageCount(document()));
719 for (int i = 0; i < 3; ++i) {
720 FPDF_PAGE page = LoadPage(i);
721 ASSERT_TRUE(page);
722 ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
723 const PageData& expected = expected_page_data[i + 1];
724 CompareBitmap(bitmap.get(), expected.width, expected.height,
725 expected.checksum);
726 UnloadPage(page);
727 }
728
729 // Delete the middle page and render again. (original page indices 1, 3)
730 FPDFPage_Delete(document(), 1);
731 EXPECT_EQ(2, FPDF_GetPageCount(document()));
732 for (int i = 0; i < 2; ++i) {
733 FPDF_PAGE page = LoadPage(i);
734 ASSERT_TRUE(page);
735 ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
736 int adjusted_index = i == 0 ? 1 : 3;
737 const PageData& expected = expected_page_data[adjusted_index];
738 CompareBitmap(bitmap.get(), expected.width, expected.height,
739 expected.checksum);
740 UnloadPage(page);
741 }
742}
743
745 // The bookmarks reference the deleted page.
746 ASSERT_TRUE(OpenDocument("bookmarks.pdf"));
747
748 EXPECT_EQ(2, FPDF_GetPageCount(document()));
749 FPDFPage_Delete(document(), 0);
750 EXPECT_EQ(1, FPDF_GetPageCount(document()));
751
752 ASSERT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
753 EXPECT_EQ(1, CountPageEntries(GetString()));
754 EXPECT_EQ(1, CountStreamEntries(GetString()));
755}
756
758 // There exists a non-standard object that references the deleted page.
759 ASSERT_TRUE(OpenDocument("hello_world_2_pages_custom_object.pdf"));
760
761 EXPECT_EQ(2, FPDF_GetPageCount(document()));
762 FPDFPage_Delete(document(), 0);
763 EXPECT_EQ(1, FPDF_GetPageCount(document()));
764
765 ASSERT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
766 EXPECT_EQ(1, CountPageEntries(GetString()));
767 EXPECT_EQ(1, CountStreamEntries(GetString()));
768}
769
771 ASSERT_TRUE(OpenDocument("hello_world.pdf"));
772
773 EXPECT_EQ(1, FPDF_GetPageCount(document()));
774
775 {
776 ScopedFPDFPage new_page(FPDFPage_New(document(), 1, 300, 200));
777 ASSERT_TRUE(new_page);
778 EXPECT_EQ(2, FPDF_GetPageCount(document()));
779
780 // Add a non-standard object that references the newly created page.
781 CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document());
782 ASSERT_TRUE(doc);
783
784 CPDF_Page* page = CPDFPageFromFPDFPage(new_page.get());
785 ASSERT_TRUE(page);
786
787 RetainPtr<CPDF_Dictionary> root_dict = doc->GetMutableRoot();
788 ASSERT_TRUE(root_dict);
789 root_dict->SetNewFor<CPDF_Reference>("CustomField", doc,
790 page->GetDict()->GetObjNum());
791 }
792
793 FPDFPage_Delete(document(), 1);
794 EXPECT_EQ(1, FPDF_GetPageCount(document()));
795
796 ASSERT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
797 EXPECT_EQ(1, CountPageEntries(GetString()));
798 EXPECT_EQ(1, CountStreamEntries(GetString()));
799}
800
802 // The deleted pages both use the same /Page object.
803 ASSERT_TRUE(OpenDocument("bug_1229106.pdf"));
804
805 EXPECT_EQ(4, FPDF_GetPageCount(document()));
806 FPDFPage_Delete(document(), 0);
807 EXPECT_EQ(3, FPDF_GetPageCount(document()));
808
809 ASSERT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
810 EXPECT_EQ(2, CountPageEntries(GetString()));
811 EXPECT_EQ(2, CountStreamEntries(GetString()));
812
813 ClearString();
814 FPDFPage_Delete(document(), 0);
815 EXPECT_EQ(2, FPDF_GetPageCount(document()));
816
817 ASSERT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
818 EXPECT_EQ(1, CountPageEntries(GetString()));
819 EXPECT_EQ(1, CountStreamEntries(GetString()));
820}
821
823 ASSERT_TRUE(OpenDocument("split_streams.pdf"));
824 constexpr size_t kMd5Length = 17;
825 char buf[kMd5Length];
826 EXPECT_EQ(0u,
827 FPDF_GetFileIdentifier(document(), static_cast<FPDF_FILEIDTYPE>(-1),
828 buf, sizeof(buf)));
829 EXPECT_EQ(0u,
830 FPDF_GetFileIdentifier(document(), static_cast<FPDF_FILEIDTYPE>(2),
831 buf, sizeof(buf)));
832 EXPECT_EQ(0u, FPDF_GetFileIdentifier(nullptr, FILEIDTYPE_PERMANENT, buf,
833 sizeof(buf)));
834 EXPECT_EQ(kMd5Length, FPDF_GetFileIdentifier(document(), FILEIDTYPE_PERMANENT,
835 nullptr, 0));
836
837 constexpr char kExpectedPermanent[] =
838 "\xF3\x41\xAE\x65\x4A\x77\xAC\xD5\x06\x5A\x76\x45\xE5\x96\xE6\xE6";
839 ASSERT_EQ(kMd5Length, FPDF_GetFileIdentifier(document(), FILEIDTYPE_PERMANENT,
840 buf, sizeof(buf)));
841 EXPECT_EQ(kExpectedPermanent, ByteString(buf));
842
843 constexpr char kExpectedChanging[] =
844 "\xBC\x37\x29\x8A\x3F\x87\xF4\x79\x22\x9B\xCE\x99\x7C\xA7\x91\xF7";
845 ASSERT_EQ(kMd5Length, FPDF_GetFileIdentifier(document(), FILEIDTYPE_CHANGING,
846 buf, sizeof(buf)));
847 EXPECT_EQ(kExpectedChanging, ByteString(buf));
848}
849
851 ASSERT_TRUE(OpenDocument("non_hex_file_id.pdf"));
852 char buf[18];
853
854 constexpr char kPermanentNonHex[] = "permanent non-hex";
855 ASSERT_EQ(18u, FPDF_GetFileIdentifier(document(), FILEIDTYPE_PERMANENT, buf,
856 sizeof(buf)));
857 EXPECT_EQ(kPermanentNonHex, ByteString(buf));
858
859 constexpr char kChangingNonHex[] = "changing non-hex";
860 ASSERT_EQ(17u, FPDF_GetFileIdentifier(document(), FILEIDTYPE_CHANGING, buf,
861 sizeof(buf)));
862 EXPECT_EQ(kChangingNonHex, ByteString(buf));
863}
864
866 ASSERT_TRUE(OpenDocument("hello_world.pdf"));
867 EXPECT_EQ(
868 0u, FPDF_GetFileIdentifier(document(), FILEIDTYPE_PERMANENT, nullptr, 0));
869 EXPECT_EQ(
870 0u, FPDF_GetFileIdentifier(document(), FILEIDTYPE_CHANGING, nullptr, 0));
871}
872
874 ASSERT_TRUE(OpenDocument("bug_601362.pdf"));
875
876 // Invalid document / tag results in 0.
877 unsigned short buf[128];
878 EXPECT_EQ(0u, FPDF_GetMetaText(document(), nullptr, buf, sizeof(buf)));
879 EXPECT_EQ(0u, FPDF_GetMetaText(nullptr, "", buf, sizeof(buf)));
880
881 // Tags that do not eixst results in an empty wide string.
882 EXPECT_EQ(2u, FPDF_GetMetaText(document(), "", buf, sizeof(buf)));
883 EXPECT_EQ(2u, FPDF_GetMetaText(document(), "foo", buf, sizeof(buf)));
884 ASSERT_EQ(2u, FPDF_GetMetaText(document(), "Title", buf, sizeof(buf)));
885 ASSERT_EQ(2u, FPDF_GetMetaText(document(), "Author", buf, sizeof(buf)));
886 ASSERT_EQ(2u, FPDF_GetMetaText(document(), "Subject", buf, sizeof(buf)));
887 ASSERT_EQ(2u, FPDF_GetMetaText(document(), "Keywords", buf, sizeof(buf)));
888 ASSERT_EQ(2u, FPDF_GetMetaText(document(), "Producer", buf, sizeof(buf)));
889
890 ASSERT_EQ(30u, FPDF_GetMetaText(document(), "Creator", buf, sizeof(buf)));
891 EXPECT_EQ(L"Microsoft Word", GetPlatformWString(buf));
892
893 ASSERT_EQ(48u,
894 FPDF_GetMetaText(document(), "CreationDate", buf, sizeof(buf)));
895 EXPECT_EQ(L"D:20160411190039+00'00'", GetPlatformWString(buf));
896
897 ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf)));
898 EXPECT_EQ(L"D:20160411190039+00'00'", GetPlatformWString(buf));
899}
900
902 ASSERT_TRUE(OpenDocument("utf-8.pdf"));
903
904 unsigned short buf[128];
905
906 ASSERT_EQ(34u, FPDF_GetMetaText(document(), "Producer", buf, sizeof(buf)));
907 EXPECT_EQ(L"Manüally Created", GetPlatformWString(buf));
908
909 FPDF_BOOKMARK child = FPDFBookmark_GetFirstChild(document(), nullptr);
910 EXPECT_TRUE(child);
911 EXPECT_EQ(16u, FPDFBookmark_GetTitle(child, buf, sizeof(buf)));
912 EXPECT_EQ(L"Titlè 1", GetPlatformWString(buf));
913}
914
916 ASSERT_TRUE(OpenDocument("bug_182.pdf"));
917
918 unsigned short buf[128];
919
920 ASSERT_EQ(48u, FPDF_GetMetaText(document(), "Title", buf, sizeof(buf)));
921 EXPECT_EQ(L"Super Visual Formade 印刷", GetPlatformWString(buf));
922}
923
925 ASSERT_TRUE(OpenDocument("annotation_highlight_square_with_ap.pdf"));
926
927 // The PDF has been edited. It has two %%EOF markers, and 2 objects numbered
928 // (1 0). Both objects are /Info dictionaries, but contain different data.
929 // Make sure ModDate is the date of the last modification.
930 unsigned short buf[128];
931 ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf)));
932 EXPECT_EQ(L"D:20170612232940-04'00'", GetPlatformWString(buf));
933}
934
936 ASSERT_TRUE(OpenDocument("embedded_attachments.pdf"));
937
938 // Make sure this is the date from the PDF itself and not the attached PDF.
939 unsigned short buf[128];
940 ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf)));
941 EXPECT_EQ(L"D:20170712214448-07'00'", GetPlatformWString(buf));
942}
943
945 ScopedFPDFDocument empty_doc(FPDF_CreateNewDocument());
946 unsigned short buf[128];
947 EXPECT_EQ(2u, FPDF_GetMetaText(empty_doc.get(), "Title", buf, sizeof(buf)));
948}
949
951 ASSERT_TRUE(OpenDocument("get_page_aaction.pdf"));
952 FPDF_PAGE page = LoadPage(0);
953 EXPECT_TRUE(page);
954
957 EXPECT_FALSE(FPDF_GetPageAAction(page, -1));
958 EXPECT_FALSE(FPDF_GetPageAAction(page, 999));
959
960 FPDF_ACTION action = FPDF_GetPageAAction(page, FPDFPAGE_AACTION_OPEN);
961 EXPECT_EQ(static_cast<unsigned long>(PDFACTION_EMBEDDEDGOTO),
963
964 const char kExpectedResult[] = "\\\\127.0.0.1\\c$\\Program Files\\test.exe";
965 const unsigned long kExpectedLength = sizeof(kExpectedResult);
966 char buf[1024];
967
968 unsigned long bufsize = FPDFAction_GetFilePath(action, nullptr, 0);
969 EXPECT_EQ(kExpectedLength, bufsize);
970 EXPECT_EQ(kExpectedLength, FPDFAction_GetFilePath(action, buf, bufsize));
971 EXPECT_STREQ(kExpectedResult, buf);
972
973 UnloadPage(page);
974
975 page = LoadPage(1);
976 EXPECT_TRUE(page);
977 EXPECT_FALSE(FPDF_GetPageAAction(page, -1));
978
979 UnloadPage(page);
980}
981
983 ASSERT_TRUE(OpenDocument("about_blank.pdf"));
984 EXPECT_EQ(1, FPDF_GetPageCount(document()));
985
986 ASSERT_EQ(0u, FPDF_GetPageLabel(document(), 0, nullptr, 0));
987}
988
990 ASSERT_TRUE(OpenDocument("page_labels.pdf"));
991 EXPECT_EQ(7, FPDF_GetPageCount(document()));
992
993 // We do not request labels, when use FPDFAvail_IsXXXAvail.
994 // Flush all data, to allow read labels.
995 SetWholeFileAvailable();
996
997 unsigned short buf[128];
998 EXPECT_EQ(0u, FPDF_GetPageLabel(document(), -2, buf, sizeof(buf)));
999 EXPECT_EQ(0u, FPDF_GetPageLabel(document(), -1, buf, sizeof(buf)));
1000
1001 ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 0, buf, sizeof(buf)));
1002 EXPECT_EQ(L"i", GetPlatformWString(buf));
1003
1004 ASSERT_EQ(6u, FPDF_GetPageLabel(document(), 1, buf, sizeof(buf)));
1005 EXPECT_EQ(L"ii", GetPlatformWString(buf));
1006
1007 ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 2, buf, sizeof(buf)));
1008 EXPECT_EQ(L"1", GetPlatformWString(buf));
1009
1010 ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 3, buf, sizeof(buf)));
1011 EXPECT_EQ(L"2", GetPlatformWString(buf));
1012
1013 ASSERT_EQ(8u, FPDF_GetPageLabel(document(), 4, buf, sizeof(buf)));
1014 EXPECT_EQ(L"zzA", GetPlatformWString(buf));
1015
1016 ASSERT_EQ(8u, FPDF_GetPageLabel(document(), 5, buf, sizeof(buf)));
1017 EXPECT_EQ(L"zzB", GetPlatformWString(buf));
1018
1019 ASSERT_EQ(2u, FPDF_GetPageLabel(document(), 6, buf, sizeof(buf)));
1020 EXPECT_EQ(L"", GetPlatformWString(buf));
1021
1022 ASSERT_EQ(0u, FPDF_GetPageLabel(document(), 7, buf, sizeof(buf)));
1023 ASSERT_EQ(0u, FPDF_GetPageLabel(document(), 8, buf, sizeof(buf)));
1024}
1025
1026#ifdef PDF_ENABLE_XFA
1027TEST_F(FPDFDocEmbedderTest, GetXFALinks) {
1028 ASSERT_TRUE(OpenDocument("simple_xfa.pdf"));
1029
1030 ScopedFPDFPage page(FPDF_LoadPage(document(), 0));
1031 ASSERT_TRUE(page);
1032
1033 FPDFLink_GetLinkAtPoint(page.get(), 150, 360);
1034 FPDFLink_GetLinkAtPoint(page.get(), 150, 420);
1035
1036 // Test passes if it doesn't crash. See https://crbug.com/840922
1037}
1038#endif // PDF_ENABLE_XFA
fxcrt::ByteString ByteString
Definition bytestring.h:180
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
uint32_t GetParsedPageCountForTesting()
ByteString(const char *ptr)
FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFLink_GetAction(FPDF_LINK link)
Definition fpdf_doc.cpp:361
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFLink_GetDest(FPDF_DOCUMENT document, FPDF_LINK link)
Definition fpdf_doc.cpp:343
FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark)
Definition fpdf_doc.cpp:171
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTION action)
Definition fpdf_doc.cpp:201
FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title)
Definition fpdf_doc.cpp:132
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFDest_GetView(FPDF_DEST dest, unsigned long *pNumParams, FS_FLOAT *pParams)
Definition fpdf_doc.cpp:265
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, void *buffer, unsigned long buflen)
Definition fpdf_doc.cpp:110
FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDF_GetPageAAction(FPDF_PAGE page, int aa_type)
Definition fpdf_doc.cpp:444
FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark)
Definition fpdf_doc.cpp:94
FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y)
Definition fpdf_doc.cpp:325
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark)
Definition fpdf_doc.cpp:149
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetFilePath(FPDF_ACTION action, void *buffer, unsigned long buflen)
Definition fpdf_doc.cpp:217
FPDF_EXPORT int FPDF_CALLCONV FPDFBookmark_GetCount(FPDF_BOOKMARK bookmark)
Definition fpdf_doc.cpp:123
FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV FPDFLink_GetAnnot(FPDF_PAGE page, FPDF_LINK link_annot)
Definition fpdf_doc.cpp:395
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetType(FPDF_ACTION action)
Definition fpdf_doc.cpp:180
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFDest_GetLocationInPage(FPDF_DEST dest, FPDF_BOOL *hasXVal, FPDF_BOOL *hasYVal, FPDF_BOOL *hasZoomVal, FS_FLOAT *x, FS_FLOAT *y, FS_FLOAT *zoom)
Definition fpdf_doc.cpp:282
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetURIPath(FPDF_DOCUMENT document, FPDF_ACTION action, void *buffer, unsigned long buflen)
Definition fpdf_doc.cpp:231
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document, FPDF_BYTESTRING tag, void *buffer, unsigned long buflen)
Definition fpdf_doc.cpp:494
FPDF_EXPORT FPDF_LINK FPDF_CALLCONV FPDFLink_GetLinkAtPoint(FPDF_PAGE page, double x, double y)
Definition fpdf_doc.cpp:307
FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark)
Definition fpdf_doc.cpp:82
FPDF_EXPORT int FPDF_CALLCONV FPDFDest_GetDestPageIndex(FPDF_DOCUMENT document, FPDF_DEST dest)
Definition fpdf_doc.cpp:251
#define PDFDEST_VIEW_UNKNOWN_MODE
Definition fpdf_doc.h:31
#define PDFDEST_VIEW_XYZ
Definition fpdf_doc.h:32
#define PDFACTION_GOTO
Definition fpdf_doc.h:20
#define PDFACTION_EMBEDDEDGOTO
Definition fpdf_doc.h:28
#define PDFACTION_UNSUPPORTED
Definition fpdf_doc.h:18
#define PDFDEST_VIEW_FIT
Definition fpdf_doc.h:33
#define PDFACTION_LAUNCH
Definition fpdf_doc.h:26
#define PDFACTION_URI
Definition fpdf_doc.h:24
TEST_F(FPDFDocEmbedderTest, MultipleSamePage)
FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument()
FPDF_EXPORT void FPDF_CALLCONV FPDFPage_Delete(FPDF_DOCUMENT document, int page_index)
#define FPDFPAGE_AACTION_CLOSE
#define FPDFPAGE_AACTION_OPEN
std::unique_ptr< FPDF_WCHAR, pdfium::FreeDeleter > ScopedFPDFWideString
std::wstring GetPlatformWString(FPDF_WIDESTRING wstr)