You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Viewer/react/context-menu/custom-context-menu.md
+1-9Lines changed: 1 addition & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,8 +22,7 @@ You can add custom options to the context menu using the [addCustomMenu()](https
22
22
2. Call the [`addCustomMenu`](https://ej2.syncfusion.com/react/documentation/api/pdfviewer#addcustommenu) method within the [`documentLoad`](https://ej2.syncfusion.com/react/documentation/api/pdfviewer#documentload) event handler.
23
23
24
24
```js
25
-
exportfunctionApp() {
26
-
25
+
exportfunctionApp() {
27
26
let menuItems = [
28
27
{
29
28
text:'Search In Google',
@@ -55,7 +54,6 @@ You can add custom options to the context menu using the [addCustomMenu()](https
55
54
var viewer =document.getElementById('container').ej2_instances[0];
56
55
viewer.addCustomMenu(menuItems, false);
57
56
}
58
-
59
57
return (
60
58
<div>
61
59
<div className='control-section'>
@@ -223,19 +221,13 @@ The following is the output of the custom context menu with customization.
223
221
224
222
{% tabs %}
225
223
{% highlight js tabtitle="index.jsx" %}
226
-
{% raw %}
227
224
{% include code-snippet/pdfviewer/react/custom-context-menu/app/index.jsx %}
228
-
{% endraw %}
229
225
{% endhighlight %}
230
226
{% highlight ts tabtitle="index.tsx" %}
231
-
{% raw %}
232
227
{% include code-snippet/pdfviewer/react/custom-context-menu/app/index.tsx %}
233
-
{% endraw %}
234
228
{% endhighlight %}
235
229
{% endtabs %}
236
230
237
231
N> To set up the **server-backed PDF Viewer**, add the following `serviceUrl` within the <div> element in either the `index.TSX` or `index.JSX` file: **serviceUrl="https://document.syncfusion.com/web-services/pdf-viewer/api/pdfviewer"**.
@@ -224,14 +237,18 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
224
237
</div>
225
238
);
226
239
};
227
-
```
240
+
{% endraw %}
241
+
{% endhighlight %}
242
+
{% endtabs %}
243
+
228
244

229
245
230
246
-**Use viewer inside Dialog**
231
247
- If the viewer sits inside a dialog, for example Syncfusion Dialog, render or initialize the viewer after the dialog open events. The DOM must be visible for the viewer to measure layout.
232
248
233
-
```ts
234
-
// App.tsx
249
+
{% tabs %}
250
+
{% highlight ts tabtitle="App.tsx" %}
251
+
{% raw %}
235
252
import React, { useRef, useCallback } from 'react';
236
253
import { DialogComponent } from '@syncfusion/ej2-react-popups';
237
254
import {
@@ -295,14 +312,18 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
295
312
</div>
296
313
);
297
314
};
298
-
```
315
+
{% endraw %}
316
+
{% endhighlight %}
317
+
{% endtabs %}
318
+
299
319

300
320
301
321
-**Use viewer inside Collapsible sections**
302
322
- For accordions or collapsible containers, either render the viewer lazily when the section expands or dispatch the resize event after expansion so the viewer can recompute layout.
303
323
304
-
```ts
305
-
// App.tsx
324
+
{% tabs %}
325
+
{% highlight ts tabtitle="App.tsx" %}
326
+
{% raw %}
306
327
import React, { useCallback, useRef } from 'react';
0 commit comments