| 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 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 pages_[index]->GetAccessibleContentAsValue(current_rotation_)); | 2072 pages_[index]->GetAccessibleContentAsValue(current_rotation_)); |
| 2073 std::string page_json; | 2073 std::string page_json; |
| 2074 base::JSONWriter::Write(node.get(), &page_json); | 2074 base::JSONWriter::Write(node.get(), &page_json); |
| 2075 return page_json; | 2075 return page_json; |
| 2076 } | 2076 } |
| 2077 | 2077 |
| 2078 bool PDFiumEngine::GetPrintScaling() { | 2078 bool PDFiumEngine::GetPrintScaling() { |
| 2079 return !!FPDF_VIEWERREF_GetPrintScaling(doc_); | 2079 return !!FPDF_VIEWERREF_GetPrintScaling(doc_); |
| 2080 } | 2080 } |
| 2081 | 2081 |
| 2082 int PDFiumEngine::GetCopiesToPrint() { |
| 2083 return FPDF_VIEWERREF_GetNumCopies(doc_); |
| 2084 } |
| 2085 |
| 2082 void PDFiumEngine::AppendBlankPages(int num_pages) { | 2086 void PDFiumEngine::AppendBlankPages(int num_pages) { |
| 2083 DCHECK(num_pages != 0); | 2087 DCHECK(num_pages != 0); |
| 2084 | 2088 |
| 2085 if (!doc_) | 2089 if (!doc_) |
| 2086 return; | 2090 return; |
| 2087 | 2091 |
| 2088 selection_.clear(); | 2092 selection_.clear(); |
| 2089 pending_pages_.clear(); | 2093 pending_pages_.clear(); |
| 2090 | 2094 |
| 2091 // Delete all pages except the first one. | 2095 // Delete all pages except the first one. |
| (...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3536 double* height) { | 3540 double* height) { |
| 3537 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 3541 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
| 3538 if (!doc) | 3542 if (!doc) |
| 3539 return false; | 3543 return false; |
| 3540 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 3544 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 3541 FPDF_CloseDocument(doc); | 3545 FPDF_CloseDocument(doc); |
| 3542 return success; | 3546 return success; |
| 3543 } | 3547 } |
| 3544 | 3548 |
| 3545 } // namespace chrome_pdf | 3549 } // namespace chrome_pdf |
| OLD | NEW |