From c2f6f2d1b589f491c92ca05ee15173774f12e2a1 Mon Sep 17 00:00:00 2001 From: Kulikova Svetlana Date: Tue, 1 Nov 2022 18:36:01 +0300 Subject: [PATCH] PdfFile using --- .../graphics/pro/js/qt/nativegraphics.pro | 2 +- .../graphics/pro/js/wasm/src/drawingfile.h | 6 +- DjVuFile/DjVuFile.pro | 2 +- DjVuFile/DjVuFileImplementation.cpp | 6 +- PdfFile/PdfFile.cpp | 102 +++++++++--------- PdfFile/PdfFile.h | 60 ++++++++--- PdfReader/PdfReader.pro | 2 +- PdfWriter/PdfRenderer.h | 17 +-- X2tConverter/build/Qt/X2tConverter.pri | 5 +- X2tConverter/src/ASCConverters.cpp | 26 +++-- XpsFile/XpsFile.cpp | 4 +- XpsFile/XpsFile.pro | 2 +- XpsFile/XpsLib/StaticResources.cpp | 6 +- 13 files changed, 127 insertions(+), 113 deletions(-) diff --git a/DesktopEditor/graphics/pro/js/qt/nativegraphics.pro b/DesktopEditor/graphics/pro/js/qt/nativegraphics.pro index c2ee78fa8c..8d0aa0e47d 100644 --- a/DesktopEditor/graphics/pro/js/qt/nativegraphics.pro +++ b/DesktopEditor/graphics/pro/js/qt/nativegraphics.pro @@ -20,7 +20,7 @@ include($$CORE_ROOT_DIR/Common/base.pri) include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri) include(../../freetype.pri) -ADD_DEPENDENCY(UnicodeConverter, kernel, PdfWriter, HtmlRenderer) +ADD_DEPENDENCY(UnicodeConverter, kernel, PdfFile, HtmlRenderer) INCLUDEPATH += \ $$CORE_ROOT_DIR/DesktopEditor/agg-2.4/include \ diff --git a/DesktopEditor/graphics/pro/js/wasm/src/drawingfile.h b/DesktopEditor/graphics/pro/js/wasm/src/drawingfile.h index 1966a2ead5..9fcd35dc0b 100644 --- a/DesktopEditor/graphics/pro/js/wasm/src/drawingfile.h +++ b/DesktopEditor/graphics/pro/js/wasm/src/drawingfile.h @@ -6,7 +6,7 @@ #include "../../../../pro/officedrawingfile.h" #include "../../../../../../XpsFile/XpsFile.h" #include "../../../../../../DjVuFile/DjVu.h" -#include "../../../../../../PdfReader/PdfReader.h" +#include "../../../../../../PdfFile/PdfFile.h" #include "../../../../../../HtmlRenderer/include/HTMLRendererText.h" class CGraphicsFileDrawing @@ -45,7 +45,7 @@ public: { nType = _nType; if (nType == 0) - pReader = new PdfReader::CPdfReader(pApplicationFonts); + pReader = new CPdfFile(pApplicationFonts, 1); else if (nType == 1) pReader = new CDjVuFile(pApplicationFonts); else if (nType == 2) @@ -66,7 +66,7 @@ public: return -1; if (nType == 0) // диапозон ошибки от 0 до 10 - return ((PdfReader::CPdfReader*)pReader)->GetError(); + return ((CPdfFile*)pReader)->GetError(); return 0; // errNone } int GetPagesCount() diff --git a/DjVuFile/DjVuFile.pro b/DjVuFile/DjVuFile.pro index c58bf6e359..3ad15c5478 100644 --- a/DjVuFile/DjVuFile.pro +++ b/DjVuFile/DjVuFile.pro @@ -15,7 +15,7 @@ CORE_ROOT_DIR = $$PWD/.. PWD_ROOT_DIR = $$PWD include(../Common/base.pri) -ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, PdfWriter) +ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, PdfFile) DEFINES -= \ UNICODE \ diff --git a/DjVuFile/DjVuFileImplementation.cpp b/DjVuFile/DjVuFileImplementation.cpp index d202c88999..27b9b7dadd 100644 --- a/DjVuFile/DjVuFileImplementation.cpp +++ b/DjVuFile/DjVuFileImplementation.cpp @@ -34,7 +34,7 @@ #include "../DesktopEditor/common/File.h" #include "../DesktopEditor/common/Directory.h" -#include "../PdfWriter/PdfRenderer.h" +#include "../PdfFile/PdfFile.h" #include "../DesktopEditor/graphics/pro/Fonts.h" #include "../DesktopEditor/graphics/pro/Graphics.h" @@ -235,7 +235,7 @@ void CDjVuFileImplementation::DrawPageOnRenderer(IRenderer* pRenderer, int nPag } void CDjVuFileImplementation::ConvertToPdf(const std::wstring& wsDstPath) { - CPdfRenderer oPdf(m_pApplicationFonts); + CPdfFile oPdf(m_pApplicationFonts, 2); bool bBreak = false; for (int nPageIndex = 0, nPagesCount = GetPagesCount(); nPageIndex < nPagesCount; nPageIndex++) @@ -642,7 +642,7 @@ void CDjVuFileImplementation::CreatePdfFrame(IRenderer* pRenderer, GP LONG lImageWidth = pPage->get_real_width(); LONG lImageHeight = pPage->get_real_height(); - CPdfRenderer* pPdf = (CPdfRenderer*)pRenderer; + CPdfFile* pPdf = (CPdfFile*)pRenderer; if (pPage->is_legal_photo()) { diff --git a/PdfFile/PdfFile.cpp b/PdfFile/PdfFile.cpp index 5cc920398a..5a57324670 100644 --- a/PdfFile/PdfFile.cpp +++ b/PdfFile/PdfFile.cpp @@ -1,4 +1,7 @@ #include "PdfFile.h" +#include "../PdfWriter/PdfRenderer.h" +#include "../PdfReader/PdfReader.h" + #include "../PdfReader/Src/Adaptors.h" #include "../DesktopEditor/common/File.h" #include "../DesktopEditor/common/Path.h" @@ -197,60 +200,6 @@ public: } }; -/* - -int CPdfFile2::GetError() -{ - return m_pInternal->pReader->GetError(); -} - -void CPdfFile2::ConvertToRaster(int nPageIndex, const std::wstring& path, int nImageType, const int nRasterW, const int nRasterH, - bool bIsFlip, NSFonts::IFontManager* pFonts, int nBackgroundColor, bool bIsDarkMode) -{ - m_pInternal->pReader->ConvertToRaster(nPageIndex, path, nImageType, nRasterW, nRasterH, bIsFlip, pFonts, nBackgroundColor, bIsDarkMode); -} - -void CPdfFile2::SetPassword(const std::wstring& wsPassword) -{ - m_pInternal->pWriter->SetPassword(wsPassword); -} - -void CPdfFile2::SetDocumentID(const std::wstring& wsDocumentID) -{ - m_pInternal->pWriter->SetPassword(wsDocumentID); -} - -int CPdfFile2::SavePdfToFile(const std::wstring& wsPath) -{ - int nPagesCount = m_pInternal->pReader->GetPagesCount(); - for (int i = 0; i < nPagesCount; ++i) - { - m_pInternal->pWriter->NewPage(); - m_pInternal->pWriter->BeginCommand(c_nPageType); - - double dPageDpiX, dPageDpiY; - double dWidth, dHeight; - m_pInternal->pReader->GetPageInfo(i, &dWidth, &dHeight, &dPageDpiX, &dPageDpiY); - - dWidth *= 25.4 / dPageDpiX; - dHeight *= 25.4 / dPageDpiY; - - m_pInternal->pWriter->put_Width(dWidth); - m_pInternal->pWriter->put_Height(dHeight); - - m_pInternal->pReader->DrawPageOnRenderer(m_pInternal->pWriter, i, NULL); - - m_pInternal->pWriter->EndCommand(c_nPageType); - } - return m_pInternal->pWriter->SaveToFile(wsPath); -} - -HRESULT CPdfFile2::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) -{ - return m_pInternal->pWriter->DrawImageWith1bppMask(pImage, pMaskBuffer, unMaskWidth, unMaskHeight, dX, dY, dW, dH); -} -*/ - // ------------------------------------------------------------------------ CPdfFile::CPdfFile(NSFonts::IApplicationFonts* pAppFonts, bool isPDFA) @@ -261,6 +210,17 @@ CPdfFile::CPdfFile(NSFonts::IApplicationFonts* pAppFonts, bool isPDFA) m_pInternal->pReader = new PdfReader::CPdfReader(pAppFonts); m_pInternal->wsPassword = L""; } +// nMode = 1/2/3, 01 - reader, 10 - writer, 11 - editer +CPdfFile::CPdfFile(NSFonts::IApplicationFonts* pAppFonts, int nMode, bool isPDFA) +{ + m_pInternal = new CPdfFile_Private(); + + if (nMode & 1) + m_pInternal->pReader = new PdfReader::CPdfReader(pAppFonts); + if (nMode & 2) + m_pInternal->pWriter = new CPdfRenderer (pAppFonts, isPDFA); + m_pInternal->wsPassword = L""; +} CPdfFile::~CPdfFile() { RELEASEOBJECT(m_pInternal->pWriter); @@ -635,6 +595,11 @@ void CPdfFile::PageRotate(int nRotate) // ------------------------------------------------------------------------ +int CPdfFile::GetError() +{ + return m_pInternal->pReader->GetError(); +} + bool CPdfFile::LoadFromFile(const std::wstring& file, const std::wstring& options, const std::wstring& owner_password, const std::wstring& user_password) { m_pInternal->wsSrcFile = file; @@ -700,6 +665,18 @@ int CPdfFile::SaveToFile(const std::wstring& wsPath) { return m_pInternal->pWriter->SaveToFile(wsPath); } +void CPdfFile::SetPassword(const std::wstring& wsPassword) +{ + m_pInternal->pWriter->SetPassword(wsPassword); +} +void CPdfFile::SetDocumentID(const std::wstring& wsDocumentID) +{ + m_pInternal->pWriter->SetDocumentID(wsDocumentID); +} +void CPdfFile::SetTempFolder(const std::wstring& wsPath) +{ + m_pInternal->pWriter->SetTempFolder(wsPath); +} HRESULT CPdfFile::OnlineWordToPdf(const std::wstring& wsSrcFile, const std::wstring& wsDstFile, CConvertFromBinParams* pParams) { return m_pInternal->pWriter->OnlineWordToPdf(wsSrcFile, wsDstFile, pParams); @@ -708,6 +685,23 @@ HRESULT CPdfFile::OnlineWordToPdfFromBinary(const std::wstring& wsSrcFile, const { return m_pInternal->pWriter->OnlineWordToPdfFromBinary(wsSrcFile, wsDstFile, pParams); } +HRESULT CPdfFile::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) +{ + return m_pInternal->pWriter->DrawImageWith1bppMask(pImage, pMaskBuffer, unMaskWidth, unMaskHeight, dX, dY, dW, dH); +} +HRESULT CPdfFile::DrawImage1bpp(NSImages::CPixJbig2* pImageBuffer, const unsigned int& unWidth, const unsigned int& unHeight, const double& dX, const double& dY, const double& dW, const double& dH) +{ + return m_pInternal->pWriter->DrawImage1bpp(pImageBuffer, unWidth, unHeight, dX, dY, dW, dH); +} +HRESULT CPdfFile::SetLinearGradient(const double& dX1, const double& dY1, const double& dX2, const double& dY2) +{ + return m_pInternal->pWriter->SetLinearGradient(dX1, dY1, dX2, dY2); +} +HRESULT CPdfFile::SetRadialGradient(const double& dX1, const double& dY1, const double& dR1, const double& dX2, const double& dY2, const double& dR2) +{ + return m_pInternal->pWriter->SetRadialGradient(dX1, dY1, dR1, dX2, dY2, dR2); +} + HRESULT CPdfFile::get_Type(LONG* lType) { diff --git a/PdfFile/PdfFile.h b/PdfFile/PdfFile.h index c9d87691db..882a296666 100644 --- a/PdfFile/PdfFile.h +++ b/PdfFile/PdfFile.h @@ -9,28 +9,53 @@ #endif #include "../DesktopEditor/graphics/pro/officedrawingfile.h" +#include "../DesktopEditor/graphics/IRenderer.h" -#include "../PdfWriter/PdfRenderer.h" -#include "../PdfReader/PdfReader.h" #include "../DesktopEditor/graphics/pro/Fonts.h" +#include "../DesktopEditor/graphics/pro/Image.h" #include "../DesktopEditor/xmlsec/src/include/Certificate.h" class CPdfFile_Private; -/* - int GetError(); - void ConvertToRaster(int nPageIndex, const std::wstring& path, int nImageType, const int nRasterW = -1, const int nRasterH = -1, - bool bIsFlip = false, NSFonts::IFontManager* pFonts = NULL, int nBackgroundColor = 0xFFFFFF, bool bIsDarkMode = false); - int SavePdfToFile(const std::wstring& wsPath); +class CConvertFromBinParams +{ +public: + std::wstring m_sMediaDirectory; + std::wstring m_sInternalMediaDirectory; + std::wstring m_sThemesDirectory; + bool m_bIsUsePicker; - void SetPassword (const std::wstring& wsPassword); - void SetDocumentID(const std::wstring& wsDocumentID); - 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); -*/ +public: + CConvertFromBinParams() + { + m_bIsUsePicker = false; + } +}; + +namespace PdfFile +{ + typedef enum + { + errorNone = 0, // Нет ошибок + errorOpenFile = 1, // Ошибка при открытии PDF файла + errorBadCatalog = 2, // couldn't read the page catalog + errorDamaged = 3, // PDF файл был поврежден и его невозможно восстановить + errorEncrypted = 4, // Файл зашифрован, авторизация не пройдена + errorHighlightFile = 5, // nonexistent or invalid highlight file + errorBadPrinter = 6, // плохой принтер + errorPrinting = 7, // ошибка во время печати + errorPermission = 8, // Ошибка связанная с ограничениями наложенными на файл + errorBadPageNum = 9, // Неверное количество страниц + errorFileIO = 10, // Ошибка при чтении/записи + errorMemory = 11 // Memory exceed + } EError; +} class PDFFILE_DECL_EXPORT CPdfFile : public IOfficeDrawingFile, public IRenderer { public: CPdfFile(NSFonts::IApplicationFonts* pAppFonts, bool isPDFA = false); + // nMode = 1/2/3, 1 - reader, 2 - writer, 3 - editer + CPdfFile(NSFonts::IApplicationFonts* pAppFonts, int nMode, bool isPDFA = false); virtual ~CPdfFile(); void SetTemp(const std::wstring& wsPath); @@ -46,6 +71,9 @@ public: // --- READER --- + int GetError(); + + virtual bool LoadFromFile (const std::wstring& file, const std::wstring& options = L"", const std::wstring& owner_password = L"", const std::wstring& user_password = L""); virtual bool LoadFromMemory(BYTE* data, DWORD length, const std::wstring& options = L"", const std::wstring& owner_password = L"", const std::wstring& user_password = L""); @@ -70,9 +98,17 @@ public: // --- WRITER --- - int SaveToFile(const std::wstring& wsPath); + int SaveToFile (const std::wstring& wsPath); + void SetPassword (const std::wstring& wsPassword); + void SetDocumentID(const std::wstring& wsDocumentID); + void SetTempFolder(const std::wstring& wsPath); 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); + HRESULT DrawImage1bpp(NSImages::CPixJbig2* pImageBuffer, const unsigned int& unWidth, const unsigned int& unHeight, const double& dX, const double& dY, const double& dW, const double& dH); + HRESULT SetLinearGradient(const double& dX1, const double& dY1, const double& dX2, const double& dY2); + HRESULT SetRadialGradient(const double& dX1, const double& dY1, const double& dR1, const double& dX2, const double& dY2, const double& dR2); + //---------------------------------------------------------------------------------------- // Тип рендерера diff --git a/PdfReader/PdfReader.pro b/PdfReader/PdfReader.pro index a6253f3b91..a748ca3909 100644 --- a/PdfReader/PdfReader.pro +++ b/PdfReader/PdfReader.pro @@ -18,7 +18,7 @@ DEFINES += PDFREADER_USE_DYNAMIC_LIBRARY CONFIG += use_cmap_memory -ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, PdfWriter) +ADD_DEPENDENCY(graphics, kernel, UnicodeConverter) core_windows { LIBS += -lgdi32 \ diff --git a/PdfWriter/PdfRenderer.h b/PdfWriter/PdfRenderer.h index f0f78fd0e9..0b5eb14d58 100644 --- a/PdfWriter/PdfRenderer.h +++ b/PdfWriter/PdfRenderer.h @@ -32,6 +32,8 @@ #ifndef _PDF_WRITER_PDFRENDERER_H #define _PDF_WRITER_PDFRENDERER_H +#include "../PdfFile/PdfFile.h" + #include "../DesktopEditor/graphics/IRenderer.h" #include "../DesktopEditor/graphics/pro/Fonts.h" #include "../DesktopEditor/graphics/pro/Image.h" @@ -69,21 +71,6 @@ namespace Aggplus class CRendererCommandBase; class CRendererTextCommand; -class CConvertFromBinParams -{ -public: - std::wstring m_sMediaDirectory; - std::wstring m_sInternalMediaDirectory; - std::wstring m_sThemesDirectory; - bool m_bIsUsePicker; - -public: - CConvertFromBinParams() - { - m_bIsUsePicker = false; - } -}; - class PDFWRITER_DECL_EXPORT CPdfRenderer : public IRenderer { public: diff --git a/X2tConverter/build/Qt/X2tConverter.pri b/X2tConverter/build/Qt/X2tConverter.pri index 3f84e73255..ebca6f0591 100755 --- a/X2tConverter/build/Qt/X2tConverter.pri +++ b/X2tConverter/build/Qt/X2tConverter.pri @@ -29,8 +29,7 @@ DEFINES += UNICODE \ DONT_WRITE_EMBEDDED_FONTS \ AVS_USE_CONVERT_PPTX_TOCUSTOM_VML -DEFINES += PDFREADER_USE_DYNAMIC_LIBRARY -DEFINES += PDFWRITER_USE_DYNAMIC_LIBRARY +DEFINES += PDFFILE_USE_DYNAMIC_LIBRARY DEFINES += XPS_USE_DYNAMIC_LIBRARY DEFINES += DJVU_USE_DYNAMIC_LIBRARY DEFINES += HTMLRENDERER_USE_DYNAMIC_LIBRARY @@ -102,7 +101,7 @@ LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lCryptoPPLib #All dynamic libs -ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, kernel_network, Fb2File, PdfWriter, PdfReader, HtmlFile2, EpubFile, XpsFile, DjVuFile, HtmlRenderer, doctrenderer, DocxRenderer) +ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, kernel_network, Fb2File, PdfFile, HtmlFile2, EpubFile, XpsFile, DjVuFile, HtmlRenderer, doctrenderer, DocxRenderer) ##################################################### diff --git a/X2tConverter/src/ASCConverters.cpp b/X2tConverter/src/ASCConverters.cpp index 4eb23a6ec2..d3bc207020 100644 --- a/X2tConverter/src/ASCConverters.cpp +++ b/X2tConverter/src/ASCConverters.cpp @@ -31,8 +31,6 @@ */ #include "ASCConverters.h" -//todo убрать ошибки компиляции если переместить include ниже -#include "../../PdfWriter/OnlineOfficeBinToPdf.h" #include "cextracttools.h" #include "../../OfficeUtils/src/OfficeUtils.h" @@ -56,7 +54,7 @@ #include "../../DesktopEditor/graphics/pro/Fonts.h" #include "../../DesktopEditor/graphics/MetafileToGraphicsRenderer.h" -#include "../../PdfReader/PdfReader.h" +#include "../../PdfFile/PdfFile.h" #include "../../DjVuFile/DjVu.h" #include "../../XpsFile/XpsFile.h" #include "../../DocxRenderer/DocxRenderer.h" @@ -1613,7 +1611,7 @@ namespace NExtractTools NSFonts::IApplicationFonts* pApplicationFonts = NSFonts::NSApplication::Create(); initApplicationFonts(pApplicationFonts, params); - CPdfRenderer pdfWriter(pApplicationFonts, params.getIsPDFA()); + CPdfFile pdfWriter(pApplicationFonts, 2, params.getIsPDFA()); pdfWriter.SetTempFolder(sTemp); CConvertFromBinParams oBufferParams; @@ -1867,7 +1865,7 @@ namespace NExtractTools NSFonts::IApplicationFonts* pApplicationFonts = NSFonts::NSApplication::Create(); initApplicationFonts(pApplicationFonts, params); - CPdfRenderer pdfWriter(pApplicationFonts, params.getIsPDFA()); + CPdfFile pdfWriter(pApplicationFonts, 2, params.getIsPDFA()); pdfWriter.SetTempFolder(sTemp); CConvertFromBinParams oBufferParams; @@ -3539,7 +3537,7 @@ namespace NExtractTools NSFonts::IApplicationFonts* pApplicationFonts = NSFonts::NSApplication::Create(); initApplicationFonts(pApplicationFonts, params); - CPdfRenderer pdfWriter(pApplicationFonts, params.getIsPDFA()); + CPdfFile pdfWriter(pApplicationFonts, 2, params.getIsPDFA()); pdfWriter.SetTempFolder(sTemp); CConvertFromBinParams oBufferParams; @@ -3581,7 +3579,7 @@ namespace NExtractTools IOfficeDrawingFile* pReader = NULL; if(AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF == nFormatFrom) { - pReader = new PdfReader::CPdfReader(pApplicationFonts); + pReader = new CPdfFile(pApplicationFonts, 1); } else if(AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU == nFormatFrom) { @@ -3630,8 +3628,8 @@ namespace NExtractTools nRes = AVS_FILEUTILS_ERROR_CONVERT; if(AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF == nFormatFrom) { - PdfReader::CPdfReader* pPdfReader = static_cast(pReader); - if(PdfReader::errorEncrypted == pPdfReader->GetError()) + CPdfFile* pPdfReader = static_cast(pReader); + if(PdfFile::errorEncrypted == pPdfReader->GetError()) { if(sPassword.empty()) { @@ -3658,7 +3656,7 @@ namespace NExtractTools IOfficeDrawingFile* pReader = NULL; if(AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF == nFormatFrom) { - pReader = new PdfReader::CPdfReader(pApplicationFonts); + pReader = new CPdfFile(pApplicationFonts, 1); } else if(AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU == nFormatFrom) { @@ -3768,8 +3766,8 @@ namespace NExtractTools nRes = AVS_FILEUTILS_ERROR_CONVERT; if(AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF == nFormatFrom) { - PdfReader::CPdfReader* pPdfReader = static_cast(pReader); - if(PdfReader::errorEncrypted == pPdfReader->GetError()) + CPdfFile* pPdfReader = static_cast(pReader); + if(PdfFile::errorEncrypted == pPdfReader->GetError()) { if(sPassword.empty()) { @@ -4726,7 +4724,7 @@ namespace NExtractTools } else { - CPdfRenderer pdfWriter(pApplicationFonts, params.getIsPDFA()); + CPdfFile pdfWriter(pApplicationFonts, 2, params.getIsPDFA()); pdfWriter.SetTempFolder(sTemp); pdfWriter.SetTempFolder(sTemp); @@ -4778,7 +4776,7 @@ namespace NExtractTools switch (nFormatFrom) { case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF: - pReader = new PdfReader::CPdfReader(pApplicationFonts); + pReader = new CPdfFile(pApplicationFonts, 1); break; case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS: pReader = new CXpsFile(pApplicationFonts); diff --git a/XpsFile/XpsFile.cpp b/XpsFile/XpsFile.cpp index 0f6855159f..2f074e43d9 100644 --- a/XpsFile/XpsFile.cpp +++ b/XpsFile/XpsFile.cpp @@ -38,7 +38,7 @@ #include "../DesktopEditor/raster/BgraFrame.h" #ifndef DISABLE_PDF_CONVERTATION -#include "../PdfWriter/PdfRenderer.h" +#include "../PdfFile/PdfFile.h" #endif #include "../OfficeUtils/src/OfficeUtils.h" @@ -188,7 +188,7 @@ std::wstring CXpsFile::GetInfo() #ifndef DISABLE_PDF_CONVERTATION void CXpsFile::ConvertToPdf(const std::wstring& wsPath) { - CPdfRenderer oPdf(m_pInternal->m_pAppFonts); + CPdfFile oPdf(m_pInternal->m_pAppFonts, 2); bool bBreak = false; int nPagesCount = GetPagesCount(); diff --git a/XpsFile/XpsFile.pro b/XpsFile/XpsFile.pro index 94e939221a..71b6101bf4 100644 --- a/XpsFile/XpsFile.pro +++ b/XpsFile/XpsFile.pro @@ -14,7 +14,7 @@ PWD_ROOT_DIR = $$PWD include(../Common/base.pri) DEFINES += XPS_USE_DYNAMIC_LIBRARY -ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, PdfWriter) +ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, PdfFile) core_windows { LIBS += -lgdi32 \ diff --git a/XpsFile/XpsLib/StaticResources.cpp b/XpsFile/XpsLib/StaticResources.cpp index 973cb66eeb..fdc0811461 100644 --- a/XpsFile/XpsLib/StaticResources.cpp +++ b/XpsFile/XpsLib/StaticResources.cpp @@ -37,7 +37,7 @@ #include "../../DesktopEditor/common/File.h" #ifndef DISABLE_PDF_CONVERTATION -#include "../../PdfWriter/PdfRenderer.h" +#include "../../PdfFile/PdfFile.h" #endif #ifndef M_PI @@ -204,7 +204,7 @@ namespace XPS if (c_nPDFWriter == lRendererType) { - CPdfRenderer* pPdf = (CPdfRenderer*)pRenderer; + CPdfFile* pPdf = (CPdfFile*)pRenderer; pPdf->put_BrushGradientColors(m_pColors, m_pPositions, m_lCount); pPdf->SetLinearGradient(m_dX0, m_dY0, m_dX1, m_dY1); } @@ -231,7 +231,7 @@ namespace XPS if (c_nPDFWriter == lRendererType) { - CPdfRenderer* pPdf = (CPdfRenderer*)pRenderer; + CPdfFile* pPdf = (CPdfFile*)pRenderer; pPdf->put_BrushGradientColors(m_pColors, m_pPositions, m_lCount); pPdf->SetRadialGradient(m_dXo, m_dYo, 0, m_dXc, m_dYc, std::max(m_dRadX, m_dRadY)); }