Skip to content

Commit 61bb961

Browse files
1010807: Resolved staging errors respect to styles
1 parent 8cdad3a commit 61bb961

2 files changed

Lines changed: 64 additions & 33 deletions

File tree

Document-Processing/PDF/PDF-Viewer/react/how-to/existing-react-layout.md

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
2121

2222
Basic div:
2323

24-
```ts
25-
// App.tsx
24+
{% tabs %}
25+
{% highlight ts tabtitle="App.tsx" %}
26+
{% raw %}
2627
import React from 'react';
2728
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, Annotation, TextSearch, FormFields, FormDesigner, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';
2829

@@ -40,13 +41,17 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
4041
</div>
4142
);
4243
}
43-
```
44+
{% endraw %}
45+
{% endhighlight %}
46+
{% endtabs %}
47+
4448
![PDF Viewer in div](../images/react-layouts-div.png)
4549

4650
Flex container: keep `minHeight: 0` on flex children so the viewer can shrink/grow correctly:
4751

48-
```ts
49-
// App.tsx
52+
{% tabs %}
53+
{% highlight ts tabtitle="App.tsx" %}
54+
{% raw %}
5055
import React from 'react';
5156
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, Annotation, TextSearch, FormFields, FormDesigner, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';
5257

@@ -69,13 +74,17 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
6974
</div>
7075
);
7176
}
72-
```
77+
{% endraw %}
78+
{% endhighlight %}
79+
{% endtabs %}
80+
7381
![PDF Viewer in Flex box](../images/react-layouts-flexbox.png)
7482

7583
CSS Grid - reserve rows/columns using `grid-template-rows` or `grid-template-columns`:
7684

77-
```ts
78-
// App.tsx
85+
{% tabs %}
86+
{% highlight ts tabtitle="App.tsx" %}
87+
{% raw %}
7988
import React from 'react';
8089
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, TextSearch, Annotation, FormDesigner, FormFields, Inject } from '@syncfusion/ej2-react-pdfviewer';
8190

@@ -151,14 +160,18 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
151160
minHeight: 0 // critical so the viewer can grow/shrink
152161
}
153162
};
154-
```
163+
{% endraw %}
164+
{% endhighlight %}
165+
{% endtabs %}
166+
155167
![PDF Viewer in grid](../images/react-layouts-grid.png)
156168

157169
- **Use viewer inside Tab components**
158170
- The react PDF Viewer are also supported inside Syncfusion tab components.
159171

160-
```ts
161-
// App.tsx
172+
{% tabs %}
173+
{% highlight ts tabtitle="App.tsx" %}
174+
{% raw %}
162175
import React, { useRef } from 'react';
163176
import { TabComponent, TabItemsDirective, TabItemDirective } from '@syncfusion/ej2-react-navigations';
164177
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, TextSearch, Annotation, FormDesigner, FormFields, Inject } from '@syncfusion/ej2-react-pdfviewer';
@@ -224,14 +237,18 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
224237
</div>
225238
);
226239
};
227-
```
240+
{% endraw %}
241+
{% endhighlight %}
242+
{% endtabs %}
243+
228244
![PDF Viewer in tab](../images/react-layouts-tab.png)
229245

230246
- **Use viewer inside Dialog**
231247
- 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.
232248

233-
```ts
234-
// App.tsx
249+
{% tabs %}
250+
{% highlight ts tabtitle="App.tsx" %}
251+
{% raw %}
235252
import React, { useRef, useCallback } from 'react';
236253
import { DialogComponent } from '@syncfusion/ej2-react-popups';
237254
import {
@@ -295,14 +312,18 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
295312
</div>
296313
);
297314
};
298-
```
315+
{% endraw %}
316+
{% endhighlight %}
317+
{% endtabs %}
318+
299319
![PDF Viewer in dialog](../images/react-layouts-dialog.png)
300320

301321
- **Use viewer inside Collapsible sections**
302322
- 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.
303323

304-
```ts
305-
// App.tsx
324+
{% tabs %}
325+
{% highlight ts tabtitle="App.tsx" %}
326+
{% raw %}
306327
import React, { useCallback, useRef } from 'react';
307328
import {
308329
AccordionComponent, AccordionItemsDirective, AccordionItemDirective, ExpandEventArgs
@@ -382,9 +403,10 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
382403
</div>
383404
);
384405
};
385-
```
386-
```css
387-
/* App.css */
406+
{% endraw %}
407+
{% endhighlight %}
408+
{% highlight css tabtitle="App.css" %}
409+
{% raw %}
388410
.page {
389411
height: 100vh;
390412
display: grid;
@@ -398,7 +420,10 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
398420
background: #fff;
399421
border-bottom: 1px solid #e5e5e5;
400422
}
401-
```
423+
{% endraw %}
424+
{% endhighlight %}
425+
{% endtabs %}
426+
402427
![PDF Viewer in accordion](../images/react-layouts-accordion.png)
403428

404429
## Why visibility and height matter
@@ -412,12 +437,12 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
412437
- Short patterns:
413438
- Dispatch a global resize right after the container becomes visible:
414439

415-
```ts
440+
```js
416441
setTimeout(() => window.dispatchEvent(new Event('resize')), 0);
417442
```
418443
- Use a `ResizeObserver` when the host size may change frequently:
419444

420-
```ts
445+
```js
421446
const observer = new ResizeObserver(() => {
422447
window.dispatchEvent(new Event('resize'));
423448
});

Document-Processing/PDF/PDF-Viewer/react/theming-and-styling.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ Below is an approach that can be copied into the app that switches themes by dyn
7878

7979
**Link-swap approach:**
8080

81-
```ts
82-
// App.tsx
81+
{% tabs %}
82+
{% highlight ts tabtitle="App.tsx" %}
83+
{% raw %}
8384
type ThemeName = 'material3' | 'material3-dark';
8485
const THEME_LINK_ID = 'e-current-theme';
8586
function applyTheme(theme: ThemeName) {
@@ -127,7 +128,9 @@ export function App() {
127128
</div>
128129
</div>);
129130
}
130-
```
131+
{% endraw %}
132+
{% endhighlight %}
133+
{% endtabs %}
131134

132135
## Custom Styles
133136

@@ -143,8 +146,9 @@ While built-in themes provide a comprehensive look and feel, you might need to a
143146

144147
Apply overrides using a wrapper class so the rules are scoped and safe to maintain. The following example adds custom styles to signature form fields:
145148

146-
```css
147-
/* App.css */
149+
{% tabs %}
150+
{% highlight css tabtitle="App.css" %}
151+
{% raw %}
148152
/* This rule sets a scoped, custom black background for the PDF viewer page container */
149153
.e-custom-style .e-pv-page-container {
150154
background: #0b1220;
@@ -176,10 +180,10 @@ Apply overrides using a wrapper class so the rules are scoped and safe to mainta
176180
height: 100% !important;
177181
text-align: center !important;
178182
}
179-
```
180-
181-
```ts
182-
// src/App.tsx
183+
{% endraw %}
184+
{% endhighlight %}
185+
{% highlight ts tabtitle="App.tsx" %}
186+
{% raw %}
183187
import './App.css';
184188
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, Annotation, TextSearch, FormFields, FormDesigner, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';
185189

@@ -196,7 +200,9 @@ export function App() {
196200
</div>
197201
);
198202
}
199-
```
203+
{% endraw %}
204+
{% endhighlight %}
205+
{% endtabs %}
200206

201207
![Viewer background and signature fields example](images/styling-siganture-page-container.png)
202208

0 commit comments

Comments
 (0)