{"id":107,"date":"2026-04-24T07:52:16","date_gmt":"2026-04-24T07:52:16","guid":{"rendered":"https:\/\/ompdf.com\/?page_id=107"},"modified":"2026-04-25T06:12:28","modified_gmt":"2026-04-25T06:12:28","slug":"invert-pdf","status":"publish","type":"page","link":"https:\/\/ompdf.com\/?page_id=107","title":{"rendered":"Invert PDF"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"107\" class=\"elementor elementor-107\">\n\t\t\t\t<div class=\"elementor-element elementor-element-10c30cb0 e-flex e-con-boxed e-con e-parent\" data-id=\"10c30cb0\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-3eae15da elementor-widget elementor-widget-text-editor\" data-id=\"3eae15da\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<title>Invert PDF Colors<\/title>\n\n<style>\nbody {\n    background:#000;\n    color:#fff;\n    font-family:Arial, sans-serif;\n    padding:20px;\n}\n.container {\n    max-width:600px;\n    margin:auto;\n    border:1px solid #333;\n    padding:20px;\n    border-radius:8px;\n    background:#111;\n}\ninput[type=\"file\"] {\n    width:100%;\n    margin-bottom:15px;\n}\nbutton {\n    width:100%;\n    padding:12px;\n    background:#1e90ff;\n    border:none;\n    border-radius:5px;\n    color:white;\n    font-size:16px;\n    cursor:pointer;\n}\nbutton:disabled {\n    background:#555;\n}\n.progress-container {\n    margin-top:15px;\n    background:#222;\n    height:20px;\n    border-radius:10px;\n    overflow:hidden;\n}\n.progress-bar {\n    height:100%;\n    width:0%;\n    background:#00ff99;\n    transition:width 0.2s;\n}\n.status {\n    margin-top:10px;\n    text-align:center;\n    font-size:14px;\n}\n.downloads a {\n    display:block;\n    color:#00ffcc;\n    margin-top:8px;\n    text-decoration:none;\n}\n<\/style>\n\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/pdf.js\/3.11.174\/pdf.min.js\"><\/script>\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jspdf\/2.5.1\/jspdf.umd.min.js\"><\/script>\n<\/head>\n\n<body>\n\n<div class=\"container\">\n<h2>Invert PDF (Black \u2192 White)<\/h2>\n\n<input type=\"file\" id=\"pdfInput\" accept=\"application\/pdf\" multiple>\n\n<button onclick=\"processPDFs()\">Convert PDF<\/button>\n\n<div class=\"progress-container\">\n<div class=\"progress-bar\" id=\"progressBar\"><\/div>\n<\/div>\n\n<div class=\"status\" id=\"statusText\">Waiting for files\u2026<\/div>\n\n<div class=\"downloads\" id=\"downloadLinks\"><\/div>\n<\/div>\n\n<script>\nconst { jsPDF } = window.jspdf;\npdfjsLib.GlobalWorkerOptions.workerSrc =\n'https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/pdf.js\/3.11.174\/pdf.worker.min.js';\n\nasync function processPDFs() {\n    const files = document.getElementById('pdfInput').files;\n    if (!files.length) return alert(\"Select PDF files\");\n\n    document.getElementById(\"downloadLinks\").innerHTML = \"\";\n    const totalFiles = files.length;\n    let completed = 0;\n\n    for (const file of files) {\n        await processSinglePDF(file, progress => {\n            const base = completed \/ totalFiles * 100;\n            const portion = progress \/ totalFiles;\n            updateProgress(base + portion);\n        });\n        completed++;\n    }\n    updateProgress(100);\n    document.getElementById(\"statusText\").innerText = \"All files converted \u2714\";\n}\n\nasync function processSinglePDF(file, progressCallback) {\n    const arrayBuffer = await file.arrayBuffer();\n    const pdf = await pdfjsLib.getDocument({ data: arrayBuffer }).promise;\n\n    const pdfOut = new jsPDF({ unit:\"pt\", compress:true });\n\n    for (let i = 1; i <= pdf.numPages; i++) {\n        const page = await pdf.getPage(i);\n        const viewport = page.getViewport({ scale:2 });\n\n        const canvas = document.createElement(\"canvas\");\n        const ctx = canvas.getContext(\"2d\");\n        canvas.width = viewport.width;\n        canvas.height = viewport.height;\n\n        await page.render({ canvasContext:ctx, viewport }).promise;\n\n        const imgData = ctx.getImageData(0,0,canvas.width,canvas.height);\n        const d = imgData.data;\n\n        for (let j = 0; j < d.length; j += 4) {\n            d[j] = 255 - d[j];     \n            d[j+1] = 255 - d[j+1]; \n            d[j+2] = 255 - d[j+2]; \n        }\n        ctx.putImageData(imgData,0,0);\n\n        if (i > 1) pdfOut.addPage([viewport.width, viewport.height]);\n\n        pdfOut.addImage(\n            canvas.toDataURL(\"image\/jpeg\",1.0),\n            \"JPEG\",\n            0,0,\n            viewport.width,\n            viewport.height\n        );\n\n        progressCallback((i \/ pdf.numPages) * 100);\n    }\n\n    const blobUrl = pdfOut.output(\"bloburl\");\n    const link = document.createElement(\"a\");\n    link.href = blobUrl;\n    link.download = file.name.replace(\".pdf\",\"-inverted.pdf\");\n    link.innerText = \"Download \" + link.download;\n    document.getElementById(\"downloadLinks\").appendChild(link);\n}\n\nfunction updateProgress(percent){\n    document.getElementById(\"progressBar\").style.width = percent + \"%\";\n    document.getElementById(\"statusText\").innerText =\n    \"Progress: \" + Math.round(percent) + \"%\";\n}\n<\/script>\n\n<\/body>\n<\/html>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Invert PDF Colors Invert PDF (Black \u2192 White) Convert PDF Waiting for files\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-107","page","type-page","status-publish","hentry"],"aioseo_notices":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Invert PDF - OM PDF<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ompdf.com\/?page_id=107\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Invert PDF - OM PDF\" \/>\n<meta property=\"og:description\" content=\"Invert PDF Colors Invert PDF (Black \u2192 White) Convert PDF Waiting for files\u2026\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ompdf.com\/?page_id=107\" \/>\n<meta property=\"og:site_name\" content=\"OM PDF\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-25T06:12:28+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ompdf.com\\\/?page_id=107\",\"url\":\"https:\\\/\\\/ompdf.com\\\/?page_id=107\",\"name\":\"Invert PDF - OM PDF\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ompdf.com\\\/#website\"},\"datePublished\":\"2026-04-24T07:52:16+00:00\",\"dateModified\":\"2026-04-25T06:12:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ompdf.com\\\/?page_id=107#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ompdf.com\\\/?page_id=107\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ompdf.com\\\/?page_id=107#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ompdf.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Invert PDF\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ompdf.com\\\/#website\",\"url\":\"https:\\\/\\\/ompdf.com\\\/\",\"name\":\"OM PDF\",\"description\":\"Study Material for All Competitive Exams.\",\"publisher\":{\"@id\":\"https:\\\/\\\/ompdf.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ompdf.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/ompdf.com\\\/#organization\",\"name\":\"OM PDF\",\"url\":\"https:\\\/\\\/ompdf.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ompdf.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/ompdf.com\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-Final-Logo.png\",\"contentUrl\":\"https:\\\/\\\/ompdf.com\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-Final-Logo.png\",\"width\":766,\"height\":641,\"caption\":\"OM PDF\"},\"image\":{\"@id\":\"https:\\\/\\\/ompdf.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Invert PDF - OM PDF","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ompdf.com\/?page_id=107","og_locale":"en_US","og_type":"article","og_title":"Invert PDF - OM PDF","og_description":"Invert PDF Colors Invert PDF (Black \u2192 White) Convert PDF Waiting for files\u2026","og_url":"https:\/\/ompdf.com\/?page_id=107","og_site_name":"OM PDF","article_modified_time":"2026-04-25T06:12:28+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/ompdf.com\/?page_id=107","url":"https:\/\/ompdf.com\/?page_id=107","name":"Invert PDF - OM PDF","isPartOf":{"@id":"https:\/\/ompdf.com\/#website"},"datePublished":"2026-04-24T07:52:16+00:00","dateModified":"2026-04-25T06:12:28+00:00","breadcrumb":{"@id":"https:\/\/ompdf.com\/?page_id=107#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ompdf.com\/?page_id=107"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ompdf.com\/?page_id=107#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ompdf.com\/"},{"@type":"ListItem","position":2,"name":"Invert PDF"}]},{"@type":"WebSite","@id":"https:\/\/ompdf.com\/#website","url":"https:\/\/ompdf.com\/","name":"OM PDF","description":"Study Material for All Competitive Exams.","publisher":{"@id":"https:\/\/ompdf.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ompdf.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ompdf.com\/#organization","name":"OM PDF","url":"https:\/\/ompdf.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ompdf.com\/#\/schema\/logo\/image\/","url":"https:\/\/ompdf.com\/wp-content\/uploads\/2026\/04\/cropped-Final-Logo.png","contentUrl":"https:\/\/ompdf.com\/wp-content\/uploads\/2026\/04\/cropped-Final-Logo.png","width":766,"height":641,"caption":"OM PDF"},"image":{"@id":"https:\/\/ompdf.com\/#\/schema\/logo\/image\/"}}]}},"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ompdf.com\/index.php?rest_route=\/wp\/v2\/pages\/107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ompdf.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ompdf.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ompdf.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ompdf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=107"}],"version-history":[{"count":20,"href":"https:\/\/ompdf.com\/index.php?rest_route=\/wp\/v2\/pages\/107\/revisions"}],"predecessor-version":[{"id":133,"href":"https:\/\/ompdf.com\/index.php?rest_route=\/wp\/v2\/pages\/107\/revisions\/133"}],"wp:attachment":[{"href":"https:\/\/ompdf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}