OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "public/fpdfview.h" | 7 #include "public/fpdfview.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, | 530 DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, |
531 int page_index) { | 531 int page_index) { |
532 UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document); | 532 UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document); |
533 if (!pDoc) | 533 if (!pDoc) |
534 return nullptr; | 534 return nullptr; |
535 | 535 |
536 if (page_index < 0 || page_index >= pDoc->GetPageCount()) | 536 if (page_index < 0 || page_index >= pDoc->GetPageCount()) |
537 return nullptr; | 537 return nullptr; |
538 | 538 |
539 #ifdef PDF_ENABLE_XFA | 539 #ifdef PDF_ENABLE_XFA |
540 return pDoc->GetPage(page_index); | 540 return pDoc->GetXFAPage(page_index); |
541 #else // PDF_ENABLE_XFA | 541 #else // PDF_ENABLE_XFA |
542 CPDF_Dictionary* pDict = pDoc->GetPage(page_index); | 542 CPDF_Dictionary* pDict = pDoc->GetPage(page_index); |
543 if (!pDict) | 543 if (!pDict) |
544 return nullptr; | 544 return nullptr; |
545 | 545 |
546 CPDF_Page* pPage = new CPDF_Page(pDoc, pDict, true); | 546 CPDF_Page* pPage = new CPDF_Page(pDoc, pDict, true); |
547 pPage->ParseContent(); | 547 pPage->ParseContent(); |
548 return pPage; | 548 return pPage; |
549 #endif // PDF_ENABLE_XFA | 549 #endif // PDF_ENABLE_XFA |
550 } | 550 } |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 double* width, | 913 double* width, |
914 double* height) { | 914 double* height) { |
915 UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document); | 915 UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document); |
916 if (!pDoc) | 916 if (!pDoc) |
917 return FALSE; | 917 return FALSE; |
918 | 918 |
919 #ifdef PDF_ENABLE_XFA | 919 #ifdef PDF_ENABLE_XFA |
920 int count = pDoc->GetPageCount(); | 920 int count = pDoc->GetPageCount(); |
921 if (page_index < 0 || page_index >= count) | 921 if (page_index < 0 || page_index >= count) |
922 return FALSE; | 922 return FALSE; |
923 CPDFXFA_Page* pPage = pDoc->GetPage(page_index); | 923 CPDFXFA_Page* pPage = pDoc->GetXFAPage(page_index); |
924 if (!pPage) | 924 if (!pPage) |
925 return FALSE; | 925 return FALSE; |
926 *width = pPage->GetPageWidth(); | 926 *width = pPage->GetPageWidth(); |
927 *height = pPage->GetPageHeight(); | 927 *height = pPage->GetPageHeight(); |
928 #else // PDF_ENABLE_XFA | 928 #else // PDF_ENABLE_XFA |
929 CPDF_Dictionary* pDict = pDoc->GetPage(page_index); | 929 CPDF_Dictionary* pDict = pDoc->GetPage(page_index); |
930 if (!pDict) | 930 if (!pDict) |
931 return FALSE; | 931 return FALSE; |
932 | 932 |
933 CPDF_Page page(pDoc, pDict, true); | 933 CPDF_Page page(pDoc, pDict, true); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 if (!buffer) { | 1129 if (!buffer) { |
1130 *buflen = len; | 1130 *buflen = len; |
1131 } else if (*buflen >= len) { | 1131 } else if (*buflen >= len) { |
1132 memcpy(buffer, utf16Name.c_str(), len); | 1132 memcpy(buffer, utf16Name.c_str(), len); |
1133 *buflen = len; | 1133 *buflen = len; |
1134 } else { | 1134 } else { |
1135 *buflen = -1; | 1135 *buflen = -1; |
1136 } | 1136 } |
1137 return (FPDF_DEST)pDestObj; | 1137 return (FPDF_DEST)pDestObj; |
1138 } | 1138 } |
OLD | NEW |