Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(938)

Side by Side Diff: samples/pdfium_test.cc

Issue 1136703003: Merge to XFA: Create top-level public/ header directory. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « public/fpdfview.h ('k') | testing/embedder_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits.h> 5 #include <limits.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 #include <wchar.h> 9 #include <wchar.h>
10 10
11 #include <list> 11 #include <list>
12 #include <sstream> 12 #include <sstream>
13 #include <string> 13 #include <string>
14 #include <utility> 14 #include <utility>
15 #include <vector> 15 #include <vector>
16 16
17 #include "../fpdfsdk/include/fpdf_dataavail.h" 17 #include "../public/fpdf_dataavail.h"
18 #include "../fpdfsdk/include/fpdf_ext.h" 18 #include "../public/fpdf_ext.h"
19 #include "../fpdfsdk/include/fpdfformfill.h" 19 #include "../public/fpdf_formfill.h"
20 #include "../fpdfsdk/include/fpdftext.h" 20 #include "../public/fpdf_text.h"
21 #include "../fpdfsdk/include/fpdfview.h" 21 #include "../public/fpdfview.h"
22 #include "../core/include/fxcrt/fx_system.h"
23 #include "image_diff_png.h" 22 #include "image_diff_png.h"
23 #include "v8/include/libplatform/libplatform.h"
24 #include "v8/include/v8.h" 24 #include "v8/include/v8.h"
25 #include "v8/include/libplatform/libplatform.h"
26 25
27 26
28 #ifdef _WIN32 27 #ifdef _WIN32
29 #define snprintf _snprintf 28 #define snprintf _snprintf
30 #define PATH_SEPARATOR '\\' 29 #define PATH_SEPARATOR '\\'
31 #else 30 #else
32 #define PATH_SEPARATOR '/' 31 #define PATH_SEPARATOR '/'
33 #endif 32 #endif
34 33
35 enum OutputFormat { 34 enum OutputFormat {
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 (void) FPDFAvail_IsPageAvail(pdf_avail, first_page, &hints); 490 (void) FPDFAvail_IsPageAvail(pdf_avail, first_page, &hints);
492 491
493 int page_count = FPDF_GetPageCount(doc); 492 int page_count = FPDF_GetPageCount(doc);
494 for (int i = 0; i < page_count; ++i) { 493 for (int i = 0; i < page_count; ++i) {
495 (void) FPDFAvail_IsPageAvail(pdf_avail, i, &hints); 494 (void) FPDFAvail_IsPageAvail(pdf_avail, i, &hints);
496 } 495 }
497 496
498 FORM_DoDocumentJSAction(form); 497 FORM_DoDocumentJSAction(form);
499 FORM_DoDocumentOpenAction(form); 498 FORM_DoDocumentOpenAction(form);
500 499
501 size_t rendered_pages = 0; 500 int rendered_pages = 0;
502 size_t bad_pages = 0; 501 int bad_pages = 0;
503 for (int i = 0; i < page_count; ++i) { 502 for (int i = 0; i < page_count; ++i) {
504 FPDF_PAGE page = FPDF_LoadPage(doc, i); 503 FPDF_PAGE page = FPDF_LoadPage(doc, i);
505 if (!page) { 504 if (!page) {
506 bad_pages ++; 505 bad_pages ++;
507 continue; 506 continue;
508 } 507 }
509 FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page); 508 FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page);
510 FORM_OnAfterLoadPage(page, form); 509 FORM_OnAfterLoadPage(page, form);
511 FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_OPEN); 510 FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_OPEN);
512 511
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 FORM_OnBeforeClosePage(page, form); 560 FORM_OnBeforeClosePage(page, form);
562 FPDFText_ClosePage(text_page); 561 FPDFText_ClosePage(text_page);
563 FPDF_ClosePage(page); 562 FPDF_ClosePage(page);
564 } 563 }
565 564
566 FORM_DoDocumentAAction(form, FPDFDOC_AACTION_WC); 565 FORM_DoDocumentAAction(form, FPDFDOC_AACTION_WC);
567 FPDF_CloseDocument(doc); 566 FPDF_CloseDocument(doc);
568 FPDFDOC_ExitFormFillEnvironment(form); 567 FPDFDOC_ExitFormFillEnvironment(form);
569 FPDFAvail_Destroy(pdf_avail); 568 FPDFAvail_Destroy(pdf_avail);
570 569
571 fprintf(stderr, "Rendered %" PRIuS " pages.\n", rendered_pages); 570 fprintf(stderr, "Rendered %d pages.\n", rendered_pages);
572 fprintf(stderr, "Skipped %" PRIuS " bad pages.\n", bad_pages); 571 fprintf(stderr, "Skipped %d bad pages.\n", bad_pages);
573 } 572 }
574 573
575 static const char usage_string[] = 574 static const char usage_string[] =
576 "Usage: pdfium_test [OPTION] [FILE]...\n" 575 "Usage: pdfium_test [OPTION] [FILE]...\n"
577 " --bin-dir=<path> - override path to v8 external data\n" 576 " --bin-dir=<path> - override path to v8 external data\n"
578 " --scale=<number> - scale output size by number (e.g. 0.5)\n" 577 " --scale=<number> - scale output size by number (e.g. 0.5)\n"
579 #ifdef _WIN32 578 #ifdef _WIN32
580 " --bmp - write page images <pdf-name>.<page-number>.bmp\n" 579 " --bmp - write page images <pdf-name>.<page-number>.bmp\n"
581 " --emf - write page meta files <pdf-name>.<page-number>.emf\n" 580 " --emf - write page meta files <pdf-name>.<page-number>.emf\n"
582 #endif 581 #endif
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 RenderPdf(filename, file_contents, file_length, options); 626 RenderPdf(filename, file_contents, file_length, options);
628 free(file_contents); 627 free(file_contents);
629 } 628 }
630 629
631 FPDF_DestroyLibrary(); 630 FPDF_DestroyLibrary();
632 v8::V8::ShutdownPlatform(); 631 v8::V8::ShutdownPlatform();
633 delete platform; 632 delete platform;
634 633
635 return 0; 634 return 0;
636 } 635 }
OLDNEW
« no previous file with comments | « public/fpdfview.h ('k') | testing/embedder_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698