{"id":1295,"date":"2025-03-13T16:23:23","date_gmt":"2025-03-13T10:53:23","guid":{"rendered":"https:\/\/shoptips24.com\/tools\/?page_id=1295"},"modified":"2025-03-13T16:23:47","modified_gmt":"2025-03-13T10:53:47","slug":"pdf-to-csv","status":"publish","type":"page","link":"https:\/\/shoptips24.com\/tools\/pdf-to-csv\/","title":{"rendered":"PDF TO CSV"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>PDF to CSV Converter<\/title>\n    <style>\n        body {\n            font-family: Arial, sans-serif;\n            display: flex;\n            flex-direction: column;\n            align-items: center;\n            margin: 0;\n            padding: 20px;\n        }\n        .container {\n            text-align: center;\n            margin-top: 20px;\n            padding: 20px;\n            border: 1px solid #ccc;\n            border-radius: 10px;\n            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n        }\n        input {\n            margin: 10px 0;\n            padding: 10px;\n            width: 100%;\n            box-sizing: border-box;\n        }\n        button {\n            padding: 10px 20px;\n            background-color: #007BFF;\n            color: #fff;\n            border: none;\n            border-radius: 5px;\n            cursor: pointer;\n        }\n        button:hover {\n            background-color: #0056b3;\n        }\n    <\/style>\n<\/head>\n<body>\n    <h1>PDF to CSV Converter<\/h1>\n    <div class=\"container\">\n        <input type=\"file\" id=\"pdfFile\" accept=\"application\/pdf\">\n        <button onclick=\"convertPDF()\">Convert PDF to CSV<\/button>\n    <\/div>\n    <div id=\"csvContent\" style=\"display: none;\"><\/div>\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/pdf.js\/2.10.377\/pdf.min.js\"><\/script>\n    <script>\n        function convertPDF() {\n            const pdfFile = document.getElementById('pdfFile').files[0];\n            if (pdfFile) {\n                const fileReader = new FileReader();\n                fileReader.onload = function() {\n                    const typedarray = new Uint8Array(this.result);\n                    pdfjsLib.getDocument(typedarray).promise.then(function(pdf) {\n                        let fullText = '';\n                        const totalPages = pdf.numPages;\n                        const promises = [];\n                        for (let pageNum = 1; pageNum <= totalPages; pageNum++) {\n                            promises.push(pdf.getPage(pageNum).then(function(page) {\n                                return page.getTextContent().then(function(textContent) {\n                                    const textItems = textContent.items.map(item => item.str);\n                                    fullText += textItems.join(',') + '\\n';\n                                });\n                            }));\n                        }\n                        Promise.all(promises).then(() => {\n                            document.getElementById('csvContent').innerText = fullText;\n                            downloadCSV(fullText);\n                        });\n                    });\n                };\n                fileReader.readAsArrayBuffer(pdfFile);\n            } else {\n                alert('Please select a PDF file.');\n            }\n        }\n\n        function downloadCSV(csvContent) {\n            const blob = new Blob([csvContent], { type: 'text\/csv' });\n            const link = document.createElement('a');\n            link.href = URL.createObjectURL(blob);\n            link.download = 'converted.csv';\n            document.body.appendChild(link);\n            link.click();\n            document.body.removeChild(link);\n        }\n    <\/script>\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>PDF to CSV Converter PDF to CSV Converter Convert PDF to CSV<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1295","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/pages\/1295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/comments?post=1295"}],"version-history":[{"count":1,"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/pages\/1295\/revisions"}],"predecessor-version":[{"id":1296,"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/pages\/1295\/revisions\/1296"}],"wp:attachment":[{"href":"https:\/\/shoptips24.com\/tools\/wp-json\/wp\/v2\/media?parent=1295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}