mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Fix bug 56082
This commit is contained in:
@ -46,6 +46,12 @@ namespace MetaFile
|
|||||||
virtual int GetType() { return 0; }
|
virtual int GetType() { return 0; }
|
||||||
virtual void ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight = -1) {}
|
virtual void ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight = -1) {}
|
||||||
virtual NSFonts::IFontManager* get_FontManager() { return NULL; }
|
virtual NSFonts::IFontManager* get_FontManager() { return NULL; }
|
||||||
|
|
||||||
|
virtual void ConvertToXml(const wchar_t* wsFilePath) {}
|
||||||
|
virtual void ConvertToXmlAndRaster(const wchar_t *wsXmlFilePath, const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight = -1) {}
|
||||||
|
|
||||||
|
virtual bool LoadFromXmlFile(const wchar_t* wsFilePath) { return false; }
|
||||||
|
virtual void ConvertToEmf(const wchar_t *wsFilePath) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
IMetaFile* Create(NSFonts::IApplicationFonts *pAppFonts)
|
IMetaFile* Create(NSFonts::IApplicationFonts *pAppFonts)
|
||||||
|
|||||||
@ -76,6 +76,7 @@ namespace PdfReader
|
|||||||
NSFonts::IFontManager* m_pFontManager;
|
NSFonts::IFontManager* m_pFontManager;
|
||||||
CFontList* m_pFontList;
|
CFontList* m_pFontList;
|
||||||
CPdfRenderer* m_pPdfWriter;
|
CPdfRenderer* m_pPdfWriter;
|
||||||
|
DWORD m_nFileLength;
|
||||||
|
|
||||||
void GetPageTree(XRef* xref, Object* pPagesRefObj)
|
void GetPageTree(XRef* xref, Object* pPagesRefObj)
|
||||||
{
|
{
|
||||||
@ -129,7 +130,8 @@ namespace PdfReader
|
|||||||
|
|
||||||
m_pInternal->m_pPDFDocument = NULL;
|
m_pInternal->m_pPDFDocument = NULL;
|
||||||
m_pInternal->m_pFontManager = NULL;
|
m_pInternal->m_pFontManager = NULL;
|
||||||
m_pInternal->m_pPdfWriter = NULL;
|
m_pInternal->m_pPdfWriter = NULL;
|
||||||
|
m_pInternal->m_nFileLength = 0;
|
||||||
|
|
||||||
globalParams = new GlobalParamsAdaptor(NULL);
|
globalParams = new GlobalParamsAdaptor(NULL);
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
@ -208,6 +210,13 @@ namespace PdfReader
|
|||||||
delete owner_pswd;
|
delete owner_pswd;
|
||||||
delete user_pswd;
|
delete user_pswd;
|
||||||
|
|
||||||
|
NSFile::CFileBinary oFile;
|
||||||
|
if (oFile.OpenFile(wsSrcPath))
|
||||||
|
{
|
||||||
|
m_pInternal->m_nFileLength = oFile.GetFileSize();
|
||||||
|
oFile.CloseFile();
|
||||||
|
}
|
||||||
|
|
||||||
if (m_pInternal->m_pPDFDocument)
|
if (m_pInternal->m_pPDFDocument)
|
||||||
m_eError = m_pInternal->m_pPDFDocument->getErrorCode();
|
m_eError = m_pInternal->m_pPDFDocument->getErrorCode();
|
||||||
else
|
else
|
||||||
@ -248,6 +257,7 @@ namespace PdfReader
|
|||||||
// будет освобожден в деструкторе PDFDoc
|
// будет освобожден в деструкторе PDFDoc
|
||||||
BaseStream *str = new MemStream((char*)data, 0, length, &obj);
|
BaseStream *str = new MemStream((char*)data, 0, length, &obj);
|
||||||
m_pInternal->m_pPDFDocument = new PDFDoc(str, owner_pswd, user_pswd);
|
m_pInternal->m_pPDFDocument = new PDFDoc(str, owner_pswd, user_pswd);
|
||||||
|
m_pInternal->m_nFileLength = length;
|
||||||
|
|
||||||
delete owner_pswd;
|
delete owner_pswd;
|
||||||
delete user_pswd;
|
delete user_pswd;
|
||||||
@ -649,7 +659,7 @@ return 0;
|
|||||||
}\
|
}\
|
||||||
}\
|
}\
|
||||||
|
|
||||||
std::wstring CPdfReader::GetInfo(unsigned long nFileLength)
|
std::wstring CPdfReader::GetInfo()
|
||||||
{
|
{
|
||||||
if (!m_pInternal->m_pPDFDocument)
|
if (!m_pInternal->m_pPDFDocument)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -712,7 +722,7 @@ return 0;
|
|||||||
if (obj5.isNum() && obj5.getNum() > 0 && obj6.isNum())
|
if (obj5.isNum() && obj5.getNum() > 0 && obj6.isNum())
|
||||||
{
|
{
|
||||||
unsigned long size = obj6.getNum();
|
unsigned long size = obj6.getNum();
|
||||||
bLinearized = size == nFileLength;
|
bLinearized = size == m_pInternal->m_nFileLength;
|
||||||
}
|
}
|
||||||
obj6.free();
|
obj6.free();
|
||||||
obj5.free();
|
obj5.free();
|
||||||
@ -758,7 +768,11 @@ return 0;
|
|||||||
pg = pLinkDest->getPageNum();
|
pg = pLinkDest->getPageNum();
|
||||||
if (pg == 0)
|
if (pg == 0)
|
||||||
pg = 1;
|
pg = 1;
|
||||||
double dy = pdfDoc->getPageCropHeight(pg) - pLinkDest->getTop();
|
double dy = 0;
|
||||||
|
double dTop = pLinkDest->getTop();
|
||||||
|
double dHeight = pdfDoc->getPageCropHeight(pg);
|
||||||
|
if (dTop > 0 && dTop < dHeight)
|
||||||
|
dy = dHeight - dTop;
|
||||||
if (str)
|
if (str)
|
||||||
RELEASEOBJECT(pLinkDest);
|
RELEASEOBJECT(pLinkDest);
|
||||||
|
|
||||||
|
|||||||
@ -3953,7 +3953,6 @@ namespace PdfReader
|
|||||||
|
|
||||||
double dShiftX = 0, dShiftY = 0;
|
double dShiftX = 0, dShiftY = 0;
|
||||||
DoTransform(arrMatrix, &dShiftX, &dShiftY, true);
|
DoTransform(arrMatrix, &dShiftX, &dShiftY, true);
|
||||||
oImage.SaveFile(NSFile::GetProcessDirectory() + L"/res1.png", _CXIMAGE_FORMAT_PNG);
|
|
||||||
m_pRenderer->DrawImage(&oImage, 0 + dShiftX, 0 + dShiftY, PDFCoordsToMM(1), PDFCoordsToMM(1));
|
m_pRenderer->DrawImage(&oImage, 0 + dShiftX, 0 + dShiftY, PDFCoordsToMM(1), PDFCoordsToMM(1));
|
||||||
}
|
}
|
||||||
void RendererOutputDev::drawMaskedImage(GfxState *pGState, Object *pRef, Stream *pStream, int nWidth, int nHeight, GfxImageColorMap *pColorMap, Object* pStreamRef, Stream *pMaskStream, int nMaskWidth, int nMaskHeight, GBool bMaskInvert, GBool interpolate)
|
void RendererOutputDev::drawMaskedImage(GfxState *pGState, Object *pRef, Stream *pStream, int nWidth, int nHeight, GfxImageColorMap *pColorMap, Object* pStreamRef, Stream *pMaskStream, int nMaskWidth, int nMaskHeight, GBool bMaskInvert, GBool interpolate)
|
||||||
|
|||||||
Reference in New Issue
Block a user