@@ -10,6 +10,7 @@ import { SVGRootContainer } from '../1d-2d/components/SVGRootContainer.js';
1010import Viewer2D from '../2d/Viewer2D.js' ;
1111import { useChartData } from '../context/ChartContext.js' ;
1212import { useExportSettings } from '../elements/export/index.js' ;
13+ import { usePrintPage } from '../elements/print/PrintProvider.tsx' ;
1314import {
1415 useCheckExportStatus ,
1516 useViewportSize ,
@@ -33,13 +34,26 @@ export function NMRiumViewer(props: NMRiumViewerProps) {
3334 const viewPort = useViewportSize ( ) ;
3435 const { displayerMode } = useChartData ( ) ;
3536 const exportSettings = useExportSettings ( ) ;
37+ const printSettings = usePrintPage ( ) ;
3638
3739 useOnRender ( onRender ) ;
3840
3941 const isExportingProcessStart = useCheckExportStatus ( ) ;
4042
41- if ( isExportingProcessStart && exportSettings ) {
42- const { width, height, exportHeight, exportWidth } = exportSettings ;
43+ if ( isExportingProcessStart && ( exportSettings || printSettings ) ) {
44+ if ( ! exportSettings && ! printSettings ) {
45+ return < text > Print/export settings are missing.</ text > ;
46+ }
47+
48+ const { width, height } = exportSettings || printSettings || { } ;
49+ let exportHeight = height ;
50+ let exportWidth = width ;
51+
52+ if ( exportSettings ) {
53+ exportHeight = exportSettings . exportHeight ;
54+ exportWidth = exportSettings . exportWidth ;
55+ }
56+
4357 return (
4458 < SVGRootContainer
4559 enableBoxBorder = { displayerMode === '2D' }
0 commit comments