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_save.h" | 7 #include "public/fpdf_save.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return false; | 100 return false; |
101 | 101 |
102 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); | 102 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); |
103 if (!pAcroForm) | 103 if (!pAcroForm) |
104 return false; | 104 return false; |
105 | 105 |
106 CPDF_Object* pXFA = pAcroForm->GetObjectBy("XFA"); | 106 CPDF_Object* pXFA = pAcroForm->GetObjectBy("XFA"); |
107 if (!pXFA) | 107 if (!pXFA) |
108 return true; | 108 return true; |
109 | 109 |
110 if (!pXFA->IsArray()) | 110 CPDF_Array* pArray = pXFA->AsArray(); |
111 return false; | |
112 | |
113 CPDF_Array* pArray = pXFA->GetArray(); | |
114 if (!pArray) | 111 if (!pArray) |
115 return false; | 112 return false; |
116 | 113 |
117 int size = pArray->GetCount(); | 114 int size = pArray->GetCount(); |
118 int iFormIndex = -1; | 115 int iFormIndex = -1; |
119 int iDataSetsIndex = -1; | 116 int iDataSetsIndex = -1; |
120 int iTemplate = -1; | 117 int iTemplate = -1; |
121 int iLast = size - 2; | 118 int iLast = size - 2; |
122 for (int i = 0; i < size - 1; i++) { | 119 for (int i = 0; i < size - 1; i++) { |
123 CPDF_Object* pPDFObj = pArray->GetObjectAt(i); | 120 CPDF_Object* pPDFObj = pArray->GetObjectAt(i); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 FPDF_DWORD flags) { | 308 FPDF_DWORD flags) { |
312 return FPDF_Doc_Save(document, pFileWrite, flags, FALSE, 0); | 309 return FPDF_Doc_Save(document, pFileWrite, flags, FALSE, 0); |
313 } | 310 } |
314 | 311 |
315 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, | 312 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, |
316 FPDF_FILEWRITE* pFileWrite, | 313 FPDF_FILEWRITE* pFileWrite, |
317 FPDF_DWORD flags, | 314 FPDF_DWORD flags, |
318 int fileVersion) { | 315 int fileVersion) { |
319 return FPDF_Doc_Save(document, pFileWrite, flags, TRUE, fileVersion); | 316 return FPDF_Doc_Save(document, pFileWrite, flags, TRUE, fileVersion); |
320 } | 317 } |
OLD | NEW |