示例#1
0
FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,FPDF_DWORD flags, FPDF_BOOL bSetVersion,
                         int fileVerion)
{
    CPDF_Document* pDoc = (CPDF_Document*)document;
    if (!pDoc)
        return 0;

    if ( flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY )
    {
        flags = 0;
    }

    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;
    pStreamWrite->Init( pFileWrite );
    bRet = FileMaker.Create(pStreamWrite, flags);
    delete pStreamWrite;
    return bRet;
}
示例#2
0
FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,
                         FPDF_FILEWRITE* pFileWrite,
                         FPDF_DWORD flags,
                         FPDF_BOOL bSetVersion,
                         int fileVerion) {
  CPDF_Document* pPDFDoc = CPDFDocumentFromFPDFDocument(document);
  if (!pPDFDoc)
    return 0;

#ifdef PDF_ENABLE_XFA
  CPDFXFA_Document* pDoc = (CPDFXFA_Document*)document;
  CFX_PtrArray fileList;
  _SendPreSaveToXFADoc(pDoc, fileList);
#endif  // PDF_ENABLE_XFA

  if (flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY) {
    flags = 0;
  }

  CPDF_Creator FileMaker(pPDFDoc);
  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;
  pStreamWrite->Init(pFileWrite);
  bRet = FileMaker.Create(pStreamWrite, flags);
#ifdef PDF_ENABLE_XFA
  _SendPostSaveToXFADoc(pDoc);
  for (int i = 0; i < fileList.GetSize(); i++) {
    IFX_FileStream* pFile = (IFX_FileStream*)fileList.GetAt(i);
    pFile->Release();
  }
  fileList.RemoveAll();
#endif  // PDF_ENABLE_XFA
  pStreamWrite->Release();
  return bRet;
}