| 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/fpdf_edit.h" | 7 #include "public/fpdf_edit.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 if (pInfoDict) { | 50 if (pInfoDict) { |
| 51 if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) | 51 if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) |
| 52 pInfoDict->SetAt("CreationDate", new CPDF_String(DateStr, FALSE)); | 52 pInfoDict->SetAt("CreationDate", new CPDF_String(DateStr, FALSE)); |
| 53 pInfoDict->SetAt("Creator", new CPDF_String(L"PDFium")); | 53 pInfoDict->SetAt("Creator", new CPDF_String(L"PDFium")); |
| 54 } | 54 } |
| 55 | 55 |
| 56 return FPDFDocumentFromCPDFDocument(pDoc); | 56 return FPDFDocumentFromCPDFDocument(pDoc); |
| 57 } | 57 } |
| 58 | 58 |
| 59 DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) { | 59 DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) { |
| 60 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 60 if (UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document)) |
| 61 if (!pDoc || page_index < 0 || page_index >= pDoc->GetPageCount()) | 61 pDoc->DeletePage(page_index); |
| 62 return; | |
| 63 | |
| 64 pDoc->DeletePage(page_index); | |
| 65 } | 62 } |
| 66 | 63 |
| 67 DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, | 64 DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, |
| 68 int page_index, | 65 int page_index, |
| 69 double width, | 66 double width, |
| 70 double height) { | 67 double height) { |
| 71 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 68 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
| 72 if (!pDoc) | 69 if (!pDoc) |
| 73 return nullptr; | 70 return nullptr; |
| 74 | 71 |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || | 305 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || |
| 309 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( | 306 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( |
| 310 "Page")) { | 307 "Page")) { |
| 311 return; | 308 return; |
| 312 } | 309 } |
| 313 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 310 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
| 314 rotate %= 4; | 311 rotate %= 4; |
| 315 | 312 |
| 316 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); | 313 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); |
| 317 } | 314 } |
| OLD | NEW |