From 283ec810a2ae3e1e1c9215ef63a1b0fb4eabddcf Mon Sep 17 00:00:00 2001 From: Kulikova Svetlana Date: Thu, 23 Mar 2023 12:38:48 +0300 Subject: [PATCH] separation of information and appearance of widgets --- .../graphics/pro/js/drawingfile.json | 3 +- .../pro/js/wasm/js/drawingfile_base.js | 58 +++-- .../graphics/pro/js/wasm/src/drawingfile.cpp | 76 +++--- .../graphics/pro/js/wasm/src/drawingfile.h | 10 +- PdfFile/PdfFile.cpp | 10 +- PdfFile/PdfFile.h | 3 +- PdfFile/PdfReader.cpp | 216 +++++++++++------- PdfFile/PdfReader.h | 3 +- 8 files changed, 250 insertions(+), 129 deletions(-) diff --git a/DesktopEditor/graphics/pro/js/drawingfile.json b/DesktopEditor/graphics/pro/js/drawingfile.json index 41037b105e..4a93c0f641 100644 --- a/DesktopEditor/graphics/pro/js/drawingfile.json +++ b/DesktopEditor/graphics/pro/js/drawingfile.json @@ -29,7 +29,8 @@ "_GetGlyphs", "_GetLinks", "_GetStructure", - "_GetInteractiveForms", + "_GetInteractiveFormsInfo", + "_GetInteractiveFormsAP", "_InitializeFontsBin", "_InitializeFontsBase64", "_InitializeFontsRanges", diff --git a/DesktopEditor/graphics/pro/js/wasm/js/drawingfile_base.js b/DesktopEditor/graphics/pro/js/wasm/js/drawingfile_base.js index 1f5a6a7673..a6a49041d7 100644 --- a/DesktopEditor/graphics/pro/js/wasm/js/drawingfile_base.js +++ b/DesktopEditor/graphics/pro/js/wasm/js/drawingfile_base.js @@ -374,7 +374,7 @@ var ext = Module["_GetInteractiveForms"](this.nativeFile, pageIndex, width, height, backgroundColor === undefined ? 0xFFFFFF : backgroundColor); if (ext == 0) return res; - + var lenArray = new Int32Array(Module["HEAP8"].buffer, ext, 4); if (lenArray == null) return res; @@ -386,10 +386,13 @@ var buffer = new Uint8Array(Module["HEAP8"].buffer, ext + 4, len); var reader = new CBinaryReader(buffer, 0, len); - + while (reader.isValid()) { var rec = {}; + rec["AP"] = {}; + // Номер для сопоставление с AP + rec["AP"]["i"] = reader.readInt(); rec["annotflag"] = reader.readInt(); // 12.5.3 rec["hidden"] = rec["annotflag"] & (1 << 1); // Hidden @@ -401,22 +404,13 @@ rec["locked"] = rec["annotflag"] & (1 << 7); // Locked rec["lockedC"] = rec["annotflag"] & (1 << 9); // LockedContents - rec["name"] = reader.readString(); + rec["name"] = reader.readString(); + rec["page"] = reader.readInt(); // Необходимо смещение полученных координат как у getStructure и viewer.navigate rec["x1"] = reader.readDouble(); rec["y1"] = reader.readDouble(); rec["x2"] = reader.readDouble(); rec["y2"] = reader.readDouble(); - - // Внешний вид аннотации - rec["AP"] = {}; - rec["AP"]["w"] = reader.readInt(); - rec["AP"]["h"] = reader.readInt(); - let np1 = reader.readInt(); - let np2 = reader.readInt(); - // Указатель на память, аналогичный возвращаемому getPagePixmap. Память необходимо освободить - rec["AP"]["retValue"] = np2 << 32 | np1; - rec["alignment"] = reader.readInt(); rec["type"] = reader.readString(); rec["flag"] = reader.readInt(); @@ -596,6 +590,44 @@ Module["_free"](ext); return res; }; + CFile.prototype["getInteractiveFormsAP"] = function(pageIndex, width, height, backgroundColor) + { + var res = []; + var ext = Module["_GetInteractiveFormsAP"](this.nativeFile, pageIndex, width, height, backgroundColor === undefined ? 0xFFFFFF : backgroundColor); + if (ext == 0) + return res; + + var lenArray = new Int32Array(Module["HEAP8"].buffer, ext, 4); + if (lenArray == null) + return res; + + var len = lenArray[0]; + len -= 4; + if (len <= 0) + return res; + + var buffer = new Uint8Array(Module["HEAP8"].buffer, ext + 4, len); + var reader = new CBinaryReader(buffer, 0, len); + + while (reader.isValid()) + { + // Внешний вид аннотации + var rec = {}; + // Номер для сопоставление с AP + rec["i"] = reader.readInt(); + rec["w"] = reader.readInt(); + rec["h"] = reader.readInt(); + let np1 = reader.readInt(); + let np2 = reader.readInt(); + // Указатель на память, аналогичный возвращаемому getPagePixmap. Память необходимо освободить + rec["retValue"] = np2 << 32 | np1; + + res.push(rec); + } + + Module["_free"](ext); + return res; + }; CFile.prototype["getStructure"] = function() { var res = []; diff --git a/DesktopEditor/graphics/pro/js/wasm/src/drawingfile.cpp b/DesktopEditor/graphics/pro/js/wasm/src/drawingfile.cpp index d3873e772b..77a4f05afe 100644 --- a/DesktopEditor/graphics/pro/js/wasm/src/drawingfile.cpp +++ b/DesktopEditor/graphics/pro/js/wasm/src/drawingfile.cpp @@ -150,9 +150,13 @@ WASM_EXPORT BYTE* GetStructure(CGraphicsFileDrawing* pGraphics) { return pGraphics->GetStructure(); } -WASM_EXPORT BYTE* GetInteractiveForms(CGraphicsFileDrawing* pGraphics, int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor) +WASM_EXPORT BYTE* GetInteractiveFormsInfo(CGraphicsFileDrawing* pGraphics) { - return pGraphics->GetInteractiveForms(nPageIndex, nRasterW, nRasterH, nBackgroundColor); + return pGraphics->GetInteractiveFormsInfo(); +} +WASM_EXPORT BYTE* GetInteractiveFormsAP(CGraphicsFileDrawing* pGraphics, int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor) +{ + return pGraphics->GetInteractiveFormsAP(nPageIndex, nRasterW, nRasterH, nBackgroundColor); } WASM_EXPORT void DestroyTextInfo(CGraphicsFileDrawing* pGraphics) { @@ -375,7 +379,7 @@ int main(int argc, char* argv[]) // INTERACTIVE FORMS if (true) { - BYTE* pWidgets = GetInteractiveForms(pGrFile, nTestPage, nWidth, nHeight, 0xFFFFFF); + BYTE* pWidgets = GetInteractiveFormsInfo(pGrFile); nLength = READ_INT(pWidgets); DWORD i = 4; nLength -= 4; @@ -383,13 +387,19 @@ int main(int argc, char* argv[]) { DWORD nPathLength = READ_INT(pWidgets + i); i += 4; - std::cout << "Annot Flag " << nPathLength << ", "; + std::cout << "Annot - AP " << nPathLength << ", "; + nPathLength = READ_INT(pWidgets + i); + i += 4; + std::cout << "Flag " << nPathLength << ", "; nPathLength = READ_INT(pWidgets + i); i += 4; std::cout << "Name " << std::string((char*)(pWidgets + i), nPathLength) << ", "; i += nPathLength; nPathLength = READ_INT(pWidgets + i); i += 4; + std::cout << "Page " << nPathLength << ", "; + nPathLength = READ_INT(pWidgets + i); + i += 4; std::cout << "X1 " << (double)nPathLength / 100.0 << ", "; nPathLength = READ_INT(pWidgets + i); i += 4; @@ -400,28 +410,6 @@ int main(int argc, char* argv[]) nPathLength = READ_INT(pWidgets + i); i += 4; std::cout << "Y2 " << (double)nPathLength / 100.0 << ", "; - int nWidgetWidth = READ_INT(pWidgets + i); - i += 4; - std::cout << "W " << nWidgetWidth << ", "; - int nWidgetHeight = READ_INT(pWidgets + i); - i += 4; - std::cout << "H " << nWidgetHeight << ", "; - unsigned long long npBgraData1 = READ_INT(pWidgets + i); - i += 4; - unsigned long long npBgraData2 = READ_INT(pWidgets + i); - i += 4; - - BYTE* res = (BYTE*)(npBgraData2 << 32 | npBgraData1); - CBgraFrame oFrame; - oFrame.put_Data(res); - oFrame.put_Width(nWidgetWidth); - oFrame.put_Height(nWidgetHeight); - oFrame.put_Stride(4 * nWidgetWidth); - oFrame.put_IsRGBA(true); - oFrame.SaveFile(NSFile::GetProcessDirectory() + L"/res3.png", _CXIMAGE_FORMAT_PNG); - oFrame.ClearNoAttack(); - RELEASEARRAYOBJECTS(res); - nPathLength = READ_INT(pWidgets + i); i += 4; std::cout << "Q " << nPathLength << ", "; @@ -689,6 +677,42 @@ int main(int argc, char* argv[]) if (pWidgets) free(pWidgets); + + BYTE* pWidgetsAP = GetInteractiveFormsAP(pGrFile, nTestPage, nWidth, nHeight, 0xFFFFFF); + nLength = READ_INT(pWidgetsAP); + i = 4; + nLength -= 4; + + while (i < nLength) + { + DWORD nPathLength = READ_INT(pWidgetsAP + i); + i += 4; + std::cout << "AP " << nPathLength << ", "; + int nWidgetWidth = READ_INT(pWidgetsAP + i); + i += 4; + std::cout << "W " << nWidgetWidth << ", "; + int nWidgetHeight = READ_INT(pWidgetsAP + i); + i += 4; + std::cout << "H " << nWidgetHeight << ", "; + unsigned long long npBgraData1 = READ_INT(pWidgetsAP + i); + i += 4; + unsigned long long npBgraData2 = READ_INT(pWidgetsAP + i); + i += 4; + + BYTE* res = (BYTE*)(npBgraData2 << 32 | npBgraData1); + CBgraFrame oFrame; + oFrame.put_Data(res); + oFrame.put_Width(nWidgetWidth); + oFrame.put_Height(nWidgetHeight); + oFrame.put_Stride(4 * nWidgetWidth); + oFrame.put_IsRGBA(true); + oFrame.SaveFile(NSFile::GetProcessDirectory() + L"/res3.png", _CXIMAGE_FORMAT_PNG); + oFrame.ClearNoAttack(); + RELEASEARRAYOBJECTS(res); + } + + if (pWidgetsAP) + free(pWidgetsAP); } Close(pGrFile); diff --git a/DesktopEditor/graphics/pro/js/wasm/src/drawingfile.h b/DesktopEditor/graphics/pro/js/wasm/src/drawingfile.h index 21df01079d..8ca4f6238b 100644 --- a/DesktopEditor/graphics/pro/js/wasm/src/drawingfile.h +++ b/DesktopEditor/graphics/pro/js/wasm/src/drawingfile.h @@ -110,10 +110,16 @@ public: { return pReader->GetStructure(); } - BYTE* GetInteractiveForms(int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor) + BYTE* GetInteractiveFormsInfo() { if (nType == 0) - return ((CPdfFile*)pReader)->GetWidgets(nPageIndex, nRasterW, nRasterH, nBackgroundColor); + return ((CPdfFile*)pReader)->GetWidgets(); + return NULL; + } + BYTE* GetInteractiveFormsAP(int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor) + { + if (nType == 0) + return ((CPdfFile*)pReader)->GetAPWidgets(nPageIndex, nRasterW, nRasterH, nBackgroundColor); return NULL; } std::wstring GetInfo() diff --git a/PdfFile/PdfFile.cpp b/PdfFile/PdfFile.cpp index 00949d49e1..878fdef162 100644 --- a/PdfFile/PdfFile.cpp +++ b/PdfFile/PdfFile.cpp @@ -811,11 +811,17 @@ BYTE* CPdfFile::GetLinks(int nPageIndex) return NULL; return m_pInternal->pReader->GetLinks(nPageIndex); } -BYTE* CPdfFile::GetWidgets(int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor) +BYTE* CPdfFile::GetWidgets() { if (!m_pInternal->pReader) return NULL; - return m_pInternal->pReader->GetWidgets(nPageIndex, nRasterW, nRasterH, nBackgroundColor); + return m_pInternal->pReader->GetWidgets(); +} +BYTE* CPdfFile::GetAPWidgets(int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor) +{ + if (!m_pInternal->pReader) + return NULL; + return m_pInternal->pReader->GetAPWidgets(nPageIndex, nRasterW, nRasterH, nBackgroundColor); } // ------------------------------------------------------------------------ diff --git a/PdfFile/PdfFile.h b/PdfFile/PdfFile.h index 6bfcfbf8b0..5ec12b8ea4 100644 --- a/PdfFile/PdfFile.h +++ b/PdfFile/PdfFile.h @@ -124,7 +124,8 @@ public: virtual std::wstring GetInfo(); virtual BYTE* GetStructure(); virtual BYTE* GetLinks(int nPageIndex); - BYTE* GetWidgets(int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor); + BYTE* GetWidgets(); + BYTE* GetAPWidgets(int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor); // --- WRITER --- diff --git a/PdfFile/PdfReader.cpp b/PdfFile/PdfReader.cpp index 5d2a5f11ad..26f38188af 100644 --- a/PdfFile/PdfReader.cpp +++ b/PdfFile/PdfReader.cpp @@ -718,7 +718,7 @@ BYTE* CPdfReader::GetLinks(int nPageIndex) return oLinks.Serialize(); } -BYTE* CPdfReader::GetWidgets(int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor) +BYTE* CPdfReader::GetWidgets() { if (!m_pPDFDocument || !m_pPDFDocument->getCatalog()) return NULL; @@ -727,53 +727,6 @@ BYTE* CPdfReader::GetWidgets(int nPageIndex, int nRasterW, int nRasterH, int nBa if (!pAcroForms) return NULL; - GBool bDrawContent = globalParams->getDrawContent(); - GBool bDrawAnnotations = globalParams->getDrawAnnotations(); - GBool bDrawFormFileds = globalParams->getDrawFormFields(); - - globalParams->setDrawContent(gFalse); - globalParams->setDrawAnnotations(gFalse); - globalParams->setDrawFormFields(gTrue); - - NSGraphics::IGraphicsRenderer* pRenderer = NSGraphics::Create(); - pRenderer->SetFontManager(m_pFontManager); - - double dPageDpiX, dPageDpiY; - double dWidth, dHeight; - GetPageInfo(nPageIndex, &dWidth, &dHeight, &dPageDpiX, &dPageDpiY); - - int nWidth = (nRasterW > 0) ? nRasterW : (int)((int)dWidth * 96 / dPageDpiX); - int nHeight = (nRasterH > 0) ? nRasterH : (int)((int)dHeight * 96 / dPageDpiY); - - BYTE* pBgraData = new BYTE[nWidth * nHeight * 4]; - if (!pBgraData) - { - RELEASEOBJECT(pRenderer); - globalParams->setDrawContent(bDrawContent); - globalParams->setDrawAnnotations(bDrawAnnotations); - globalParams->setDrawFormFields(bDrawFormFileds); - return NULL; - } - - unsigned int nColor = (unsigned int)nBackgroundColor; - unsigned int nSize = (unsigned int)(nWidth * nHeight); - unsigned int* pTemp = (unsigned int*)pBgraData; - for (unsigned int i = 0; i < nSize; ++i) - *pTemp++ = nColor; - - CBgraFrame* pFrame = new CBgraFrame(); - pFrame->put_Data(pBgraData); - pFrame->put_Width(nWidth); - pFrame->put_Height(nHeight); - pFrame->put_Stride(4 * nWidth); - - pRenderer->CreateFromBgraFrame(pFrame); - pRenderer->SetSwapRGB(true); - pRenderer->put_Width(dWidth * 25.4 / dPageDpiX); - pRenderer->put_Height(dHeight * 25.4 / dPageDpiX); - if (nBackgroundColor != 0xFFFFFF) - pRenderer->CommandLong(c_nDarkMode, 1); - NSWasm::CData oRes; oRes.SkipLen(); @@ -782,12 +735,15 @@ BYTE* CPdfReader::GetWidgets(int nPageIndex, int nRasterW, int nRasterH, int nBa AcroFormField* pField = pAcroForms->getField(i); Object oFieldRef, oField; XRef* xref = m_pPDFDocument->getXRef(); - if (!xref || !pField->getFieldRef(&oFieldRef) || !oFieldRef.isRef() || !oFieldRef.fetch(xref, &oField) || !oField.isDict() || pField->getPageNum() != nPageIndex + 1) + if (!xref || !pField->getFieldRef(&oFieldRef) || !oFieldRef.isRef() || !oFieldRef.fetch(xref, &oField) || !oField.isDict()) { oFieldRef.free(); oField.free(); continue; } + // Номер аннотации для сопоставления с AP + oRes.AddInt(i); + // Флаг аннотации - F Object oFlag; int nAnnotFlag = 0; @@ -803,6 +759,14 @@ BYTE* CPdfReader::GetWidgets(int nPageIndex, int nRasterW, int nRasterH, int nBa oRes.WriteString((BYTE*)sTName.c_str(), (unsigned int)sTName.length()); gfree(uName); + // Номер страницы - P + int nPage = pField->getPageNum(); + oRes.AddInt(nPage - 1); + + double dPageDpiX, dPageDpiY; + double dWidth, dHeight; + GetPageInfo(nPage - 1, &dWidth, &dHeight, &dPageDpiX, &dPageDpiY); + // Координаты - BBox double dx1, dy1, dx2, dy2; pField->getBBox(&dx1, &dy1, &dx2, &dy2); @@ -814,40 +778,6 @@ BYTE* CPdfReader::GetWidgets(int nPageIndex, int nRasterW, int nRasterH, int nBa oRes.AddDouble(dx2); oRes.AddDouble(dy2); - globalParams->setDrawFormField(i); - bool bBreak = false; - m_pRenderer->DrawPageOnRenderer(pRenderer, nPageIndex, &bBreak); - - // Получение пикселей внешнего вида виджета - int nRx1 = dx1 * (double)nWidth / dWidth; - int nRx2 = dx2 * (double)nWidth / dWidth + 1; - int nRy1 = dy1 * (double)nHeight / dHeight; - int nRy2 = dy2 * (double)nHeight / dHeight + 1; - if (nRx1 < 0) nRx1 = 0; - if (nRy1 < 0) nRy1 = 0; - if (nRx2 > nWidth) nRx1 = nWidth; - if (nRy2 > nHeight) nRy1 = nHeight; - - BYTE* pSubMatrix = new BYTE[(nRx2 - nRx1) * (nRy2 - nRy1) * 4]; - int p = 0; - unsigned int* pTemp = (unsigned int*)pBgraData; - unsigned int* pSubTemp = (unsigned int*)pSubMatrix; - for (int y = nRy1; y < nRy2; ++y) - { - for (int x = nRx1; x < nRx2; ++x) - { - pSubTemp[p++] = pTemp[y * nWidth + x]; - pTemp[y * nWidth + x] = 0; - } - } - - oRes.AddInt(nRx2 - nRx1); - oRes.AddInt(nRy2 - nRy1); - unsigned long long npSubMatrix = (unsigned long long)pSubMatrix; - unsigned int npSubMatrix1 = npSubMatrix & 0xFFFFFFFF; - oRes.AddInt(npSubMatrix1); - oRes.AddInt(npSubMatrix >> 32); - // Выравнивание текста - Q Object oQ; pField->fieldLookup("Q", &oQ); @@ -1462,6 +1392,126 @@ oObj.free();\ oRes.AddInt(nFlags, nFlagPos); } + oRes.WriteLen(); + BYTE* bRes = oRes.GetBuffer(); + oRes.ClearWithoutAttack(); + return bRes; +} +BYTE* CPdfReader::GetAPWidgets(int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor) +{ + if (!m_pPDFDocument || !m_pPDFDocument->getCatalog()) + return NULL; + + AcroForm* pAcroForms = m_pPDFDocument->getCatalog()->getForm(); + if (!pAcroForms) + return NULL; + + GBool bDrawContent = globalParams->getDrawContent(); + GBool bDrawAnnotations = globalParams->getDrawAnnotations(); + GBool bDrawFormFileds = globalParams->getDrawFormFields(); + + globalParams->setDrawContent(gFalse); + globalParams->setDrawAnnotations(gFalse); + globalParams->setDrawFormFields(gTrue); + + NSGraphics::IGraphicsRenderer* pRenderer = NSGraphics::Create(); + pRenderer->SetFontManager(m_pFontManager); + + double dPageDpiX, dPageDpiY; + double dWidth, dHeight; + GetPageInfo(nPageIndex, &dWidth, &dHeight, &dPageDpiX, &dPageDpiY); + + int nWidth = (nRasterW > 0) ? nRasterW : (int)((int)dWidth * 96 / dPageDpiX); + int nHeight = (nRasterH > 0) ? nRasterH : (int)((int)dHeight * 96 / dPageDpiY); + + BYTE* pBgraData = new BYTE[nWidth * nHeight * 4]; + if (!pBgraData) + { + RELEASEOBJECT(pRenderer); + globalParams->setDrawContent(bDrawContent); + globalParams->setDrawAnnotations(bDrawAnnotations); + globalParams->setDrawFormFields(bDrawFormFileds); + return NULL; + } + + unsigned int nColor = (unsigned int)nBackgroundColor; + unsigned int nSize = (unsigned int)(nWidth * nHeight); + unsigned int* pTemp = (unsigned int*)pBgraData; + for (unsigned int i = 0; i < nSize; ++i) + *pTemp++ = nColor; + + CBgraFrame* pFrame = new CBgraFrame(); + pFrame->put_Data(pBgraData); + pFrame->put_Width(nWidth); + pFrame->put_Height(nHeight); + pFrame->put_Stride(4 * nWidth); + + pRenderer->CreateFromBgraFrame(pFrame); + pRenderer->SetSwapRGB(true); + pRenderer->put_Width(dWidth * 25.4 / dPageDpiX); + pRenderer->put_Height(dHeight * 25.4 / dPageDpiX); + if (nBackgroundColor != 0xFFFFFF) + pRenderer->CommandLong(c_nDarkMode, 1); + + NSWasm::CData oRes; + oRes.SkipLen(); + + for (int i = 0, nNum = pAcroForms->getNumFields(); i < nNum; ++i) + { + AcroFormField* pField = pAcroForms->getField(i); + Object oFieldRef, oField; + XRef* xref = m_pPDFDocument->getXRef(); + if (!xref || !pField->getFieldRef(&oFieldRef) || !oFieldRef.isRef() || !oFieldRef.fetch(xref, &oField) || !oField.isDict() || pField->getPageNum() != nPageIndex + 1) + { + oFieldRef.free(); oField.free(); + continue; + } + + // Координаты - BBox + double dx1, dy1, dx2, dy2; + pField->getBBox(&dx1, &dy1, &dx2, &dy2); + double dTemp = dy1; + dy1 = dHeight - dy2; + dy2 = dHeight - dTemp; + + globalParams->setDrawFormField(i); + bool bBreak = false; + m_pRenderer->DrawPageOnRenderer(pRenderer, nPageIndex, &bBreak); + + // Получение пикселей внешнего вида виджета + int nRx1 = dx1 * (double)nWidth / dWidth; + int nRx2 = dx2 * (double)nWidth / dWidth + 1; + int nRy1 = dy1 * (double)nHeight / dHeight; + int nRy2 = dy2 * (double)nHeight / dHeight + 1; + if (nRx1 < 0) nRx1 = 0; + if (nRy1 < 0) nRy1 = 0; + if (nRx2 > nWidth) nRx1 = nWidth; + if (nRy2 > nHeight) nRy1 = nHeight; + + BYTE* pSubMatrix = new BYTE[(nRx2 - nRx1) * (nRy2 - nRy1) * 4]; + int p = 0; + unsigned int* pTemp = (unsigned int*)pBgraData; + unsigned int* pSubTemp = (unsigned int*)pSubMatrix; + for (int y = nRy1; y < nRy2; ++y) + { + for (int x = nRx1; x < nRx2; ++x) + { + pSubTemp[p++] = pTemp[y * nWidth + x]; + pTemp[y * nWidth + x] = 0; + } + } + + // Номер аннотации для сопоставления с AP + oRes.AddInt(i); + + oRes.AddInt(nRx2 - nRx1); + oRes.AddInt(nRy2 - nRy1); + unsigned long long npSubMatrix = (unsigned long long)pSubMatrix; + unsigned int npSubMatrix1 = npSubMatrix & 0xFFFFFFFF; + oRes.AddInt(npSubMatrix1); + oRes.AddInt(npSubMatrix >> 32); + } + globalParams->setDrawContent(bDrawContent); globalParams->setDrawAnnotations(bDrawAnnotations); globalParams->setDrawFormFields(bDrawFormFileds); diff --git a/PdfFile/PdfReader.h b/PdfFile/PdfReader.h index 107e164446..55ff18a762 100644 --- a/PdfFile/PdfReader.h +++ b/PdfFile/PdfReader.h @@ -70,7 +70,8 @@ public: BYTE* GetStructure(); BYTE* GetLinks(int nPageIndex); - BYTE* GetWidgets(int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor); + BYTE* GetWidgets(); + BYTE* GetAPWidgets(int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor); private: IOfficeDrawingFile* m_pRenderer;