OrgChart
OrgChart copied to clipboard
Issue in exporting PDF
- While exporting PDF, some child nodes that are on the right side are not getting printed in PDF. I have tried inline css also and other option but it is not working.
$('#export-pdf').on('click', function () { exportFullChart('pdf'); }); function exportFullChart(type = 'png') { const $originalContainer = $('#chart-container'); const originalStyle = $originalContainer.attr('style') || ''; const companyName = '@Model.CurrentCompany.OrganisationName'; const exportName = companyName.replace(/\s+/g, '_') + '_OrgChart';
// Clone the DOM node only const $clonedContainer = $originalContainer.clone(); const $offscreenWrapper = $('
')
.css({
position: 'absolute',
top: '-9999px',
left: '-9999px',
width: $originalContainer.outerWidth(),
height: 'auto',
overflow: 'visible',
})
.append($clonedContainer)
.appendTo('body');
setTimeout(() => { orgChartInstance.export(exportName, type); $offscreenWrapper.remove(); }, 500); } 2. While exporting PDf, some extra white space is coming in the right side