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 #include <wchar.h> |
9 | 10 |
10 #include <list> | 11 #include <list> |
11 #include <string> | 12 #include <string> |
12 #include <utility> | 13 #include <utility> |
13 | 14 |
14 #include "../fpdfsdk/include/fpdf_dataavail.h" | 15 #include "../fpdfsdk/include/fpdf_dataavail.h" |
15 #include "../fpdfsdk/include/fpdf_ext.h" | 16 #include "../fpdfsdk/include/fpdf_ext.h" |
16 #include "../fpdfsdk/include/fpdfformfill.h" | 17 #include "../fpdfsdk/include/fpdfformfill.h" |
17 #include "../fpdfsdk/include/fpdftext.h" | 18 #include "../fpdfsdk/include/fpdftext.h" |
18 #include "../fpdfsdk/include/fpdfview.h" | 19 #include "../fpdfsdk/include/fpdfview.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // If a PS_NULL pen is used, the dimensions of the rectangle are 1 pixel less. | 129 // If a PS_NULL pen is used, the dimensions of the rectangle are 1 pixel less. |
129 Rectangle(dc, 0, 0, width + 1, height + 1); | 130 Rectangle(dc, 0, 0, width + 1, height + 1); |
130 | 131 |
131 FPDF_RenderPage(dc, page, 0, 0, width, height, 0, | 132 FPDF_RenderPage(dc, page, 0, 0, width, height, 0, |
132 FPDF_ANNOT | FPDF_PRINTING | FPDF_NO_CATCH); | 133 FPDF_ANNOT | FPDF_PRINTING | FPDF_NO_CATCH); |
133 | 134 |
134 DeleteEnhMetaFile(CloseEnhMetaFile(dc)); | 135 DeleteEnhMetaFile(CloseEnhMetaFile(dc)); |
135 } | 136 } |
136 #endif | 137 #endif |
137 | 138 |
138 int Form_Alert(IPDF_JSPLATFORM*, FPDF_WIDESTRING, FPDF_WIDESTRING, int, int) { | 139 int Form_Alert(IPDF_JSPLATFORM*, FPDF_WIDESTRING msg, FPDF_WIDESTRING, |
139 printf("Form_Alert called.\n"); | 140 int, int) { |
| 141 // Deal with differences between UTF16LE and wchar_t on this platform. |
| 142 size_t characters = 0; |
| 143 while (msg[characters]) { |
| 144 ++characters; |
| 145 } |
| 146 wchar_t* platform_string = |
| 147 (wchar_t*)malloc((characters + 1) * sizeof(wchar_t)); |
| 148 for (size_t i = 0; i < characters + 1; ++i) { |
| 149 unsigned char* ptr = (unsigned char*)&msg[i]; |
| 150 platform_string[i] = ptr[0] + 256 * ptr[1]; |
| 151 } |
| 152 printf("Alert: %ls\n", platform_string); |
| 153 free(platform_string); |
140 return 0; | 154 return 0; |
141 } | 155 } |
142 | 156 |
143 void Unsupported_Handler(UNSUPPORT_INFO*, int type) { | 157 void Unsupported_Handler(UNSUPPORT_INFO*, int type) { |
144 std::string feature = "Unknown"; | 158 std::string feature = "Unknown"; |
145 switch (type) { | 159 switch (type) { |
146 case FPDF_UNSP_DOC_XFAFORM: | 160 case FPDF_UNSP_DOC_XFAFORM: |
147 feature = "XFA"; | 161 feature = "XFA"; |
148 break; | 162 break; |
149 case FPDF_UNSP_DOC_PORTABLECOLLECTION: | 163 case FPDF_UNSP_DOC_PORTABLECOLLECTION: |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } else { | 423 } else { |
410 RenderPdf(filename, pBuf, len, format); | 424 RenderPdf(filename, pBuf, len, format); |
411 } | 425 } |
412 free(pBuf); | 426 free(pBuf); |
413 } | 427 } |
414 | 428 |
415 FPDF_DestroyLibrary(); | 429 FPDF_DestroyLibrary(); |
416 | 430 |
417 return 0; | 431 return 0; |
418 } | 432 } |
OLD | NEW |