From a5572c3715624b38ac861c87236185f98fa9083b Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Thu, 12 Jun 2014 13:40:04 -0700 Subject: Enable security removal in FPDF_Doc_Save R=jam@chromium.org Review URL: https://codereview.chromium.org/333753002 --- fpdfsdk/include/fpdfsave.h | 3 ++- fpdfsdk/src/fpdfsave.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/include/fpdfsave.h b/fpdfsdk/include/fpdfsave.h index a69456086a..0909d5a447 100644 --- a/fpdfsdk/include/fpdfsave.h +++ b/fpdfsdk/include/fpdfsave.h @@ -47,7 +47,8 @@ struct FPDF_FILEWRITE{ #define FPDF_INCREMENTAL 1 /** @brief No Incremental. */ #define FPDF_NO_INCREMENTAL 2 - +/** @brief Remove security. */ +#define FPDF_REMOVE_SECURITY 3 // Function: FPDF_SaveAsCopy // Saves the copy of specified document in custom way. diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp index 0c7acc8c47..6637c784fe 100644 --- a/fpdfsdk/src/fpdfsave.cpp +++ b/fpdfsdk/src/fpdfsave.cpp @@ -60,7 +60,7 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,FPDF if (!pDoc) return 0; - if ( flags < 1 || flags > 2 ) + if ( flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY ) { flags = 0; } @@ -68,6 +68,11 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,FPDF CPDF_Creator FileMaker(pDoc); if(bSetVersion) FileMaker.SetFileVersion(fileVerion); + if(flags == FPDF_REMOVE_SECURITY) + { + flags = 0; + FileMaker.RemoveSecurity(); + } CFX_IFileWrite* pStreamWrite = NULL; FX_BOOL bRet; pStreamWrite = new CFX_IFileWrite; -- cgit v1.2.3