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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 for (int i = 0; i < page_count; ++i) { | 224 for (int i = 0; i < page_count; ++i) { |
225 FPDF_PAGE page = FPDF_LoadPage(doc, i); | 225 FPDF_PAGE page = FPDF_LoadPage(doc, i); |
226 FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page); | 226 FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page); |
227 FORM_OnAfterLoadPage(page, form); | 227 FORM_OnAfterLoadPage(page, form); |
228 FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_OPEN); | 228 FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_OPEN); |
229 | 229 |
230 int width = static_cast<int>(FPDF_GetPageWidth(page)); | 230 int width = static_cast<int>(FPDF_GetPageWidth(page)); |
231 int height = static_cast<int>(FPDF_GetPageHeight(page)); | 231 int height = static_cast<int>(FPDF_GetPageHeight(page)); |
232 FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0); | 232 FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0); |
233 FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 255, 255, 255, 255); | 233 FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF); |
234 | 234 |
235 FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0); | 235 FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0); |
236 FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, 0); | 236 FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, 0); |
237 if (write_images) { | 237 if (write_images) { |
238 const char* buffer = reinterpret_cast<const char*>( | 238 const char* buffer = reinterpret_cast<const char*>( |
239 FPDFBitmap_GetBuffer(bitmap)); | 239 FPDFBitmap_GetBuffer(bitmap)); |
240 int stride = FPDFBitmap_GetStride(bitmap); | 240 int stride = FPDFBitmap_GetStride(bitmap); |
241 WritePpm(name, i, buffer, stride, width, height); | 241 WritePpm(name, i, buffer, stride, width, height); |
242 } | 242 } |
243 | 243 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 RenderPdf(filename, pBuf, len, write_images); | 296 RenderPdf(filename, pBuf, len, write_images); |
297 } | 297 } |
298 free(pBuf); | 298 free(pBuf); |
299 } | 299 } |
300 | 300 |
301 FPDF_DestroyLibrary(); | 301 FPDF_DestroyLibrary(); |
302 | 302 |
303 return 0; | 303 return 0; |
304 } | 304 } |
305 | 305 |
OLD | NEW |