blob: b0e0ec7cc37ac32a0a30c9e8b0606a58165fa266 [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// Copyright 2014 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Lei Zhanga6d9f0e2015-06-13 00:48:38 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Lei Zhangb4e7f302015-11-06 15:52:32 -08007#include "public/fpdf_save.h"
8
Dan Sinclair85c8e7f2016-11-21 13:50:32 -05009#include <memory>
10#include <utility>
Dan Sinclair3ebd1212016-03-09 09:59:23 -050011#include <vector>
12
dsinclair24154352016-10-04 11:01:48 -070013#include "core/fpdfapi/edit/cpdf_creator.h"
dsinclair488b7ad2016-10-04 11:55:50 -070014#include "core/fpdfapi/parser/cpdf_array.h"
15#include "core/fpdfapi/parser/cpdf_document.h"
16#include "core/fpdfapi/parser/cpdf_reference.h"
17#include "core/fpdfapi/parser/cpdf_stream_acc.h"
18#include "core/fpdfapi/parser/cpdf_string.h"
Dan Sinclair283a0432017-04-20 14:11:21 -040019#include "core/fxcrt/cfx_memorystream.h"
Dan Sinclaircfb19442017-04-20 13:13:04 -040020#include "core/fxcrt/fx_extension.h"
dsinclair114e46a2016-09-29 17:18:21 -070021#include "fpdfsdk/fsdk_define.h"
Dan Sinclairae4656e2017-05-09 12:36:41 -040022#include "fpdfsdk/fsdk_filewriteadapter.h"
Tom Sepez40e9ff32015-11-30 12:39:54 -080023#include "public/fpdf_edit.h"
24
Tom Sepez51da0932015-11-25 16:05:49 -080025#ifdef PDF_ENABLE_XFA
Dan Sinclairddb70162017-03-30 14:01:31 -040026#include "core/fxcrt/cfx_checksumcontext.h"
dsinclair521b7502016-11-02 13:02:28 -070027#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
dsinclair4d29e782016-10-04 14:02:47 -070028#include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h"
Lei Zhangb4e7f302015-11-06 15:52:32 -080029#include "public/fpdf_formfill.h"
dsinclair5b493092016-09-29 20:20:24 -070030#include "xfa/fxfa/cxfa_eventparam.h"
Dan Sinclair80c48782017-03-23 12:11:20 -040031#include "xfa/fxfa/cxfa_ffapp.h"
32#include "xfa/fxfa/cxfa_ffdocview.h"
33#include "xfa/fxfa/cxfa_ffwidgethandler.h"
34#include "xfa/fxfa/cxfa_widgetacciterator.h"
Tom Sepez51da0932015-11-25 16:05:49 -080035#endif
Tom Sepez1ed8a212015-05-11 15:25:39 -070036
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070037#if _FX_OS_ == _FX_ANDROID_
Dan Sinclair85c8e7f2016-11-21 13:50:32 -050038#include <time.h>
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070039#else
40#include <ctime>
41#endif
42
Tom Sepez7a73eff2016-02-08 13:39:53 -080043namespace {
44
Tom Sepez51da0932015-11-25 16:05:49 -080045#ifdef PDF_ENABLE_XFA
tsepez833619b2016-12-07 09:21:17 -080046bool SaveXFADocumentData(
47 CPDFXFA_Context* pContext,
48 std::vector<CFX_RetainPtr<IFX_SeekableStream>>* fileList) {
dsinclair521b7502016-11-02 13:02:28 -070049 if (!pContext)
Tom Sepez7a73eff2016-02-08 13:39:53 -080050 return false;
51
Dan Sinclaircdba7472017-03-23 09:17:10 -040052 if (pContext->GetDocType() != XFA_DocType::Dynamic &&
53 pContext->GetDocType() != XFA_DocType::Static) {
Tom Sepez7a73eff2016-02-08 13:39:53 -080054 return true;
Dan Sinclaircdba7472017-03-23 09:17:10 -040055 }
Tom Sepez7a73eff2016-02-08 13:39:53 -080056
dsinclair521b7502016-11-02 13:02:28 -070057 CXFA_FFDocView* pXFADocView = pContext->GetXFADocView();
Tom Sepez7a73eff2016-02-08 13:39:53 -080058 if (!pXFADocView)
59 return true;
Bo Xufdc00a72014-10-28 23:03:33 -070060
dsinclair521b7502016-11-02 13:02:28 -070061 CPDF_Document* pPDFDocument = pContext->GetPDFDoc();
62 if (!pPDFDocument)
Tom Sepez7a73eff2016-02-08 13:39:53 -080063 return false;
Bo Xufdc00a72014-10-28 23:03:33 -070064
Nico Weber9d8ec5a2015-08-04 13:00:21 -070065 CPDF_Dictionary* pRoot = pPDFDocument->GetRoot();
Tom Sepez7a73eff2016-02-08 13:39:53 -080066 if (!pRoot)
67 return false;
68
dsinclair38fd8442016-09-15 10:15:32 -070069 CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
Tom Sepez7a73eff2016-02-08 13:39:53 -080070 if (!pAcroForm)
71 return false;
72
dsinclair38fd8442016-09-15 10:15:32 -070073 CPDF_Object* pXFA = pAcroForm->GetObjectFor("XFA");
Tom Sepez7a73eff2016-02-08 13:39:53 -080074 if (!pXFA)
75 return true;
76
thestigb8bf55f2016-05-21 21:08:05 -070077 CPDF_Array* pArray = pXFA->AsArray();
Tom Sepez7a73eff2016-02-08 13:39:53 -080078 if (!pArray)
79 return false;
80
Nico Weber9d8ec5a2015-08-04 13:00:21 -070081 int size = pArray->GetCount();
82 int iFormIndex = -1;
83 int iDataSetsIndex = -1;
84 int iTemplate = -1;
85 int iLast = size - 2;
86 for (int i = 0; i < size - 1; i++) {
tsepezbd567552016-03-29 14:51:50 -070087 CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
Tom Sepez8e5cd192016-01-26 13:20:26 -080088 if (!pPDFObj->IsString())
Nico Weber9d8ec5a2015-08-04 13:00:21 -070089 continue;
90 if (pPDFObj->GetString() == "form")
91 iFormIndex = i + 1;
92 else if (pPDFObj->GetString() == "datasets")
93 iDataSetsIndex = i + 1;
Lei Zhangd983b092015-12-14 16:58:33 -080094 else if (pPDFObj->GetString() == "template")
Nico Weber9d8ec5a2015-08-04 13:00:21 -070095 iTemplate = i + 1;
96 }
Dan Sinclair0bb13332017-03-30 16:12:02 -040097 auto pChecksum = pdfium::MakeUnique<CFX_ChecksumContext>();
dsinclair521b7502016-11-02 13:02:28 -070098 pChecksum->StartChecksum();
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070099
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700100 // template
101 if (iTemplate > -1) {
Wei Li9b761132016-01-29 15:44:20 -0800102 CPDF_Stream* pTemplateStream = pArray->GetStreamAt(iTemplate);
Tom Sepezafd0d1f2017-04-04 14:37:18 -0700103 auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pTemplateStream);
104 pAcc->LoadAllData();
Dan Sinclair283a0432017-04-20 14:11:21 -0400105 CFX_RetainPtr<IFX_SeekableStream> pTemplate =
106 pdfium::MakeRetain<CFX_MemoryStream>(
107 const_cast<uint8_t*>(pAcc->GetData()), pAcc->GetSize(), false);
tsepez833619b2016-12-07 09:21:17 -0800108 pChecksum->UpdateChecksum(pTemplate);
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700109 }
thestig1cd352e2016-06-07 17:53:06 -0700110 CPDF_Stream* pFormStream = nullptr;
111 CPDF_Stream* pDataSetsStream = nullptr;
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700112 if (iFormIndex != -1) {
113 // Get form CPDF_Stream
tsepezbd567552016-03-29 14:51:50 -0700114 CPDF_Object* pFormPDFObj = pArray->GetObjectAt(iFormIndex);
Tom Sepez8e5cd192016-01-26 13:20:26 -0800115 if (pFormPDFObj->IsReference()) {
116 CPDF_Object* pFormDirectObj = pFormPDFObj->GetDirect();
117 if (pFormDirectObj && pFormDirectObj->IsStream()) {
118 pFormStream = (CPDF_Stream*)pFormDirectObj;
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700119 }
Tom Sepez8e5cd192016-01-26 13:20:26 -0800120 } else if (pFormPDFObj->IsStream()) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700121 pFormStream = (CPDF_Stream*)pFormPDFObj;
Tom Sepez2f2ffec2015-07-23 14:42:09 -0700122 }
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700123 }
Lei Zhanga6d9f0e2015-06-13 00:48:38 -0700124
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700125 if (iDataSetsIndex != -1) {
126 // Get datasets CPDF_Stream
tsepezbd567552016-03-29 14:51:50 -0700127 CPDF_Object* pDataSetsPDFObj = pArray->GetObjectAt(iDataSetsIndex);
Tom Sepez8e5cd192016-01-26 13:20:26 -0800128 if (pDataSetsPDFObj->IsReference()) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700129 CPDF_Reference* pDataSetsRefObj = (CPDF_Reference*)pDataSetsPDFObj;
Tom Sepez8e5cd192016-01-26 13:20:26 -0800130 CPDF_Object* pDataSetsDirectObj = pDataSetsRefObj->GetDirect();
131 if (pDataSetsDirectObj && pDataSetsDirectObj->IsStream()) {
132 pDataSetsStream = (CPDF_Stream*)pDataSetsDirectObj;
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700133 }
Tom Sepez8e5cd192016-01-26 13:20:26 -0800134 } else if (pDataSetsPDFObj->IsStream()) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700135 pDataSetsStream = (CPDF_Stream*)pDataSetsPDFObj;
Tom Sepez2f2ffec2015-07-23 14:42:09 -0700136 }
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700137 }
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700138 // L"datasets"
139 {
Dan Sinclair283a0432017-04-20 14:11:21 -0400140 CFX_RetainPtr<IFX_SeekableStream> pDsfileWrite =
141 pdfium::MakeRetain<CFX_MemoryStream>(false);
tsepez833619b2016-12-07 09:21:17 -0800142 if (pXFADocView->GetDoc()->SavePackage(XFA_HASHCODE_Datasets, pDsfileWrite,
143 nullptr) &&
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700144 pDsfileWrite->GetSize() > 0) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700145 // Datasets
tsepez833619b2016-12-07 09:21:17 -0800146 pChecksum->UpdateChecksum(pDsfileWrite);
dsinclair521b7502016-11-02 13:02:28 -0700147 pChecksum->FinishChecksum();
tsepez9e05ee12016-11-21 13:19:10 -0800148 auto pDataDict = pdfium::MakeUnique<CPDF_Dictionary>(
149 pPDFDocument->GetByteStringPool());
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700150 if (iDataSetsIndex != -1) {
tsepez9e05ee12016-11-21 13:19:10 -0800151 if (pDataSetsStream) {
tsepez833619b2016-12-07 09:21:17 -0800152 pDataSetsStream->InitStreamFromFile(pDsfileWrite,
tsepez9e05ee12016-11-21 13:19:10 -0800153 std::move(pDataDict));
154 }
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700155 } else {
tsepez70c4afd2016-11-15 11:33:44 -0800156 CPDF_Stream* pData = pPDFDocument->NewIndirect<CPDF_Stream>();
tsepez833619b2016-12-07 09:21:17 -0800157 pData->InitStreamFromFile(pDsfileWrite, std::move(pDataDict));
Tom Sepez3343d142015-11-02 09:54:54 -0800158 iLast = pArray->GetCount() - 2;
tsepez8a3aa452016-11-16 12:26:06 -0800159 pArray->InsertNewAt<CPDF_String>(iLast, "datasets", false);
160 pArray->InsertNewAt<CPDF_Reference>(iLast + 1, pPDFDocument,
161 pData->GetObjNum());
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700162 }
Tom Sepez7a73eff2016-02-08 13:39:53 -0800163 fileList->push_back(std::move(pDsfileWrite));
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700164 }
165 }
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700166 // L"form"
167 {
Dan Sinclair283a0432017-04-20 14:11:21 -0400168 CFX_RetainPtr<IFX_SeekableStream> pfileWrite =
169 pdfium::MakeRetain<CFX_MemoryStream>(false);
tsepez833619b2016-12-07 09:21:17 -0800170 if (pXFADocView->GetDoc()->SavePackage(XFA_HASHCODE_Form, pfileWrite,
dsinclair521b7502016-11-02 13:02:28 -0700171 pChecksum.get()) &&
Tom Sepez7a73eff2016-02-08 13:39:53 -0800172 pfileWrite->GetSize() > 0) {
tsepez9e05ee12016-11-21 13:19:10 -0800173 auto pDataDict = pdfium::MakeUnique<CPDF_Dictionary>(
174 pPDFDocument->GetByteStringPool());
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700175 if (iFormIndex != -1) {
tsepez833619b2016-12-07 09:21:17 -0800176 if (pFormStream)
177 pFormStream->InitStreamFromFile(pfileWrite, std::move(pDataDict));
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700178 } else {
tsepez70c4afd2016-11-15 11:33:44 -0800179 CPDF_Stream* pData = pPDFDocument->NewIndirect<CPDF_Stream>();
tsepez833619b2016-12-07 09:21:17 -0800180 pData->InitStreamFromFile(pfileWrite, std::move(pDataDict));
Tom Sepez3343d142015-11-02 09:54:54 -0800181 iLast = pArray->GetCount() - 2;
tsepez8a3aa452016-11-16 12:26:06 -0800182 pArray->InsertNewAt<CPDF_String>(iLast, "form", false);
183 pArray->InsertNewAt<CPDF_Reference>(iLast + 1, pPDFDocument,
184 pData->GetObjNum());
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700185 }
Tom Sepez7a73eff2016-02-08 13:39:53 -0800186 fileList->push_back(std::move(pfileWrite));
Tom Sepez2f2ffec2015-07-23 14:42:09 -0700187 }
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700188 }
Tom Sepez7a73eff2016-02-08 13:39:53 -0800189 return true;
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700190}
191
dsinclair521b7502016-11-02 13:02:28 -0700192bool SendPostSaveToXFADoc(CPDFXFA_Context* pContext) {
193 if (!pContext)
Tom Sepez7a73eff2016-02-08 13:39:53 -0800194 return false;
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700195
Dan Sinclaircdba7472017-03-23 09:17:10 -0400196 if (pContext->GetDocType() != XFA_DocType::Dynamic &&
197 pContext->GetDocType() != XFA_DocType::Static)
Tom Sepez7a73eff2016-02-08 13:39:53 -0800198 return true;
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700199
dsinclair521b7502016-11-02 13:02:28 -0700200 CXFA_FFDocView* pXFADocView = pContext->GetXFADocView();
Tom Sepez7a73eff2016-02-08 13:39:53 -0800201 if (!pXFADocView)
202 return false;
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700203
dsinclairdf4bc592016-03-31 20:34:43 -0700204 CXFA_FFWidgetHandler* pWidgetHander = pXFADocView->GetWidgetHandler();
Tom Sepez40badde2017-05-01 13:21:39 -0700205 std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator =
206 pXFADocView->CreateWidgetAccIterator();
tsepeze7b28532016-05-18 12:10:49 -0700207 while (CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext()) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700208 CXFA_EventParam preParam;
209 preParam.m_eType = XFA_EVENT_PostSave;
210 pWidgetHander->ProcessEvent(pWidgetAcc, &preParam);
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700211 }
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700212 pXFADocView->UpdateDocView();
dsinclair521b7502016-11-02 13:02:28 -0700213 pContext->ClearChangeMark();
Tom Sepez7a73eff2016-02-08 13:39:53 -0800214 return true;
Bo Xufdc00a72014-10-28 23:03:33 -0700215}
216
tsepez833619b2016-12-07 09:21:17 -0800217bool SendPreSaveToXFADoc(
218 CPDFXFA_Context* pContext,
219 std::vector<CFX_RetainPtr<IFX_SeekableStream>>* fileList) {
Dan Sinclaircdba7472017-03-23 09:17:10 -0400220 if (pContext->GetDocType() != XFA_DocType::Dynamic &&
221 pContext->GetDocType() != XFA_DocType::Static)
Tom Sepez7a73eff2016-02-08 13:39:53 -0800222 return true;
223
dsinclair521b7502016-11-02 13:02:28 -0700224 CXFA_FFDocView* pXFADocView = pContext->GetXFADocView();
Tom Sepez7a73eff2016-02-08 13:39:53 -0800225 if (!pXFADocView)
226 return true;
227
dsinclairdf4bc592016-03-31 20:34:43 -0700228 CXFA_FFWidgetHandler* pWidgetHander = pXFADocView->GetWidgetHandler();
Tom Sepez40badde2017-05-01 13:21:39 -0700229 std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator =
230 pXFADocView->CreateWidgetAccIterator();
tsepeze7b28532016-05-18 12:10:49 -0700231 while (CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext()) {
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700232 CXFA_EventParam preParam;
233 preParam.m_eType = XFA_EVENT_PreSave;
234 pWidgetHander->ProcessEvent(pWidgetAcc, &preParam);
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700235 }
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700236 pXFADocView->UpdateDocView();
dsinclair521b7502016-11-02 13:02:28 -0700237 return SaveXFADocumentData(pContext, fileList);
Bo Xufdc00a72014-10-28 23:03:33 -0700238}
Tom Sepez40e9ff32015-11-30 12:39:54 -0800239#endif // PDF_ENABLE_XFA
Bo Xufdc00a72014-10-28 23:03:33 -0700240
Tom Sepez7a73eff2016-02-08 13:39:53 -0800241bool FPDF_Doc_Save(FPDF_DOCUMENT document,
242 FPDF_FILEWRITE* pFileWrite,
243 FPDF_DWORD flags,
244 FPDF_BOOL bSetVersion,
245 int fileVerion) {
Tom Sepez1b246282015-11-25 15:15:31 -0800246 CPDF_Document* pPDFDoc = CPDFDocumentFromFPDFDocument(document);
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700247 if (!pPDFDoc)
248 return 0;
Lei Zhanga6d9f0e2015-06-13 00:48:38 -0700249
Tom Sepez51da0932015-11-25 16:05:49 -0800250#ifdef PDF_ENABLE_XFA
dsinclair521b7502016-11-02 13:02:28 -0700251 CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document);
tsepez833619b2016-12-07 09:21:17 -0800252 std::vector<CFX_RetainPtr<IFX_SeekableStream>> fileList;
dsinclair521b7502016-11-02 13:02:28 -0700253 SendPreSaveToXFADoc(pContext, &fileList);
Tom Sepez40e9ff32015-11-30 12:39:54 -0800254#endif // PDF_ENABLE_XFA
Tom Sepez1b246282015-11-25 15:15:31 -0800255
Tom Sepez7a73eff2016-02-08 13:39:53 -0800256 if (flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY)
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700257 flags = 0;
Lei Zhanga6d9f0e2015-06-13 00:48:38 -0700258
Dan Sinclairae4656e2017-05-09 12:36:41 -0400259 CPDF_Creator fileMaker(pPDFDoc,
260 pdfium::MakeRetain<FSDK_FileWriteAdapter>(pFileWrite));
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700261 if (bSetVersion)
Dan Sinclairae4656e2017-05-09 12:36:41 -0400262 fileMaker.SetFileVersion(fileVerion);
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700263 if (flags == FPDF_REMOVE_SECURITY) {
264 flags = 0;
Dan Sinclairae4656e2017-05-09 12:36:41 -0400265 fileMaker.RemoveSecurity();
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700266 }
Tom Sepez1b246282015-11-25 15:15:31 -0800267
Dan Sinclairae4656e2017-05-09 12:36:41 -0400268 bool bRet = fileMaker.Create(flags);
Tom Sepez51da0932015-11-25 16:05:49 -0800269#ifdef PDF_ENABLE_XFA
dsinclair521b7502016-11-02 13:02:28 -0700270 SendPostSaveToXFADoc(pContext);
Tom Sepez40e9ff32015-11-30 12:39:54 -0800271#endif // PDF_ENABLE_XFA
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700272 return bRet;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700273}
274
Tom Sepez7a73eff2016-02-08 13:39:53 -0800275} // namespace
276
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700277DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document,
278 FPDF_FILEWRITE* pFileWrite,
279 FPDF_DWORD flags) {
tsepez4cf55152016-11-02 14:37:54 -0700280 return FPDF_Doc_Save(document, pFileWrite, flags, false, 0);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700281}
282
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700283DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,
284 FPDF_FILEWRITE* pFileWrite,
285 FPDF_DWORD flags,
286 int fileVersion) {
tsepez4cf55152016-11-02 14:37:54 -0700287 return FPDF_Doc_Save(document, pFileWrite, flags, true, fileVersion);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700288}