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 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "printing/pdf_transform.h" | 46 #include "printing/pdf_transform.h" |
47 #include "printing/units.h" | 47 #include "printing/units.h" |
48 #include "third_party/pdfium/public/fpdf_edit.h" | 48 #include "third_party/pdfium/public/fpdf_edit.h" |
49 #include "third_party/pdfium/public/fpdf_ext.h" | 49 #include "third_party/pdfium/public/fpdf_ext.h" |
50 #include "third_party/pdfium/public/fpdf_flatten.h" | 50 #include "third_party/pdfium/public/fpdf_flatten.h" |
51 #include "third_party/pdfium/public/fpdf_ppo.h" | 51 #include "third_party/pdfium/public/fpdf_ppo.h" |
52 #include "third_party/pdfium/public/fpdf_save.h" | 52 #include "third_party/pdfium/public/fpdf_save.h" |
53 #include "third_party/pdfium/public/fpdf_searchex.h" | 53 #include "third_party/pdfium/public/fpdf_searchex.h" |
54 #include "third_party/pdfium/public/fpdf_sysfontinfo.h" | 54 #include "third_party/pdfium/public/fpdf_sysfontinfo.h" |
55 #include "third_party/pdfium/public/fpdf_transformpage.h" | 55 #include "third_party/pdfium/public/fpdf_transformpage.h" |
| 56 #include "third_party/pdfium/public/fpdfview.h" |
56 #include "ui/events/keycodes/keyboard_codes.h" | 57 #include "ui/events/keycodes/keyboard_codes.h" |
57 #include "ui/gfx/geometry/rect.h" | 58 #include "ui/gfx/geometry/rect.h" |
58 #include "v8/include/v8.h" | 59 #include "v8/include/v8.h" |
59 | 60 |
60 using printing::ConvertUnit; | 61 using printing::ConvertUnit; |
61 using printing::ConvertUnitDouble; | 62 using printing::ConvertUnitDouble; |
62 using printing::kPointsPerInch; | 63 using printing::kPointsPerInch; |
63 using printing::kPixelsPerInch; | 64 using printing::kPixelsPerInch; |
64 | 65 |
65 namespace chrome_pdf { | 66 namespace chrome_pdf { |
(...skipping 3803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3869 FPDFBitmap_Destroy(bitmap); | 3870 FPDFBitmap_Destroy(bitmap); |
3870 } else { | 3871 } else { |
3871 FPDF_RenderPage(dc, page, dest.x(), dest.y(), dest.width(), dest.height(), | 3872 FPDF_RenderPage(dc, page, dest.x(), dest.y(), dest.width(), dest.height(), |
3872 rotate, FPDF_ANNOT | FPDF_PRINTING | FPDF_NO_CATCH); | 3873 rotate, FPDF_ANNOT | FPDF_PRINTING | FPDF_NO_CATCH); |
3873 } | 3874 } |
3874 RestoreDC(dc, save_state); | 3875 RestoreDC(dc, save_state); |
3875 FPDF_ClosePage(page); | 3876 FPDF_ClosePage(page); |
3876 FPDF_CloseDocument(doc); | 3877 FPDF_CloseDocument(doc); |
3877 return true; | 3878 return true; |
3878 } | 3879 } |
| 3880 |
| 3881 void PDFiumEngineExports::SetPDFEnsureTypefaceCharactersAccessible( |
| 3882 PDFEnsureTypefaceCharactersAccessible func) { |
| 3883 FPDF_SetTypefaceAccessibleFunc( |
| 3884 reinterpret_cast<PDFiumEnsureTypefaceCharactersAccessible>(func)); |
| 3885 } |
| 3886 |
| 3887 void PDFiumEngineExports::SetPDFUseGDIPrinting(bool enable) { |
| 3888 FPDF_SetPrintTextWithGDI(enable); |
| 3889 } |
3879 #endif // defined(OS_WIN) | 3890 #endif // defined(OS_WIN) |
3880 | 3891 |
3881 bool PDFiumEngineExports::RenderPDFPageToBitmap( | 3892 bool PDFiumEngineExports::RenderPDFPageToBitmap( |
3882 const void* pdf_buffer, | 3893 const void* pdf_buffer, |
3883 int pdf_buffer_size, | 3894 int pdf_buffer_size, |
3884 int page_number, | 3895 int page_number, |
3885 const RenderingSettings& settings, | 3896 const RenderingSettings& settings, |
3886 void* bitmap_buffer) { | 3897 void* bitmap_buffer) { |
3887 FPDF_DOCUMENT doc = | 3898 FPDF_DOCUMENT doc = |
3888 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 3899 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3950 FPDF_DOCUMENT doc = | 3961 FPDF_DOCUMENT doc = |
3951 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 3962 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
3952 if (!doc) | 3963 if (!doc) |
3953 return false; | 3964 return false; |
3954 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 3965 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
3955 FPDF_CloseDocument(doc); | 3966 FPDF_CloseDocument(doc); |
3956 return success; | 3967 return success; |
3957 } | 3968 } |
3958 | 3969 |
3959 } // namespace chrome_pdf | 3970 } // namespace chrome_pdf |
OLD | NEW |