| 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 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2352 if (pages_[i]->available()) { | 2352 if (pages_[i]->available()) { |
| 2353 selection_.push_back(PDFiumRange(pages_[i], 0, | 2353 selection_.push_back(PDFiumRange(pages_[i], 0, |
| 2354 pages_[i]->GetCharCount())); | 2354 pages_[i]->GetCharCount())); |
| 2355 } | 2355 } |
| 2356 } | 2356 } |
| 2357 | 2357 |
| 2358 int PDFiumEngine::GetNumberOfPages() { | 2358 int PDFiumEngine::GetNumberOfPages() { |
| 2359 return pages_.size(); | 2359 return pages_.size(); |
| 2360 } | 2360 } |
| 2361 | 2361 |
| 2362 | |
| 2363 pp::VarArray PDFiumEngine::GetBookmarks() { | 2362 pp::VarArray PDFiumEngine::GetBookmarks() { |
| 2364 pp::VarDictionary dict = TraverseBookmarks(doc_, NULL); | 2363 pp::VarDictionary dict = TraverseBookmarks(doc_, NULL); |
| 2365 // The root bookmark contains no useful information. | 2364 // The root bookmark contains no useful information. |
| 2366 return pp::VarArray(dict.Get(pp::Var("children"))); | 2365 return pp::VarArray(dict.Get(pp::Var("children"))); |
| 2367 } | 2366 } |
| 2368 | 2367 |
| 2369 int PDFiumEngine::GetNamedDestinationPage(const std::string& destination) { | 2368 int PDFiumEngine::GetNamedDestinationPage(const std::string& destination) { |
| 2370 // Look for the destination. | 2369 // Look for the destination. |
| 2371 FPDF_DEST dest = FPDF_GetNamedDestByName(doc_, destination.c_str()); | 2370 FPDF_DEST dest = FPDF_GetNamedDestByName(doc_, destination.c_str()); |
| 2372 if (!dest) { | 2371 if (!dest) { |
| (...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3991 double* height) { | 3990 double* height) { |
| 3992 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 3991 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
| 3993 if (!doc) | 3992 if (!doc) |
| 3994 return false; | 3993 return false; |
| 3995 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 3994 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 3996 FPDF_CloseDocument(doc); | 3995 FPDF_CloseDocument(doc); |
| 3997 return success; | 3996 return success; |
| 3998 } | 3997 } |
| 3999 | 3998 |
| 4000 } // namespace chrome_pdf | 3999 } // namespace chrome_pdf |
| OLD | NEW |