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/i18n/icu_encoding_detection.h" | 9 #include "base/i18n/icu_encoding_detection.h" |
10 #include "base/i18n/icu_string_conversions.h" | 10 #include "base/i18n/icu_string_conversions.h" |
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 if (!output_doc) | 1573 if (!output_doc) |
1574 return pp::Buffer_Dev(); | 1574 return pp::Buffer_Dev(); |
1575 | 1575 |
1576 SaveSelectedFormForPrint(); | 1576 SaveSelectedFormForPrint(); |
1577 | 1577 |
1578 std::string page_number_str; | 1578 std::string page_number_str; |
1579 for (uint32_t index = 0; index < page_range_count; ++index) { | 1579 for (uint32_t index = 0; index < page_range_count; ++index) { |
1580 if (!page_number_str.empty()) | 1580 if (!page_number_str.empty()) |
1581 page_number_str.append(","); | 1581 page_number_str.append(","); |
1582 page_number_str.append( | 1582 page_number_str.append( |
1583 base::IntToString(page_ranges[index].first_page_number + 1)); | 1583 base::UintToString(page_ranges[index].first_page_number + 1)); |
1584 if (page_ranges[index].first_page_number != | 1584 if (page_ranges[index].first_page_number != |
1585 page_ranges[index].last_page_number) { | 1585 page_ranges[index].last_page_number) { |
1586 page_number_str.append("-"); | 1586 page_number_str.append("-"); |
1587 page_number_str.append( | 1587 page_number_str.append( |
1588 base::IntToString(page_ranges[index].last_page_number + 1)); | 1588 base::UintToString(page_ranges[index].last_page_number + 1)); |
1589 } | 1589 } |
1590 } | 1590 } |
1591 | 1591 |
1592 std::vector<uint32_t> page_numbers = | 1592 std::vector<uint32_t> page_numbers = |
1593 GetPageNumbersFromPrintPageNumberRange(page_ranges, page_range_count); | 1593 GetPageNumbersFromPrintPageNumberRange(page_ranges, page_range_count); |
1594 for (size_t i = 0; i < page_numbers.size(); ++i) { | 1594 for (size_t i = 0; i < page_numbers.size(); ++i) { |
1595 uint32_t page_number = page_numbers[i]; | 1595 uint32_t page_number = page_numbers[i]; |
1596 pages_[page_number]->GetPage(); | 1596 pages_[page_number]->GetPage(); |
1597 if (!IsPageVisible(page_numbers[i])) | 1597 if (!IsPageVisible(page_numbers[i])) |
1598 pages_[page_number]->Unload(); | 1598 pages_[page_number]->Unload(); |
(...skipping 2463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4062 double* height) { | 4062 double* height) { |
4063 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 4063 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
4064 if (!doc) | 4064 if (!doc) |
4065 return false; | 4065 return false; |
4066 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4066 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
4067 FPDF_CloseDocument(doc); | 4067 FPDF_CloseDocument(doc); |
4068 return success; | 4068 return success; |
4069 } | 4069 } |
4070 | 4070 |
4071 } // namespace chrome_pdf | 4071 } // namespace chrome_pdf |
OLD | NEW |