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_ppo.h" | 7 #include "public/fpdf_ppo.h" |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if (!CopyInheritable(pCurPageDict, pSrcPageDict, "MediaBox")) { | 214 if (!CopyInheritable(pCurPageDict, pSrcPageDict, "MediaBox")) { |
215 // Search for "CropBox" in the source page dictionary, | 215 // Search for "CropBox" in the source page dictionary, |
216 // if it does not exists, use the default letter size. | 216 // if it does not exists, use the default letter size. |
217 CPDF_Object* pInheritable = | 217 CPDF_Object* pInheritable = |
218 PageDictGetInheritableTag(pSrcPageDict, "CropBox"); | 218 PageDictGetInheritableTag(pSrcPageDict, "CropBox"); |
219 if (pInheritable) { | 219 if (pInheritable) { |
220 pCurPageDict->SetFor("MediaBox", pInheritable->Clone().release()); | 220 pCurPageDict->SetFor("MediaBox", pInheritable->Clone().release()); |
221 } else { | 221 } else { |
222 // Make the default size to be letter size (8.5'x11') | 222 // Make the default size to be letter size (8.5'x11') |
223 CPDF_Array* pArray = new CPDF_Array; | 223 CPDF_Array* pArray = new CPDF_Array; |
224 pArray->AddNumber(0); | 224 pArray->AddNew<CPDF_Number>(0); |
225 pArray->AddNumber(0); | 225 pArray->AddNew<CPDF_Number>(0); |
226 pArray->AddNumber(612); | 226 pArray->AddNew<CPDF_Number>(612); |
227 pArray->AddNumber(792); | 227 pArray->AddNew<CPDF_Number>(792); |
228 pCurPageDict->SetFor("MediaBox", pArray); | 228 pCurPageDict->SetFor("MediaBox", pArray); |
229 } | 229 } |
230 } | 230 } |
231 | 231 |
232 // 2 Resources - required | 232 // 2 Resources - required |
233 if (!CopyInheritable(pCurPageDict, pSrcPageDict, "Resources")) | 233 if (!CopyInheritable(pCurPageDict, pSrcPageDict, "Resources")) |
234 return false; | 234 return false; |
235 | 235 |
236 // 3 CropBox - optional | 236 // 3 CropBox - optional |
237 CopyInheritable(pCurPageDict, pSrcPageDict, "CropBox"); | 237 CopyInheritable(pCurPageDict, pSrcPageDict, "CropBox"); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 return false; | 383 return false; |
384 | 384 |
385 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); | 385 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); |
386 if (!pDstDict) | 386 if (!pDstDict) |
387 return false; | 387 return false; |
388 | 388 |
389 pDstDict->SetFor("ViewerPreferences", | 389 pDstDict->SetFor("ViewerPreferences", |
390 pSrcDict->CloneDirectObject().release()); | 390 pSrcDict->CloneDirectObject().release()); |
391 return true; | 391 return true; |
392 } | 392 } |
OLD | NEW |