OLD | NEW |
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 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 if (nIcon || nType) | 204 if (nIcon || nType) |
205 printf("[icon=%d,type=%d]", nIcon, nType); | 205 printf("[icon=%d,type=%d]", nIcon, nType); |
206 printf(": %ls\n", GetPlatformWString(msg).c_str()); | 206 printf(": %ls\n", GetPlatformWString(msg).c_str()); |
207 return 0; | 207 return 0; |
208 } | 208 } |
209 | 209 |
210 void ExampleDocGotoPage(IPDF_JSPLATFORM*, int pageNumber) { | 210 void ExampleDocGotoPage(IPDF_JSPLATFORM*, int pageNumber) { |
211 printf("Goto Page: %d\n", pageNumber); | 211 printf("Goto Page: %d\n", pageNumber); |
212 } | 212 } |
213 | 213 |
| 214 void ExampleDocMail(IPDF_JSPLATFORM*, |
| 215 void* mailData, |
| 216 int length, |
| 217 FPDF_BOOL bUI, |
| 218 FPDF_WIDESTRING To, |
| 219 FPDF_WIDESTRING Subject, |
| 220 FPDF_WIDESTRING CC, |
| 221 FPDF_WIDESTRING BCC, |
| 222 FPDF_WIDESTRING Msg) { |
| 223 printf("Mail Msg: %d, to=%ls, cc=%ls, bcc=%ls, subject=%ls, body=%ls\n", bUI, |
| 224 GetPlatformWString(To).c_str(), GetPlatformWString(CC).c_str(), |
| 225 GetPlatformWString(BCC).c_str(), GetPlatformWString(Subject).c_str(), |
| 226 GetPlatformWString(Msg).c_str()); |
| 227 } |
| 228 |
214 void ExampleUnsupportedHandler(UNSUPPORT_INFO*, int type) { | 229 void ExampleUnsupportedHandler(UNSUPPORT_INFO*, int type) { |
215 std::string feature = "Unknown"; | 230 std::string feature = "Unknown"; |
216 switch (type) { | 231 switch (type) { |
217 case FPDF_UNSP_DOC_XFAFORM: | 232 case FPDF_UNSP_DOC_XFAFORM: |
218 feature = "XFA"; | 233 feature = "XFA"; |
219 break; | 234 break; |
220 case FPDF_UNSP_DOC_PORTABLECOLLECTION: | 235 case FPDF_UNSP_DOC_PORTABLECOLLECTION: |
221 feature = "Portfolios_Packages"; | 236 feature = "Portfolios_Packages"; |
222 break; | 237 break; |
223 case FPDF_UNSP_DOC_ATTACHMENT: | 238 case FPDF_UNSP_DOC_ATTACHMENT: |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 419 |
405 void RenderPdf(const std::string& name, const char* pBuf, size_t len, | 420 void RenderPdf(const std::string& name, const char* pBuf, size_t len, |
406 const Options& options) { | 421 const Options& options) { |
407 fprintf(stderr, "Rendering PDF file %s.\n", name.c_str()); | 422 fprintf(stderr, "Rendering PDF file %s.\n", name.c_str()); |
408 | 423 |
409 IPDF_JSPLATFORM platform_callbacks; | 424 IPDF_JSPLATFORM platform_callbacks; |
410 memset(&platform_callbacks, '\0', sizeof(platform_callbacks)); | 425 memset(&platform_callbacks, '\0', sizeof(platform_callbacks)); |
411 platform_callbacks.version = 3; | 426 platform_callbacks.version = 3; |
412 platform_callbacks.app_alert = ExampleAppAlert; | 427 platform_callbacks.app_alert = ExampleAppAlert; |
413 platform_callbacks.Doc_gotoPage = ExampleDocGotoPage; | 428 platform_callbacks.Doc_gotoPage = ExampleDocGotoPage; |
| 429 platform_callbacks.Doc_mail = ExampleDocMail; |
414 | 430 |
415 FPDF_FORMFILLINFO form_callbacks; | 431 FPDF_FORMFILLINFO form_callbacks; |
416 memset(&form_callbacks, '\0', sizeof(form_callbacks)); | 432 memset(&form_callbacks, '\0', sizeof(form_callbacks)); |
417 #ifdef PDF_ENABLE_XFA | 433 #ifdef PDF_ENABLE_XFA |
418 form_callbacks.version = 2; | 434 form_callbacks.version = 2; |
419 #else // PDF_ENABLE_XFA | 435 #else // PDF_ENABLE_XFA |
420 form_callbacks.version = 1; | 436 form_callbacks.version = 1; |
421 #endif // PDF_ENABLE_XFA | 437 #endif // PDF_ENABLE_XFA |
422 form_callbacks.m_pJsPlatform = &platform_callbacks; | 438 form_callbacks.m_pJsPlatform = &platform_callbacks; |
423 | 439 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 } | 672 } |
657 | 673 |
658 FPDF_DestroyLibrary(); | 674 FPDF_DestroyLibrary(); |
659 #ifdef PDF_ENABLE_V8 | 675 #ifdef PDF_ENABLE_V8 |
660 v8::V8::ShutdownPlatform(); | 676 v8::V8::ShutdownPlatform(); |
661 delete platform; | 677 delete platform; |
662 #endif // PDF_ENABLE_V8 | 678 #endif // PDF_ENABLE_V8 |
663 | 679 |
664 return 0; | 680 return 0; |
665 } | 681 } |
OLD | NEW |