| 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 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2433 HasPermission(PERMISSION_COPY_ACCESSIBLE))) { | 2433 HasPermission(PERMISSION_COPY_ACCESSIBLE))) { |
| 2434 return "{}"; | 2434 return "{}"; |
| 2435 } | 2435 } |
| 2436 | 2436 |
| 2437 if (index < 0 || static_cast<size_t>(index) > pages_.size() - 1) | 2437 if (index < 0 || static_cast<size_t>(index) > pages_.size() - 1) |
| 2438 return "{}"; | 2438 return "{}"; |
| 2439 | 2439 |
| 2440 scoped_ptr<base::Value> node( | 2440 scoped_ptr<base::Value> node( |
| 2441 pages_[index]->GetAccessibleContentAsValue(current_rotation_)); | 2441 pages_[index]->GetAccessibleContentAsValue(current_rotation_)); |
| 2442 std::string page_json; | 2442 std::string page_json; |
| 2443 base::JSONWriter::Write(node.get(), &page_json); | 2443 base::JSONWriter::Write(*node, &page_json); |
| 2444 return page_json; | 2444 return page_json; |
| 2445 } | 2445 } |
| 2446 | 2446 |
| 2447 bool PDFiumEngine::GetPrintScaling() { | 2447 bool PDFiumEngine::GetPrintScaling() { |
| 2448 return !!FPDF_VIEWERREF_GetPrintScaling(doc_); | 2448 return !!FPDF_VIEWERREF_GetPrintScaling(doc_); |
| 2449 } | 2449 } |
| 2450 | 2450 |
| 2451 int PDFiumEngine::GetCopiesToPrint() { | 2451 int PDFiumEngine::GetCopiesToPrint() { |
| 2452 return FPDF_VIEWERREF_GetNumCopies(doc_); | 2452 return FPDF_VIEWERREF_GetNumCopies(doc_); |
| 2453 } | 2453 } |
| (...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4011 double* height) { | 4011 double* height) { |
| 4012 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 4012 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
| 4013 if (!doc) | 4013 if (!doc) |
| 4014 return false; | 4014 return false; |
| 4015 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4015 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 4016 FPDF_CloseDocument(doc); | 4016 FPDF_CloseDocument(doc); |
| 4017 return success; | 4017 return success; |
| 4018 } | 4018 } |
| 4019 | 4019 |
| 4020 } // namespace chrome_pdf | 4020 } // namespace chrome_pdf |
| OLD | NEW |