| 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 "../include/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
| 8 #include "../include/fpdfsave.h" | 8 #include "../include/fpdfsave.h" |
| 9 #include "../include/fpdfedit.h" | 9 #include "../include/fpdfedit.h" |
| 10 #if _FX_OS_ == _FX_ANDROID_ | 10 #if _FX_OS_ == _FX_ANDROID_ |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 return FALSE; | 53 return FALSE; |
| 54 } | 54 } |
| 55 | 55 |
| 56 FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,FPDF
_DWORD flags, FPDF_BOOL bSetVersion, | 56 FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,FPDF
_DWORD flags, FPDF_BOOL bSetVersion, |
| 57 int fileVerion) | 57 int fileVerion) |
| 58 { | 58 { |
| 59 CPDF_Document* pDoc = (CPDF_Document*)document; | 59 CPDF_Document* pDoc = (CPDF_Document*)document; |
| 60 if (!pDoc) | 60 if (!pDoc) |
| 61 return 0; | 61 return 0; |
| 62 | 62 |
| 63 » if ( flags < 1 || flags > 2 ) | 63 » if ( flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY ) |
| 64 { | 64 { |
| 65 flags = 0; | 65 flags = 0; |
| 66 } | 66 } |
| 67 | 67 |
| 68 CPDF_Creator FileMaker(pDoc); | 68 CPDF_Creator FileMaker(pDoc); |
| 69 if(bSetVersion) | 69 if(bSetVersion) |
| 70 FileMaker.SetFileVersion(fileVerion); | 70 FileMaker.SetFileVersion(fileVerion); |
| 71 if(flags == FPDF_REMOVE_SECURITY) |
| 72 { |
| 73 flags = 0; |
| 74 FileMaker.RemoveSecurity(); |
| 75 } |
| 71 CFX_IFileWrite* pStreamWrite = NULL; | 76 CFX_IFileWrite* pStreamWrite = NULL; |
| 72 FX_BOOL bRet; | 77 FX_BOOL bRet; |
| 73 pStreamWrite = new CFX_IFileWrite; | 78 pStreamWrite = new CFX_IFileWrite; |
| 74 pStreamWrite->Init( pFileWrite ); | 79 pStreamWrite->Init( pFileWrite ); |
| 75 bRet = FileMaker.Create(pStreamWrite, flags); | 80 bRet = FileMaker.Create(pStreamWrite, flags); |
| 76 delete pStreamWrite; | 81 delete pStreamWrite; |
| 77 return bRet; | 82 return bRet; |
| 78 } | 83 } |
| 79 | 84 |
| 80 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy( FPDF_DOCUMENT document,FPDF_FILE
WRITE * pFileWrite, | 85 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy( FPDF_DOCUMENT document,FPDF_FILE
WRITE * pFileWrite, |
| 81
FPDF_DWORD flags ) | 86
FPDF_DWORD flags ) |
| 82 { | 87 { |
| 83 return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE , 0); | 88 return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE , 0); |
| 84 } | 89 } |
| 85 | 90 |
| 86 | 91 |
| 87 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion( FPDF_DOCUMENT document,F
PDF_FILEWRITE * pFileWrite, | 92 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion( FPDF_DOCUMENT document,F
PDF_FILEWRITE * pFileWrite, |
| 88 FPDF_DWORD flags, int fileVersion) | 93 FPDF_DWORD flags, int fileVersion) |
| 89 { | 94 { |
| 90 return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE , fileVersion); | 95 return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE , fileVersion); |
| 91 } | 96 } |
| OLD | NEW |