Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thai characters are overlapping in pdf #696

Open
janellepascual opened this issue Jun 4, 2024 · 0 comments
Open

Thai characters are overlapping in pdf #696

janellepascual opened this issue Jun 4, 2024 · 0 comments

Comments

@janellepascual
Copy link

janellepascual commented Jun 4, 2024

here is the code for generating pdf

var generatePDF = function() {
        $('.generate-pdf').on('click', function () {
            KTApp.blockPage({
                overlayColor: '#000000',
                state: 'primary',
                message: 'Processing...'
            });

            // Call cloneResult and wait for it to finish before proceeding
            cloneResult().then(function() {
                var elementPDF = document.getElementById('clone-pdf');
                var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
                var scale = isMobile ? 1 : 1.8; // Use scale 1 for mobile, 2 for non-mobile
                var quality = isMobile ? 0.30 : 0.50;

          
                    var opt = {
                        margin: 0.3,
                        filename: 'result.pdf',
                        image: { type: 'jpeg', quality: quality },
                        html2canvas: {
//                            letterRendering: true,
                            useCORS: true,
                            scale: scale,
                            backgroundColor: '#fff',
                            ignoreElements: function (element) {
                                if (element.classList.contains('generate-pdf')) {
                                    return true;
                                }
                            },
                            onclone: function(documentClone) {
                               
                            }
                        },
                        jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait', compress: true },
                        pagebreak: { mode: 'css' }
                    };

                    // New Promise-based usage:
                    html2pdf().set(opt).from(elementPDF).save().then(function() {
                        $('#clone-pdf').remove();
                        KTApp.unblockPage();
                        $('.html2pdf__overlay').remove();
                    });
              
            }).catch(function(error) {
                // Handle any errors that occurred during cloneResult
                console.error('Error during cloneResult:', error);
                KTApp.unblockPage();
            });
        });
    }

here is the sample of overlapping thai characters
5(1)
image (8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant