OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "pdf/pdfium/pdfium_engine.h" | 5 #include "pdf/pdfium/pdfium_engine.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 3366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3377 FPDF_GetPageSizeByIndex(doc, page_number, &page_width, &page_height); | 3377 FPDF_GetPageSizeByIndex(doc, page_number, &page_width, &page_height); |
3378 if (page_width > *max_page_width) { | 3378 if (page_width > *max_page_width) { |
3379 *max_page_width = page_width; | 3379 *max_page_width = page_width; |
3380 } | 3380 } |
3381 } | 3381 } |
3382 } | 3382 } |
3383 FPDF_CloseDocument(doc); | 3383 FPDF_CloseDocument(doc); |
3384 return true; | 3384 return true; |
3385 } | 3385 } |
3386 | 3386 |
3387 bool PDFiumEngineExports::GetPDFPageSizeByIndex( | |
3388 const void* pdf_buffer, | |
3389 int buffer_size, | |
3390 int index, | |
3391 double* width, | |
3392 double* height) { | |
3393 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, buffer_size, NULL); | |
3394 bool success = false; | |
3395 if (!doc) | |
3396 return success; | |
Dan Beam
2014/07/09 02:08:32
if (!doc)
return false;
bool success = FPDF_Get
| |
3397 success = FPDF_GetPageSizeByIndex(doc, index, width, height) != 0; | |
3398 FPDF_CloseDocument(doc); | |
3399 return success; | |
3400 } | |
3401 | |
3387 } // namespace chrome_pdf | 3402 } // namespace chrome_pdf |
OLD | NEW |