John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Lei Zhang | b4e7f30 | 2015-11-06 15:52:32 -0800 | [diff] [blame] | 7 | #include "public/fpdf_text.h" |
| 8 | |
Lei Zhang | a688a04 | 2015-11-09 13:57:49 -0800 | [diff] [blame] | 9 | #include "core/include/fpdfdoc/fpdf_doc.h" |
| 10 | #include "core/include/fpdftext/fpdf_text.h" |
Tom Sepez | 1b24628 | 2015-11-25 15:15:31 -0800 | [diff] [blame] | 11 | #include "fpdfsdk/include/fsdk_define.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 12 | |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 13 | #ifdef PDF_ENABLE_XFA |
| 14 | #include "../include/fpdfxfa/fpdfxfa_doc.h" |
| 15 | #include "../include/fpdfxfa/fpdfxfa_page.h" |
| 16 | #endif // PDF_ENABLE_XFA |
| 17 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 18 | #ifdef _WIN32 |
| 19 | #include <tchar.h> |
| 20 | #endif |
| 21 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 22 | DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) { |
Tom Sepez | 1b24628 | 2015-11-25 15:15:31 -0800 | [diff] [blame] | 23 | CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); |
| 24 | if (!pPDFPage) |
| 25 | return nullptr; |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 26 | #ifdef PDF_ENABLE_XFA |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 27 | CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 28 | CPDFXFA_Document* pDoc = pPage->GetDocument(); |
| 29 | CPDF_ViewerPreferences viewRef(pDoc->GetPDFDoc()); |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 30 | #else // PDF_ENABLE_XFA |
| 31 | CPDF_ViewerPreferences viewRef(pPDFPage->m_pDocument); |
| 32 | #endif // PDF_ENABLE_XFA |
Tom Sepez | 1b24628 | 2015-11-25 15:15:31 -0800 | [diff] [blame] | 33 | IPDF_TextPage* textpage = |
| 34 | IPDF_TextPage::CreateTextPage(pPDFPage, viewRef.IsDirectionR2L()); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 35 | textpage->ParseTextPage(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 36 | return textpage; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 37 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 38 | DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) { |
| 39 | delete (IPDF_TextPage*)text_page; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 40 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 41 | DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) { |
| 42 | if (!text_page) |
| 43 | return -1; |
| 44 | IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
| 45 | return textpage->CountChars(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 46 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 47 | DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, |
| 48 | int index) { |
| 49 | if (!text_page) |
| 50 | return -1; |
| 51 | IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 52 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 53 | if (index < 0 || index >= textpage->CountChars()) |
| 54 | return 0; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 55 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 56 | FPDF_CHAR_INFO charinfo; |
| 57 | textpage->GetCharInfo(index, charinfo); |
| 58 | return charinfo.m_Unicode; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 59 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 60 | DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, |
| 61 | int index) { |
| 62 | if (!text_page) |
| 63 | return 0; |
| 64 | IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 65 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 66 | if (index < 0 || index >= textpage->CountChars()) |
| 67 | return 0; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 68 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 69 | FPDF_CHAR_INFO charinfo; |
| 70 | textpage->GetCharInfo(index, charinfo); |
| 71 | return charinfo.m_FontSize; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 72 | } |
| 73 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 74 | DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, |
| 75 | int index, |
| 76 | double* left, |
| 77 | double* right, |
| 78 | double* bottom, |
| 79 | double* top) { |
| 80 | if (!text_page) |
| 81 | return; |
| 82 | IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 83 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 84 | if (index < 0 || index >= textpage->CountChars()) |
| 85 | return; |
| 86 | FPDF_CHAR_INFO charinfo; |
| 87 | textpage->GetCharInfo(index, charinfo); |
| 88 | *left = charinfo.m_CharBox.left; |
| 89 | *right = charinfo.m_CharBox.right; |
| 90 | *bottom = charinfo.m_CharBox.bottom; |
| 91 | *top = charinfo.m_CharBox.top; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 92 | } |
| 93 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 94 | // select |
| 95 | DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, |
| 96 | double x, |
| 97 | double y, |
Lei Zhang | 38a5a39 | 2015-08-13 17:52:16 -0700 | [diff] [blame] | 98 | double xTolerance, |
| 99 | double yTolerance) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 100 | if (!text_page) |
| 101 | return -3; |
| 102 | IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
Lei Zhang | 38a5a39 | 2015-08-13 17:52:16 -0700 | [diff] [blame] | 103 | return textpage->GetIndexAtPos((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)xTolerance, |
| 104 | (FX_FLOAT)yTolerance); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 105 | } |
| 106 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 107 | DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, |
| 108 | int start, |
| 109 | int count, |
| 110 | unsigned short* result) { |
| 111 | if (!text_page) |
| 112 | return 0; |
| 113 | IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 114 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 115 | if (start >= textpage->CountChars()) |
| 116 | return 0; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 117 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 118 | CFX_WideString str = textpage->GetPageText(start, count); |
| 119 | if (str.GetLength() > count) |
| 120 | str = str.Left(count); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 121 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 122 | CFX_ByteString cbUTF16str = str.UTF16LE_Encode(); |
| 123 | FXSYS_memcpy(result, cbUTF16str.GetBuffer(cbUTF16str.GetLength()), |
| 124 | cbUTF16str.GetLength()); |
| 125 | cbUTF16str.ReleaseBuffer(cbUTF16str.GetLength()); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 126 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 127 | return cbUTF16str.GetLength() / sizeof(unsigned short); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 128 | } |
| 129 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 130 | DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, |
| 131 | int start, |
| 132 | int count) { |
| 133 | if (!text_page) |
| 134 | return 0; |
| 135 | IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
| 136 | return textpage->CountRects(start, count); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 137 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 138 | DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, |
| 139 | int rect_index, |
| 140 | double* left, |
| 141 | double* top, |
| 142 | double* right, |
| 143 | double* bottom) { |
| 144 | if (!text_page) |
| 145 | return; |
| 146 | IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
| 147 | CFX_FloatRect rect; |
| 148 | textpage->GetRect(rect_index, rect.left, rect.top, rect.right, rect.bottom); |
| 149 | *left = rect.left; |
| 150 | *top = rect.top; |
| 151 | *right = rect.right; |
| 152 | *bottom = rect.bottom; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 153 | } |
| 154 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 155 | DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page, |
| 156 | double left, |
| 157 | double top, |
| 158 | double right, |
| 159 | double bottom, |
| 160 | unsigned short* buffer, |
| 161 | int buflen) { |
| 162 | if (!text_page) |
| 163 | return 0; |
| 164 | IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
| 165 | CFX_FloatRect rect((FX_FLOAT)left, (FX_FLOAT)bottom, (FX_FLOAT)right, |
| 166 | (FX_FLOAT)top); |
| 167 | CFX_WideString str = textpage->GetTextByRect(rect); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 168 | |
Lei Zhang | 412e908 | 2015-12-14 18:34:00 -0800 | [diff] [blame] | 169 | if (buflen <= 0 || !buffer) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 170 | return str.GetLength(); |
| 171 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 172 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 173 | CFX_ByteString cbUTF16Str = str.UTF16LE_Encode(); |
| 174 | int len = cbUTF16Str.GetLength() / sizeof(unsigned short); |
| 175 | int size = buflen > len ? len : buflen; |
| 176 | FXSYS_memcpy(buffer, cbUTF16Str.GetBuffer(size * sizeof(unsigned short)), |
| 177 | size * sizeof(unsigned short)); |
| 178 | cbUTF16Str.ReleaseBuffer(size * sizeof(unsigned short)); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 179 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 180 | return size; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 181 | } |
| 182 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 183 | // Search |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 184 | //-1 for end |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 185 | DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, |
| 186 | FPDF_WIDESTRING findwhat, |
| 187 | unsigned long flags, |
| 188 | int start_index) { |
| 189 | if (!text_page) |
| 190 | return NULL; |
| 191 | IPDF_TextPageFind* textpageFind = NULL; |
| 192 | textpageFind = IPDF_TextPageFind::CreatePageFind((IPDF_TextPage*)text_page); |
| 193 | FX_STRSIZE len = CFX_WideString::WStringLength(findwhat); |
| 194 | textpageFind->FindFirst(CFX_WideString::FromUTF16LE(findwhat, len), flags, |
| 195 | start_index); |
| 196 | return textpageFind; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 197 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 198 | DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle) { |
| 199 | if (!handle) |
| 200 | return FALSE; |
| 201 | IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
| 202 | return textpageFind->FindNext(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 203 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 204 | DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle) { |
| 205 | if (!handle) |
| 206 | return FALSE; |
| 207 | IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
| 208 | return textpageFind->FindPrev(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 209 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 210 | DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle) { |
| 211 | if (!handle) |
| 212 | return 0; |
| 213 | IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
| 214 | return textpageFind->GetCurOrder(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 215 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 216 | DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle) { |
| 217 | if (!handle) |
| 218 | return 0; |
| 219 | IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
| 220 | return textpageFind->GetMatchedCount(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 221 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 222 | DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle) { |
| 223 | if (!handle) |
| 224 | return; |
| 225 | IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
| 226 | delete textpageFind; |
| 227 | handle = NULL; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 228 | } |
| 229 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 230 | // web link |
| 231 | DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page) { |
| 232 | if (!text_page) |
| 233 | return NULL; |
| 234 | IPDF_LinkExtract* pageLink = NULL; |
| 235 | pageLink = IPDF_LinkExtract::CreateLinkExtract(); |
| 236 | pageLink->ExtractLinks((IPDF_TextPage*)text_page); |
| 237 | return pageLink; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 238 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 239 | DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page) { |
| 240 | if (!link_page) |
| 241 | return 0; |
| 242 | IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; |
| 243 | return pageLink->CountLinks(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 244 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 245 | DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, |
| 246 | int link_index, |
| 247 | unsigned short* buffer, |
| 248 | int buflen) { |
| 249 | if (!link_page) |
| 250 | return 0; |
| 251 | IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; |
| 252 | CFX_WideString url = pageLink->GetURL(link_index); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 253 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 254 | CFX_ByteString cbUTF16URL = url.UTF16LE_Encode(); |
| 255 | int len = cbUTF16URL.GetLength() / sizeof(unsigned short); |
Lei Zhang | 412e908 | 2015-12-14 18:34:00 -0800 | [diff] [blame] | 256 | if (!buffer || buflen <= 0) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 257 | return len; |
| 258 | int size = len < buflen ? len : buflen; |
| 259 | if (size > 0) { |
| 260 | FXSYS_memcpy(buffer, cbUTF16URL.GetBuffer(size * sizeof(unsigned short)), |
| 261 | size * sizeof(unsigned short)); |
| 262 | cbUTF16URL.ReleaseBuffer(size * sizeof(unsigned short)); |
| 263 | } |
| 264 | return size; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 265 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 266 | DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, |
| 267 | int link_index) { |
| 268 | if (!link_page) |
| 269 | return 0; |
| 270 | IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; |
| 271 | CFX_RectArray rectArray; |
| 272 | pageLink->GetRects(link_index, rectArray); |
| 273 | return rectArray.GetSize(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 274 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 275 | DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, |
| 276 | int link_index, |
| 277 | int rect_index, |
| 278 | double* left, |
| 279 | double* top, |
| 280 | double* right, |
| 281 | double* bottom) { |
| 282 | if (!link_page) |
| 283 | return; |
| 284 | IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; |
| 285 | CFX_RectArray rectArray; |
| 286 | pageLink->GetRects(link_index, rectArray); |
| 287 | if (rect_index >= 0 && rect_index < rectArray.GetSize()) { |
| 288 | CFX_FloatRect rect = rectArray.GetAt(rect_index); |
| 289 | *left = rect.left; |
| 290 | *right = rect.right; |
| 291 | *top = rect.top; |
| 292 | *bottom = rect.bottom; |
| 293 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 294 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 295 | DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) { |
| 296 | delete (IPDF_LinkExtract*)link_page; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 297 | } |