mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Fix bugs
This commit is contained in:
@ -1142,7 +1142,7 @@ function readWidgetType(reader, rec, readDoubleFunc, readDouble2Func, readString
|
|||||||
rec["value"] = readStringFunc.call(reader);
|
rec["value"] = readStringFunc.call(reader);
|
||||||
if (flags & (1 << 10))
|
if (flags & (1 << 10))
|
||||||
rec["maxLen"] = reader.readInt();
|
rec["maxLen"] = reader.readInt();
|
||||||
if (rec["flag"] & (1 << 25))
|
if (flags & (1 << 11))
|
||||||
rec["richValue"] = readStringFunc.call(reader);
|
rec["richValue"] = readStringFunc.call(reader);
|
||||||
if (isRead)
|
if (isRead)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1903,12 +1903,12 @@ BYTE* CPdfEditor::SplitPages(const int* arrPageIndex, unsigned int unLength)
|
|||||||
mFileToPages[nPDFIndex].push_back(arrPageIndex[i] - nTotalPages);
|
mFileToPages[nPDFIndex].push_back(arrPageIndex[i] - nTotalPages);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
++nPDFIndex;
|
pPDFDocument = m_pReader->GetPDFDocument(++nPDFIndex);
|
||||||
pPDFDocument = m_pReader->GetPDFDocument(nPDFIndex);
|
|
||||||
if (!pPDFDocument)
|
if (!pPDFDocument)
|
||||||
break;
|
break;
|
||||||
nTotalPages += nPages;
|
nTotalPages += nPages;
|
||||||
nPages = pPDFDocument->getNumPages();
|
nPages = pPDFDocument->getNumPages();
|
||||||
|
--i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,6 @@ void CPdfFile::RotatePage(int nRotate)
|
|||||||
{
|
{
|
||||||
if (!m_pInternal->pWriter)
|
if (!m_pInternal->pWriter)
|
||||||
return;
|
return;
|
||||||
// Применение поворота страницы для writer
|
|
||||||
m_pInternal->pWriter->PageRotate(nRotate);
|
m_pInternal->pWriter->PageRotate(nRotate);
|
||||||
}
|
}
|
||||||
bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
|
bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
|
||||||
|
|||||||
@ -580,7 +580,7 @@ bool CPdfReader::MergePages(BYTE* pData, DWORD nLength, const std::wstring& wsPa
|
|||||||
CPdfReaderContext* pContext = new CPdfReaderContext();
|
CPdfReaderContext* pContext = new CPdfReaderContext();
|
||||||
pContext->m_pDocument = new PDFDoc(str, owner_pswd, user_pswd);
|
pContext->m_pDocument = new PDFDoc(str, owner_pswd, user_pswd);
|
||||||
pContext->m_pFontList = new PdfReader::CPdfFontList();
|
pContext->m_pFontList = new PdfReader::CPdfFontList();
|
||||||
pContext->sPrefixForm = sPrefixForm;
|
pContext->m_sPrefixForm = sPrefixForm;
|
||||||
if (nMaxID != 0)
|
if (nMaxID != 0)
|
||||||
pContext->m_nStartID = nMaxID;
|
pContext->m_nStartID = nMaxID;
|
||||||
else if (!m_vPDFContext.empty())
|
else if (!m_vPDFContext.empty())
|
||||||
@ -616,7 +616,7 @@ bool CPdfReader::MergePages(const std::wstring& wsFile, const std::wstring& wsPa
|
|||||||
CPdfReaderContext* pContext = new CPdfReaderContext();
|
CPdfReaderContext* pContext = new CPdfReaderContext();
|
||||||
pContext->m_pDocument = new PDFDoc((char*)sPathUtf8.c_str(), owner_pswd, user_pswd);
|
pContext->m_pDocument = new PDFDoc((char*)sPathUtf8.c_str(), owner_pswd, user_pswd);
|
||||||
pContext->m_pFontList = new PdfReader::CPdfFontList();
|
pContext->m_pFontList = new PdfReader::CPdfFontList();
|
||||||
pContext->sPrefixForm = sPrefixForm;
|
pContext->m_sPrefixForm = sPrefixForm;
|
||||||
if (nMaxID != 0)
|
if (nMaxID != 0)
|
||||||
pContext->m_nStartID = nMaxID;
|
pContext->m_nStartID = nMaxID;
|
||||||
else if (!m_vPDFContext.empty())
|
else if (!m_vPDFContext.empty())
|
||||||
@ -1133,7 +1133,7 @@ BYTE* CPdfReader::GetWidgets()
|
|||||||
NSWasm::CData oRes;
|
NSWasm::CData oRes;
|
||||||
oRes.SkipLen();
|
oRes.SkipLen();
|
||||||
|
|
||||||
std::map<std::string, std::string> mForms;
|
std::map<std::string, std::string> mForms;
|
||||||
int nStartPage = 0;
|
int nStartPage = 0;
|
||||||
for (int iPDF = 0; iPDF < m_vPDFContext.size(); ++iPDF)
|
for (int iPDF = 0; iPDF < m_vPDFContext.size(); ++iPDF)
|
||||||
{
|
{
|
||||||
@ -1166,9 +1166,9 @@ BYTE* CPdfReader::GetWidgets()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int nPrefix = 0;
|
int nPrefix = 0;
|
||||||
std::string sPrefix = m_vPDFContext[iPDF]->sPrefixForm + "_" + std::to_string(nPrefix);
|
std::string sPrefix = m_vPDFContext[iPDF]->m_sPrefixForm + "_" + std::to_string(nPrefix);
|
||||||
while (!pAnnots->ChangeFullNameAnnot(i, sPrefix))
|
while (!pAnnots->ChangeFullNameAnnot(i, sPrefix))
|
||||||
sPrefix = m_vPDFContext[iPDF]->sPrefixForm + "_" + std::to_string(++nPrefix);
|
sPrefix = m_vPDFContext[iPDF]->m_sPrefixForm + "_" + std::to_string(++nPrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1193,7 +1193,7 @@ BYTE* CPdfReader::GetFonts(bool bStandart)
|
|||||||
int nFontsPos = oRes.GetSize();
|
int nFontsPos = oRes.GetSize();
|
||||||
oRes.AddInt(nFonts);
|
oRes.AddInt(nFonts);
|
||||||
|
|
||||||
for (std::map<std::wstring, std::wstring>::iterator it = m_mFonts.begin(); it != m_mFonts.end(); ++it)
|
for (std::map<std::wstring, std::wstring>::const_iterator it = m_mFonts.begin(); it != m_mFonts.end(); ++it)
|
||||||
{
|
{
|
||||||
if (PdfReader::CAnnotFonts::IsBaseFont(it->second))
|
if (PdfReader::CAnnotFonts::IsBaseFont(it->second))
|
||||||
{
|
{
|
||||||
@ -1818,7 +1818,7 @@ BYTE* CPdfReader::GetAPAnnots(int nRasterW, int nRasterH, int nBackgroundColor,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
PdfReader::CAnnotAP* pAP = new PdfReader::CAnnotAP(pDoc, m_pFontManager, pFontList, nRasterW, nRasterH, nBackgroundColor, nPageIndex - 1, sView, &oAnnotRef, nStartRefID);
|
PdfReader::CAnnotAP* pAP = new PdfReader::CAnnotAP(pDoc, m_pFontManager, pFontList, nRasterW, nRasterH, nBackgroundColor, nPageIndex, sView, &oAnnotRef, nStartRefID);
|
||||||
if (pAP)
|
if (pAP)
|
||||||
pAP->ToWASM(oRes);
|
pAP->ToWASM(oRes);
|
||||||
RELEASEOBJECT(pAP);
|
RELEASEOBJECT(pAP);
|
||||||
|
|||||||
@ -46,10 +46,9 @@ struct CPdfReaderContext
|
|||||||
PDFDoc* m_pDocument;
|
PDFDoc* m_pDocument;
|
||||||
PdfReader::CPdfFontList* m_pFontList;
|
PdfReader::CPdfFontList* m_pFontList;
|
||||||
unsigned int m_nStartID;
|
unsigned int m_nStartID;
|
||||||
std::string sPrefixForm;
|
std::string m_sPrefixForm;
|
||||||
|
|
||||||
CPdfReaderContext() : m_pDocument(NULL), m_pFontList(NULL), m_nStartID(0) {}
|
CPdfReaderContext() : m_pDocument(NULL), m_pFontList(NULL), m_nStartID(0) {}
|
||||||
CPdfReaderContext(PDFDoc* pDocument, PdfReader::CPdfFontList* pFontList, unsigned int nStartID) : m_pDocument(pDocument), m_pFontList(pFontList), m_nStartID(nStartID) {}
|
|
||||||
~CPdfReaderContext();
|
~CPdfReaderContext();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -2572,6 +2572,7 @@ void CPdfWriter::SetHeadings(CHeadings* pCommand)
|
|||||||
|
|
||||||
CreateOutlines(m_pDocument, pCommand->GetHeading(), NULL);
|
CreateOutlines(m_pDocument, pCommand->GetHeading(), NULL);
|
||||||
}
|
}
|
||||||
|
void CPdfWriter::SetNeedAddHelvetica(bool bNeedAddHelvetica) { m_bNeedAddHelvetica = bNeedAddHelvetica; }
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Дополнительные функции Pdf рендерера
|
// Дополнительные функции Pdf рендерера
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
@ -2957,14 +2958,8 @@ HRESULT CPdfWriter::EditWidgetParents(NSFonts::IApplicationFonts* pAppFonts, CWi
|
|||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
PdfWriter::CDocument* CPdfWriter::GetDocument()
|
PdfWriter::CDocument* CPdfWriter::GetDocument() { return m_pDocument; }
|
||||||
{
|
PdfWriter::CPage* CPdfWriter::GetPage() { return m_pPage; }
|
||||||
return m_pDocument;
|
|
||||||
}
|
|
||||||
PdfWriter::CPage* CPdfWriter::GetPage()
|
|
||||||
{
|
|
||||||
return m_pPage;
|
|
||||||
}
|
|
||||||
bool CPdfWriter::EditPage(PdfWriter::CPage* pNewPage)
|
bool CPdfWriter::EditPage(PdfWriter::CPage* pNewPage)
|
||||||
{
|
{
|
||||||
if (!IsValid())
|
if (!IsValid())
|
||||||
|
|||||||
@ -210,17 +210,17 @@ public:
|
|||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Дополнительные функции для дозаписи Pdf
|
// Дополнительные функции для дозаписи Pdf
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
|
HRESULT EditWidgetParents(NSFonts::IApplicationFonts* pAppFonts, CWidgetsInfo* pFieldInfo, const std::wstring& wsTempDirectory);
|
||||||
bool EditPage(PdfWriter::CPage* pNewPage);
|
bool EditPage(PdfWriter::CPage* pNewPage);
|
||||||
bool AddPage(int nPageIndex);
|
bool AddPage(int nPageIndex);
|
||||||
bool EditClose();
|
bool EditClose();
|
||||||
void PageRotate(int nRotate);
|
void PageRotate(int nRotate);
|
||||||
void Sign(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsPicturePath, ICertificate* pCertificate);
|
void Sign(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsPicturePath, ICertificate* pCertificate);
|
||||||
HRESULT EditWidgetParents(NSFonts::IApplicationFonts* pAppFonts, CWidgetsInfo* pFieldInfo, const std::wstring& wsTempDirectory);
|
|
||||||
PdfWriter::CDocument* GetDocument();
|
PdfWriter::CDocument* GetDocument();
|
||||||
PdfWriter::CPage* GetPage();
|
PdfWriter::CPage* GetPage();
|
||||||
void AddFont(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic, const std::wstring& wsFontPath, const LONG& lFaceIndex);
|
void AddFont(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic, const std::wstring& wsFontPath, const LONG& lFaceIndex);
|
||||||
void SetHeadings(CHeadings* pCommand);
|
void SetHeadings(CHeadings* pCommand);
|
||||||
void SetNeedAddHelvetica(bool bNeedAddHelvetica) { m_bNeedAddHelvetica = bNeedAddHelvetica; }
|
void SetNeedAddHelvetica(bool bNeedAddHelvetica);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PdfWriter::CImageDict* LoadImage(Aggplus::CImage* pImage, BYTE nAlpha);
|
PdfWriter::CImageDict* LoadImage(Aggplus::CImage* pImage, BYTE nAlpha);
|
||||||
|
|||||||
@ -614,7 +614,7 @@ namespace PdfWriter
|
|||||||
if (pDict->GetStream())
|
if (pDict->GetStream())
|
||||||
{
|
{
|
||||||
unsigned int unFilter = pDict->GetFilter();
|
unsigned int unFilter = pDict->GetFilter();
|
||||||
if (STREAM_FILTER_NONE != unFilter)
|
if (STREAM_FILTER_NONE != unFilter && STREAM_FILTER_ALREADY_DECODE != unFilter)
|
||||||
{
|
{
|
||||||
CArrayObject* pFilter = new CArrayObject();
|
CArrayObject* pFilter = new CArrayObject();
|
||||||
pDict->Add("Filter", pFilter);
|
pDict->Add("Filter", pFilter);
|
||||||
|
|||||||
Reference in New Issue
Block a user