This commit is contained in:
Kulikova Svetlana
2022-11-22 16:29:34 +03:00
parent 07f1c63459
commit 71226b6b37
5 changed files with 78 additions and 103 deletions

View File

@ -320,10 +320,14 @@ void CPdfFile::Close()
PdfWriter::CObjectBase* pInfo = pTrailer->Get("Info");
pInfoXref = new PdfWriter::CXref(pDoc, pInfo ? pInfo->GetObjId() : 0);
if (!pInfoXref)
{
RELEASEOBJECT(pXref);
return;
}
pInfoDict = new PdfWriter::CInfoDict(pInfoXref);
if (!pInfoDict)
{
RELEASEOBJECT(pXref);
RELEASEOBJECT(pInfoXref);
return;
}
@ -343,13 +347,11 @@ void CPdfFile::Close()
}
info.free();
bool bRes = m_pInternal->pWriter->EditClose();
if (!bRes)
return;
bRes = pDoc->AddToFile(pXref, pTrailer, pInfoXref, pInfoDict);
if (!bRes)
if (!m_pInternal->pWriter->EditClose() || !pDoc->AddToFile(pXref, pTrailer, pInfoXref, pInfoDict))
{
RELEASEOBJECT(pXref);
return;
}
std::wstring wsPath = pDoc->GetEditPdfPath();
std::string sPathUtf8New = U_TO_UTF8(wsPath);
@ -358,7 +360,7 @@ void CPdfFile::Close()
{
GString* owner_pswd = NSStrings::CreateString(m_pInternal->wsPassword);
GString* user_pswd = NSStrings::CreateString(m_pInternal->wsPassword);
bRes &= (pPDFDocument->makeWritable(false, owner_pswd, user_pswd) != 0);
pPDFDocument->makeWritable(false, owner_pswd, user_pswd);
delete owner_pswd;
delete user_pswd;
@ -374,15 +376,27 @@ void CPdfFile::Close()
m_pInternal->bEditPage = false;
#endif
}
void CPdfFile::Sign(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsPicturePath, ICertificate* pCertificate)
{
if (!m_pInternal->pWriter)
return;
m_pInternal->pWriter->Sign(dX, dY, dW, dH, wsPicturePath, pCertificate);
}
void CPdfFile::RotatePage(int nRotate)
{
if (!m_pInternal->pWriter)
return;
// Применение поворота страницы для writer
m_pInternal->pWriter->PageRotate(nRotate);
}
#ifndef BUILDING_WASM_MODULE
bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
{
if (!m_pInternal->pReader)
return false;
// Создание writer для редактирования
RELEASEOBJECT(m_pInternal->pWriter);
m_pInternal->pWriter = new CPdfWriter(m_pInternal->pAppFonts);
if (!m_pInternal->wsTempFolder.empty())
m_pInternal->pWriter->SetTempFolder(m_pInternal->wsTempFolder);
if (!wsDstFile.empty())
NSFile::CFileBinary::Copy(m_pInternal->wsSrcFile, wsDstFile);
@ -390,6 +404,7 @@ bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
if (!pPDFDocument)
return false;
// Если результат редактирования будет сохранен в тот же файл, что открыт для чтения, то файл необходимо сделать редактируемым
std::string sPathUtf8New = U_TO_UTF8(wsDstFile);
std::string sPathUtf8Old = U_TO_UTF8(m_pInternal->wsSrcFile);
if (sPathUtf8Old == sPathUtf8New || NSSystemPath::NormalizePath(sPathUtf8Old) == NSSystemPath::NormalizePath(sPathUtf8New))
@ -415,6 +430,7 @@ bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
if (!xref || !pDoc)
return false;
// Получение каталога и дерева страниц из reader
Object catDict, catRefObj, pagesRefObj;
if (!xref->getCatalog(&catDict) || !catDict.isDict() || !catDict.dictLookupNF("Pages", &pagesRefObj))
{
@ -430,10 +446,10 @@ bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
catRefObj.free();
return false;
}
Ref catRef = catRefObj.getRef();
catRefObj.free();
// Создание каталога для writer
PdfWriter::CXref* pXref = new PdfWriter::CXref(pDoc, catRef.num);
if (!pXref)
{
@ -441,7 +457,6 @@ bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
catDict.free();
return false;
}
PdfWriter::CCatalog* pCatalog = new PdfWriter::CCatalog(pXref, true);
if (!pCatalog)
{
@ -450,7 +465,6 @@ bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
RELEASEOBJECT(pXref);
return false;
}
for (int nIndex = 0; nIndex < catDict.dictGetLength(); ++nIndex)
{
Object oTemp;
@ -459,10 +473,10 @@ bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
DictToCDictObject(&oTemp, pCatalog, false, chKey);
oTemp.free();
}
pCatalog->SetRef(catRef.num, catRef.gen);
catDict.free();
// Проверка уникальности имён текущих цифровых подписей pdf
unsigned int nFormField = 0;
AcroForm* form = pPDFDocument->getCatalog()->getForm();
if (form)
@ -488,6 +502,7 @@ bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
nFormField--;
}
// Получение шифрования из reader и применения для writer
int nCryptAlgorithm = -1;
PdfWriter::CEncryptDict* pEncryptDict = NULL;
if (xref->isEncrypted())
@ -542,9 +557,11 @@ bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
}
}
// Применение редактирования для writer
bool bRes = pDoc->EditPdf(wsDstFile, xref->getLastXRefPos(), xref->getNumObjects(), pXref, pCatalog, pEncryptDict, nFormField);
if (bRes)
{
// Воспроизведение дерева страниц во writer
m_pInternal->GetPageTree(xref, &pagesRefObj);
m_pInternal->bEdit = true;
}
@ -553,6 +570,7 @@ bool CPdfFile::EditPdf(const std::wstring& wsDstFile)
}
bool CPdfFile::EditPage(int nPageIndex)
{
// Проверка режима редактирования
if (!m_pInternal->pWriter || !m_pInternal->pReader)
return false;
PDFDoc* pPDFDocument = m_pInternal->pReader->GetPDFDocument();
@ -579,21 +597,20 @@ bool CPdfFile::EditPage(int nPageIndex)
}
pageRefObj.free();
// Воспроизведение словаря страницы из reader для writer
PdfWriter::CXref* pXref = new PdfWriter::CXref(pDoc, pPageRef.first);
if (!pXref)
{
pageObj.free();
return false;
}
PdfWriter::CPage* pNewPage = new PdfWriter::CPage(pXref, pDoc);
if (!pNewPage)
PdfWriter::CPage* pPage = new PdfWriter::CPage(pXref, pDoc);
if (!pPage)
{
pageObj.free();
RELEASEOBJECT(pXref);
return false;
}
for (int nIndex = 0; nIndex < pageObj.dictGetLength(); ++nIndex)
{
Object oTemp;
@ -602,15 +619,16 @@ bool CPdfFile::EditPage(int nPageIndex)
pageObj.dictGetVal(nIndex, &oTemp);
else
pageObj.dictGetValNF(nIndex, &oTemp);
DictToCDictObject(&oTemp, pNewPage, true, chKey);
DictToCDictObject(&oTemp, pPage, true, chKey);
oTemp.free();
}
pNewPage->SetRef(pPageRef.first, pPageRef.second);
pNewPage->Fix();
pPage->SetRef(pPageRef.first, pPageRef.second);
pPage->Fix();
pageObj.free();
// Применение редактирования страницы для writer
m_pInternal->bEditPage = true;
if (m_pInternal->pWriter->EditPage(pNewPage) && pDoc->EditPage(pXref, pNewPage))
if (m_pInternal->pWriter->EditPage(pPage) && pDoc->EditPage(pXref, pPage))
return true;
RELEASEOBJECT(pXref);
@ -618,15 +636,20 @@ bool CPdfFile::EditPage(int nPageIndex)
}
bool CPdfFile::DeletePage(int nPageIndex)
{
// Проверка режима редактирования
if (!m_pInternal->pWriter || !m_pInternal->pWriter->m_pDocument || !m_pInternal->bEdit)
return false;
// Применение удаления страницы для writer
return m_pInternal->pWriter->m_pDocument->DeletePage(nPageIndex);
}
bool CPdfFile::AddPage(int nPageIndex)
{
// Проверка режима редактирования
if (!m_pInternal->pWriter || !m_pInternal->bEdit)
return false;
// Применение добавления страницы для writer
bool bRes = m_pInternal->pWriter->AddPage(nPageIndex);
// По умолчанию выставляются размеры первой страницы, в дальнейшем размеры можно изменить
if (bRes)
{
double dPageDpiX, dPageDpiY;
@ -638,22 +661,9 @@ bool CPdfFile::AddPage(int nPageIndex)
m_pInternal->pWriter->put_Width(dWidth);
m_pInternal->pWriter->put_Height(dHeight);
m_pInternal->bEditPage = true;
}
return bRes;
}
void CPdfFile::Sign(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsPicturePath, ICertificate* pCertificate)
{
if (!m_pInternal->pWriter)
return;
m_pInternal->pWriter->Sign(dX, dY, dW, dH, wsPicturePath, pCertificate);
}
void CPdfFile::PageRotate(int nRotate)
{
if (!m_pInternal->pWriter || !m_pInternal->bEdit)
return;
m_pInternal->pWriter->PageRotate(nRotate);
}
#endif // BUILDING_WASM_MODULE
// ------------------------------------------------------------------------
@ -683,8 +693,6 @@ bool CPdfFile::LoadFromMemory(BYTE* data, DWORD length, const std::wstring& opti
return false;
m_pInternal->wsSrcFile = L"";
m_pInternal->wsPassword = owner_password;
if (!m_pInternal->wsTempFolder.empty())
m_pInternal->pReader->SetTempDirectory(m_pInternal->wsTempFolder);
return m_pInternal->pReader->LoadFromMemory(m_pInternal->pAppFonts, data, length, owner_password, user_password) && (m_pInternal->pReader->GetError() == 0);
}
NSFonts::IApplicationFonts* CPdfFile::GetFonts()
@ -706,8 +714,6 @@ void CPdfFile::SetTempDirectory(const std::wstring& wsPath)
m_pInternal->wsTempFolder = wsPath;
if (m_pInternal->pReader)
m_pInternal->pReader->SetTempDirectory(wsPath);
if (m_pInternal->pWriter)
m_pInternal->pWriter->SetTempFolder(wsPath);
}
int CPdfFile::GetPagesCount()
{
@ -762,8 +768,6 @@ void CPdfFile::CreatePdf(bool isPDFA)
{
RELEASEOBJECT(m_pInternal->pWriter);
m_pInternal->pWriter = new CPdfWriter(m_pInternal->pAppFonts, isPDFA);
if (!m_pInternal->wsTempFolder.empty())
m_pInternal->pWriter->SetTempFolder(m_pInternal->wsTempFolder);
}
int CPdfFile::SaveToFile(const std::wstring& wsPath)
{
@ -1311,7 +1315,7 @@ HRESULT CPdfFile::DrawPath(const LONG& lType)
{
if (!m_pInternal->pWriter)
return S_FALSE;
return m_pInternal->pWriter->DrawPath(m_pInternal->pAppFonts, lType);
return m_pInternal->pWriter->DrawPath(m_pInternal->pAppFonts, m_pInternal->wsTempFolder, lType);
}
HRESULT CPdfFile::PathCommandStart()
{
@ -1359,7 +1363,7 @@ HRESULT CPdfFile::DrawImageFromFile(const std::wstring& wsImagePath, const doubl
{
if (!m_pInternal->pWriter)
return S_FALSE;
return m_pInternal->pWriter->DrawImageFromFile(m_pInternal->pAppFonts, wsImagePath, dX, dY, dW, dH, nAlpha);
return m_pInternal->pWriter->DrawImageFromFile(m_pInternal->pAppFonts, m_pInternal->wsTempFolder, wsImagePath, dX, dY, dW, dH, nAlpha);
}
HRESULT CPdfFile::SetTransform(const double& dM11, const double& dM12, const double& dM21, const double& dM22, const double& dX, const double& dY)
{

View File

@ -66,16 +66,16 @@ namespace PdfFile
{
errorNone = 0, // Нет ошибок
errorOpenFile = 1, // Ошибка при открытии PDF файла
errorBadCatalog = 2, // couldn't read the page catalog
errorBadCatalog = 2, // Couldn't read the page catalog
errorDamaged = 3, // PDF файл был поврежден и его невозможно восстановить
errorEncrypted = 4, // Файл зашифрован, авторизация не пройдена
errorHighlightFile = 5, // nonexistent or invalid highlight file
errorBadPrinter = 6, // плохой принтер
errorPrinting = 7, // ошибка во время печати
errorHighlightFile = 5, // Nonexistent or invalid highlight file
errorBadPrinter = 6, // Плохой принтер
errorPrinting = 7, // Ошибка во время печати
errorPermission = 8, // Ошибка связанная с ограничениями наложенными на файл
errorBadPageNum = 9, // Неверное количество страниц
errorFileIO = 10, // Ошибка при чтении/записи
errorMemory = 11 // Memory exceed
errorFileIO = 10,// Ошибка при чтении/записи
errorMemory = 11 // Memory exceed
} EError;
}
@ -85,16 +85,18 @@ public:
CPdfFile(NSFonts::IApplicationFonts* pAppFonts);
virtual ~CPdfFile();
NSFonts::IFontManager* GetFontManager();
// В режиме для чтения закрытие reader, есть возможность открыть новый
// В режиме для редактирования закрытие writer, есть возможность использования reader
virtual void Close();
// --- EDIT ---
virtual void Close();
#ifndef BUILDING_WASM_MODULE
// Переходит в режим редактирования. Pdf уже должен быть открыт на чтение - LoadFromFile/LoadFromMemory
bool EditPdf(const std::wstring& wsDstFile = L"");
// Манипуляции со страницами возможны в режиме редактирования
bool EditPage (int nPageIndex);
bool DeletePage(int nPageIndex);
bool AddPage (int nPageIndex);
void Sign(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsPicturePath, ICertificate* pCertificate);
void PageRotate(int nRotate);
#endif
// --- READER ---
@ -121,9 +123,11 @@ public:
void CreatePdf (bool isPDFA = false);
int SaveToFile (const std::wstring& wsPath);
void RotatePage (int nRotate);
void SetPassword (const std::wstring& wsPassword);
void SetDocumentID(const std::wstring& wsDocumentID);
void SetCore (const std::wstring& wsCoreXml);
void Sign(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsPicturePath, ICertificate* pCertificate);
HRESULT OnlineWordToPdf (const std::wstring& wsSrcFile, const std::wstring& wsDstFile, CConvertFromBinParams* pParams = NULL);
HRESULT OnlineWordToPdfFromBinary(const std::wstring& wsSrcFile, const std::wstring& wsDstFile, CConvertFromBinParams* pParams = NULL);
HRESULT DrawImageWith1bppMask(IGrObject* pImage, NSImages::CPixJbig2* pMaskBuffer, const unsigned int& unMaskWidth, const unsigned int& unMaskHeight, const double& dX, const double& dY, const double& dW, const double& dH);

View File

@ -129,17 +129,11 @@ CPdfWriter::CPdfWriter(NSFonts::IApplicationFonts* pAppFonts, bool isPDFA) : m_o
m_bNeedUpdateTextAlpha = true;
m_bNeedUpdateTextCharSpace = true;
m_bNeedUpdateTextSize = true;
m_wsTempFolder = L"";
SetTempFolder(NSFile::CFileBinary::GetTempPath());
}
CPdfWriter::~CPdfWriter()
{
RELEASEOBJECT(m_pDocument);
RELEASEINTERFACE(m_pFontManager);
if (L"" != m_wsTempFolder)
NSDirectory::DeleteDirectory(m_wsTempFolder);
}
void CPdfWriter::SetPassword(const std::wstring& wsPassword)
{
@ -168,31 +162,6 @@ int CPdfWriter::SaveToFile(const std::wstring& wsPath)
return 0;
}
void CPdfWriter::SetTempFolder(const std::wstring& wsPath)
{
if (L"" != m_wsTempFolder)
NSDirectory::DeleteDirectory(m_wsTempFolder);
int nCounter = 0;
m_wsTempFolder = wsPath;
int nPathLen = (int)m_wsTempFolder.length();
if (nPathLen > 0)
{
const wchar_t* pData = m_wsTempFolder.c_str();
if ((pData[nPathLen - 1] != '/') && (pData[nPathLen - 1] != '\\'))
m_wsTempFolder += L"/";
m_wsTempFolder += L"PDF";
}
std::wstring sTest = m_wsTempFolder;
while (NSDirectory::Exists(m_wsTempFolder))
{
m_wsTempFolder = sTest + L"/PDF_" + std::to_wstring(nCounter);
nCounter++;
}
NSDirectory::CreateDirectory(m_wsTempFolder);
}
void CPdfWriter::SetCore(const std::wstring& wsCoreXml)
{
if (!IsValid())
@ -230,9 +199,9 @@ void CPdfWriter::SetCore(const std::wstring& wsCoreXml)
if (!sKeywords.empty())
m_pDocument->SetKeywords(sKeywords);
}
std::wstring CPdfWriter::GetTempFile()
std::wstring CPdfWriter::GetTempFile(const std::wstring& wsDirectory)
{
return NSFile::CFileBinary::CreateTempFileWithUniqueName(m_wsTempFolder, L"PDF");
return NSFile::CFileBinary::CreateTempFileWithUniqueName(wsDirectory, L"PDF");
}
//----------------------------------------------------------------------------------------
// Функции для работы со страницей
@ -787,7 +756,7 @@ HRESULT CPdfWriter::PathCommandEnd()
m_oPath.Clear();
return S_OK;
}
HRESULT CPdfWriter::DrawPath(NSFonts::IApplicationFonts* pAppFonts, const LONG& lType)
HRESULT CPdfWriter::DrawPath(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsTempDirectory, const LONG& lType)
{
m_oCommandManager.Flush();
@ -812,13 +781,13 @@ HRESULT CPdfWriter::DrawPath(NSFonts::IApplicationFonts* pAppFonts, const LONG&
if (c_BrushTypeTexture == m_oBrush.GetType())
{
sTextureOldPath = m_oBrush.GetTexturePath();
sTextureTmpPath = GetDownloadFile(sTextureOldPath);
sTextureTmpPath = GetDownloadFile(sTextureOldPath, wsTempDirectory);
if (!sTextureTmpPath.empty())
m_oBrush.SetTexturePath(sTextureTmpPath);
}
UpdateBrush(pAppFonts);
UpdateBrush(pAppFonts, wsTempDirectory);
}
if (!m_pShading)
@ -1000,14 +969,14 @@ HRESULT CPdfWriter::DrawImage(IGrObject* pImage, const double& dX, const double&
return S_OK;
}
HRESULT CPdfWriter::DrawImageFromFile(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsImagePathSrc, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha)
HRESULT CPdfWriter::DrawImageFromFile(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsTempDirectory, const std::wstring& wsImagePathSrc, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha)
{
m_oCommandManager.Flush();
if (!IsPageValid())
return S_OK;
std::wstring sTempImagePath = GetDownloadFile(wsImagePathSrc);
std::wstring sTempImagePath = GetDownloadFile(wsImagePathSrc, wsTempDirectory);
std::wstring wsImagePath = sTempImagePath.empty() ? wsImagePathSrc : sTempImagePath;
Aggplus::CImage* pAggImage = NULL;
@ -1023,7 +992,7 @@ HRESULT CPdfWriter::DrawImageFromFile(NSFonts::IApplicationFonts* pAppFonts, con
pMeta->LoadFromFile(wsImagePath.c_str());
double dNewW = std::max(10.0, dW) / 25.4 * 300;
std::wstring wsTempFile = GetTempFile();
std::wstring wsTempFile = GetTempFile(wsTempDirectory);
pMeta->ConvertToRaster(wsTempFile.c_str(), _CXIMAGE_FORMAT_PNG, dNewW);
RELEASEOBJECT(pMeta);
@ -2027,7 +1996,7 @@ void CPdfWriter::UpdatePen()
else
m_pPage->SetLineJoin(PdfWriter::linejoin_Round);
}
void CPdfWriter::UpdateBrush(NSFonts::IApplicationFonts* pAppFonts)
void CPdfWriter::UpdateBrush(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsTempDirectory)
{
m_pShading = NULL;
m_pShadingExtGrState = NULL;
@ -2071,7 +2040,7 @@ void CPdfWriter::UpdateBrush(NSFonts::IApplicationFonts* pAppFonts)
double dNewW = std::max(10.0, dR - dL) / 72 * 300;
std::wstring wsTempFile = GetTempFile();
std::wstring wsTempFile = GetTempFile(wsTempDirectory);
pMeta->ConvertToRaster(wsTempFile.c_str(), _CXIMAGE_FORMAT_PNG, dNewW);
RELEASEOBJECT(pMeta);
@ -2290,7 +2259,7 @@ unsigned char* CPdfWriter::EncodeGID(const unsigned int& unGID, const unsigned i
pCodes[1] = ushCode & 0xFF;
return pCodes;
}
std::wstring CPdfWriter::GetDownloadFile(const std::wstring& sUrl)
std::wstring CPdfWriter::GetDownloadFile(const std::wstring& sUrl, const std::wstring& wsTempDirectory)
{
std::wstring::size_type n1 = sUrl.find(L"www.");
std::wstring::size_type n2 = sUrl.find(L"http://");
@ -2311,7 +2280,7 @@ std::wstring CPdfWriter::GetDownloadFile(const std::wstring& sUrl)
if (!bIsNeedDownload)
return L"";
std::wstring sTempFile = GetTempFile();
std::wstring sTempFile = GetTempFile(wsTempDirectory);
NSNetwork::NSFileTransport::CFileDownloader oDownloader(sUrl, false);
oDownloader.SetFilePath(sTempFile);

View File

@ -64,10 +64,9 @@ public:
~CPdfWriter();
int SaveToFile(const std::wstring& wsPath);
void SetPassword(const std::wstring& wsPassword);
void SetDocumentID(const std::wstring& wsDocumentID);
void SetTempFolder(const std::wstring& wsPath);
void SetDocumentID(const std::wstring& wsDocumentID);
void SetCore(const std::wstring& wsCoreXml);
std::wstring GetTempFile();
std::wstring GetTempFile(const std::wstring& wsDirectory);
//----------------------------------------------------------------------------------------
// Функции для работы со страницей
//----------------------------------------------------------------------------------------
@ -163,7 +162,7 @@ public:
HRESULT PathCommandArcTo(const double& dX, const double& dY, const double& dW, const double& dH, const double& dStartAngle, const double& dSweepAngle);
HRESULT PathCommandClose();
HRESULT PathCommandEnd();
HRESULT DrawPath(NSFonts::IApplicationFonts* pAppFonts, const LONG& lType);
HRESULT DrawPath(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsTempDirectory, const LONG& lType);
HRESULT PathCommandStart();
HRESULT PathCommandGetCurrentPoint(double* dX, double* dY);
HRESULT PathCommandTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH);
@ -174,7 +173,7 @@ public:
// Функции для вывода изображений
//----------------------------------------------------------------------------------------
HRESULT DrawImage(IGrObject* pImage, const double& dX, const double& dY, const double& dW, const double& dH);
HRESULT DrawImageFromFile(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha = 255);
HRESULT DrawImageFromFile(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsTempDirectory, const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha = 255);
//----------------------------------------------------------------------------------------
// Функции для выставления преобразования
//----------------------------------------------------------------------------------------
@ -220,7 +219,7 @@ private:
PdfWriter::CFontCidTrueType* GetFont(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic);
void UpdateTransform();
void UpdatePen();
void UpdateBrush(NSFonts::IApplicationFonts* pAppFonts);
void UpdateBrush(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsTempDirectory);
void Reset();
bool IsValid();
bool IsPageValid();
@ -228,11 +227,10 @@ private:
void AddLink(PdfWriter::CPage* pPage, const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const unsigned int& unDestPage);
unsigned char* EncodeString(const unsigned int* pUnicodes, const unsigned int& unUnicodesCount, const unsigned int* pGIDs = NULL);
unsigned char* EncodeGID(const unsigned int& unGID, const unsigned int* pUnicodes, const unsigned int& unUnicodesCount);
std::wstring GetDownloadFile(const std::wstring& sUrl);
std::wstring GetDownloadFile(const std::wstring& sUrl, const std::wstring& wsTempDirectory);
private:
NSFonts::IFontManager* m_pFontManager;
std::wstring m_wsTempFolder;
PdfWriter::CFontCidTrueType* m_pFont;
PdfWriter::CShading* m_pShading;

View File

@ -121,7 +121,7 @@ int main()
if (pdfFile.EditPage(0))
{
TEST(&pdfFile);
pdfFile.PageRotate(90);
pdfFile.RotatePage(90);
}
pdfFile.DeletePage(1);