| 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 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 pages_[index]->GetAccessibleContentAsValue(current_rotation_)); | 2052 pages_[index]->GetAccessibleContentAsValue(current_rotation_)); |
| 2053 std::string page_json; | 2053 std::string page_json; |
| 2054 base::JSONWriter::Write(node.get(), &page_json); | 2054 base::JSONWriter::Write(node.get(), &page_json); |
| 2055 return page_json; | 2055 return page_json; |
| 2056 } | 2056 } |
| 2057 | 2057 |
| 2058 bool PDFiumEngine::GetPrintScaling() { | 2058 bool PDFiumEngine::GetPrintScaling() { |
| 2059 return !!FPDF_VIEWERREF_GetPrintScaling(doc_); | 2059 return !!FPDF_VIEWERREF_GetPrintScaling(doc_); |
| 2060 } | 2060 } |
| 2061 | 2061 |
| 2062 int PDFiumEngine::GetCopiesToPrint() { |
| 2063 return FPDF_VIEWERREF_GetNumCopies(doc_); |
| 2064 } |
| 2065 |
| 2062 void PDFiumEngine::AppendBlankPages(int num_pages) { | 2066 void PDFiumEngine::AppendBlankPages(int num_pages) { |
| 2063 DCHECK(num_pages != 0); | 2067 DCHECK(num_pages != 0); |
| 2064 | 2068 |
| 2065 if (!doc_) | 2069 if (!doc_) |
| 2066 return; | 2070 return; |
| 2067 | 2071 |
| 2068 selection_.clear(); | 2072 selection_.clear(); |
| 2069 pending_pages_.clear(); | 2073 pending_pages_.clear(); |
| 2070 | 2074 |
| 2071 // Delete all pages except the first one. | 2075 // Delete all pages except the first one. |
| (...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3518 double* height) { | 3522 double* height) { |
| 3519 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 3523 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
| 3520 if (!doc) | 3524 if (!doc) |
| 3521 return false; | 3525 return false; |
| 3522 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 3526 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 3523 FPDF_CloseDocument(doc); | 3527 FPDF_CloseDocument(doc); |
| 3524 return success; | 3528 return success; |
| 3525 } | 3529 } |
| 3526 | 3530 |
| 3527 } // namespace chrome_pdf | 3531 } // namespace chrome_pdf |
| OLD | NEW |