<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Arquivos escrever em pdf online - Web-Zoneware</title>
	<atom:link href="https://webzoneware.com/tag/escrever-em-pdf-online/feed/" rel="self" type="application/rss+xml" />
	<link>https://webzoneware.com/tag/escrever-em-pdf-online/</link>
	<description>Mais do que apenas uma academia web.</description>
	<lastBuildDate>Thu, 22 Oct 2026 17:22:01 +0000</lastBuildDate>
	<language>pt-BR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://webzoneware.com/wp-content/uploads/icon-webzoneware-150x150.png</url>
	<title>Arquivos escrever em pdf online - Web-Zoneware</title>
	<link>https://webzoneware.com/tag/escrever-em-pdf-online/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Editor e Anotador de PDF Online — Desenhar, Realçar e Escrever &#124; Web-ZoneWare</title>
		<link>https://webzoneware.com/web-ferramentas/pdf/editor-anotador-pdf/</link>
					<comments>https://webzoneware.com/web-ferramentas/pdf/editor-anotador-pdf/#respond</comments>
		
		<dc:creator><![CDATA[Web-Zoneware]]></dc:creator>
		<pubDate>Sun, 18 Oct 2026 01:15:05 +0000</pubDate>
				<category><![CDATA[PDF & Documentos]]></category>
		<category><![CDATA[anotar em pdf online]]></category>
		<category><![CDATA[desenhar no pdf]]></category>
		<category><![CDATA[escrever em pdf online]]></category>
		<category><![CDATA[marca texto em pdf]]></category>
		<guid isPermaLink="false">https://webzoneware.com/?p=29074</guid>

					<description><![CDATA[<p>Desenhe, Destaque Informações e Insira Carimbos com Precisão Revisar contratos e trabalhos acadêmicos exige flexibilidade para fazer anotações rápidas à mão livre, sublinhar trechos vitais com marca-texto e validar fluxos operacionais com carimbos visíveis. Nossa suíte de edição oferece controle detalhado de cores, espessuras e uma biblioteca completa de carimbos corporativos (como APROVADO, REPROVADO, VISTO [&#8230;]</p>
<p>O post <a href="https://webzoneware.com/web-ferramentas/pdf/editor-anotador-pdf/">Editor e Anotador de PDF Online — Desenhar, Realçar e Escrever | Web-ZoneWare</a> apareceu primeiro em <a href="https://webzoneware.com">Web-Zoneware</a>.</p>
]]></description>
										<content:encoded><![CDATA[<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Como inserir carimbos corporativos no PDF?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Selecione a ferramenta de Carimbo na barra superior, escolha o modelo desejado (Aprovado, Reprovado, Visto, Confidencial, etc.) e clique no local da página onde deseja aplicar o carimbo."
      }
    },
    {
      "@type": "Question",
      "name": "As anotações e desenhos ficam gravados de forma permanente no arquivo final?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Sim. Ao clicar em Salvar e Baixar PDF, todas as camadas desenhadas, carimbos e textos são embutidos como camadas gráficas de alta resolução nas páginas do documento original."
      }
    }
  ]
}
</script>

    <div id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c" class="wzw-tool-container wzw-pdf-suite-wrapper">
        <style>
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c {
                background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
                color: #f8fafc;
                border-radius: 16px;
                padding: 24px;
                box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
                border: 1px solid #334155;
                font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
                margin: 20px 0 35px 0;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c * {
                box-sizing: border-box;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-tool-header {
                display: flex;
                align-items: center;
                justify-content: space-between;
                flex-wrap: wrap;
                gap: 12px;
                margin-bottom: 20px;
                padding-bottom: 16px;
                border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-tool-title {
                margin: 0;
                font-size: 1.35rem;
                font-weight: 800;
                color: #8b5cf6;
                display: flex;
                align-items: center;
                gap: 10px;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-badge-client {
                background: rgba(139, 92, 246, 0.15);
                color: #a78bfa;
                border: 1px solid rgba(139, 92, 246, 0.35);
                padding: 4px 10px;
                border-radius: 20px;
                font-size: 11px;
                font-weight: 700;
                text-transform: uppercase;
                letter-spacing: 0.5px;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-dropzone {
                border: 2px dashed #8b5cf6;
                background: rgba(139, 92, 246, 0.05);
                border-radius: 14px;
                padding: 44px 20px;
                text-align: center;
                cursor: pointer;
                transition: all 0.25s ease;
                margin-bottom: 20px;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-dropzone:hover,
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-dropzone.drag-over {
                background: rgba(139, 92, 246, 0.12);
                border-color: #a78bfa;
                transform: translateY(-2px);
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-drop-icon {
                font-size: 48px;
                margin-bottom: 12px;
                display: block;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-drop-title {
                font-size: 1.15rem;
                font-weight: 700;
                color: #f1f5f9;
                margin: 0 0 6px 0;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-drop-sub {
                font-size: 13px;
                color: #94a3b8;
                margin: 0;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-workspace {
                display: none;
                margin-top: 15px;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-editor-toolbar {
                background: #0f172a;
                border: 1px solid #334155;
                border-radius: 12px;
                padding: 12px 16px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                flex-wrap: wrap;
                gap: 12px;
                margin-bottom: 16px;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-tool-group {
                display: flex;
                align-items: center;
                gap: 8px;
                flex-wrap: wrap;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-tool-btn {
                background: #1e293b;
                color: #cbd5e1;
                border: 1px solid #475569;
                border-radius: 8px;
                padding: 8px 12px;
                font-size: 13px;
                font-weight: 600;
                cursor: pointer;
                transition: all 0.2s ease;
                display: inline-flex;
                align-items: center;
                gap: 6px;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-tool-btn:hover {
                background: #334155;
                color: #f8fafc;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-tool-btn.active {
                background: #8b5cf6;
                color: #ffffff;
                border-color: #8b5cf6;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-canvas-container {
                position: relative;
                margin: 0 auto 20px auto;
                background: #000;
                border: 1px solid #334155;
                border-radius: 10px;
                overflow: hidden;
                display: flex;
                justify-content: center;
                box-shadow: 0 8px 25px rgba(0,0,0,0.4);
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-pdf-render-canvas {
                display: block;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-draw-overlay-canvas {
                position: absolute;
                top: 0;
                left: 0;
                cursor: crosshair;
                touch-action: none;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-nav-bar {
                display: flex;
                align-items: center;
                justify-content: center;
                gap: 15px;
                margin-bottom: 20px;
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-action-btn {
                background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
                color: #ffffff;
                border: none;
                border-radius: 12px;
                padding: 16px 28px;
                font-size: 16px;
                font-weight: 800;
                cursor: pointer;
                transition: all 0.25s ease;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                gap: 10px;
                width: 100%;
                box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-action-btn:hover:not(:disabled) {
                background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
                transform: translateY(-2px);
                box-shadow: 0 6px 22px rgba(139, 92, 246, 0.6);
            }
            #wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c .wzw-action-btn:disabled {
                opacity: 0.5;
                cursor: not-allowed;
            }
        </style>

        <div class="wzw-tool-header">
            <h3 class="wzw-tool-title">
                <span>✏️</span> Editor e Anotador de PDF — Desenhe, Realce &amp; Escreva
            </h3>
            <span class="wzw-badge-client">100% Client-Side • Edição Livre</span>
        </div>

        <div class="wzw-dropzone" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_dropzone">
            <span class="wzw-drop-icon">📝</span>
            <p class="wzw-drop-title">Selecione ou arraste seu documento PDF</p>
            <p class="wzw-drop-sub">Desenhe à mão livre, destaque textos com marca-texto, insira anotações e carimbos</p>
            <input type="file" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_file_input" accept="application/pdf" style="display: none;">
        </div>

        <div class="wzw-workspace" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_workspace">
            <div class="wzw-editor-toolbar">
                <div class="wzw-tool-group">
                    <button type="button" class="wzw-tool-btn active" data-tool="pen" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_tool_pen">
                        <span>✏️</span> Pincel
                    </button>
                    <button type="button" class="wzw-tool-btn" data-tool="highlighter" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_tool_highlighter">
                        <span>🖍️</span> Marca-Texto
                    </button>
                    <button type="button" class="wzw-tool-btn" data-tool="text" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_tool_text">
                        <span>🔤</span> Texto
                    </button>
                    <button type="button" class="wzw-tool-btn" data-tool="rect" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_tool_rect">
                        <span>⬛</span> Retângulo
                    </button>
                    <button type="button" class="wzw-tool-btn" data-tool="stamp" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_tool_stamp">
                        <span>🏷️</span> Carimbo
                    </button>
                </div>

                <div class="wzw-tool-group wzw-stamp-group" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_stamp_group" style="display: none; align-items: center; gap: 8px;">
                    <label style="font-size: 12px; color: #a78bfa; font-weight: 700;">Carimbo:</label>
                    <select id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_stamp_select" style="background: #0f172a; color: #f8fafc; border: 1px solid #8b5cf6; border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 700; cursor: pointer;">
                        <option value="APROVADO" data-color="#16a34a" selected>✔ APROVADO</option>
                        <option value="REPROVADO" data-color="#dc2626">✖ REPROVADO</option>
                        <option value="VISTO" data-color="#0284c7">👀 VISTO</option>
                        <option value="REJEITADO" data-color="#b91c1c">❌ REJEITADO</option>
                        <option value="CONFIDENCIAL" data-color="#7c3aed">🔒 CONFIDENCIAL</option>
                        <option value="URGENTE" data-color="#ea580c">⚡ URGENTE</option>
                        <option value="RASCUNHO" data-color="#64748b">📝 RASCUNHO</option>
                        <option value="PAGO" data-color="#059669">💰 PAGO</option>
                        <option value="EM ANÁLISE" data-color="#d97706">⏳ EM ANÁLISE</option>
                        <option value="FINALIZADO" data-color="#2563eb">⭐ FINALIZADO</option>
                        <option value="CUSTOM" data-color="#8b5cf6">✏️ OUTRO (PERSONALIZADO)...</option>
                    </select>
                    <input type="text" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_custom_stamp_text" placeholder="Texto..." style="display: none; background: #0f172a; color: #f8fafc; border: 1px solid #8b5cf6; border-radius: 8px; padding: 5px 8px; font-size: 12px; max-width: 120px; text-transform: uppercase;">
                </div>

                <div class="wzw-tool-group">
                    <label style="font-size: 12px; color: #94a3b8; margin-right: 4px;">Cor:</label>
                    <input type="color" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_color_picker" value="#f59e0b" style="background: none; border: none; width: 32px; height: 32px; cursor: pointer;">
                    
                    <label id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_brush_label" style="font-size: 12px; color: #94a3b8; margin-left: 8px; margin-right: 4px;">Espessura:</label>
                    <select id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_brush_size" style="background: #1e293b; color: #f8fafc; border: 1px solid #475569; border-radius: 6px; padding: 4px 8px; font-size: 12px;">
                        <option value="2">Fina (2px)</option>
                        <option value="5" selected>Média (5px)</option>
                        <option value="12">Grossa (12px)</option>
                        <option value="24">Marca-texto (24px)</option>
                    </select>

                    <button type="button" class="wzw-tool-btn" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_btn_undo" title="Desfazer Última Ação">
                        <span>↩️</span> Desfazer
                    </button>
                    <button type="button" class="wzw-tool-btn" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_btn_clear_page" title="Limpar Anotações Desta Página">
                        <span>🗑️</span> Limpar
                    </button>
                </div>
            </div>

            <div class="wzw-canvas-container" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_canvas_container">
                <canvas class="wzw-pdf-render-canvas" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_pdf_canvas"></canvas>
                <canvas class="wzw-draw-overlay-canvas" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_draw_canvas"></canvas>
            </div>

            <div class="wzw-nav-bar">
                <button type="button" class="wzw-tool-btn" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_btn_prev">◀ Página Anterior</button>
                <span id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_page_indicator" style="font-size: 14px; font-weight: 700; color: #cbd5e1;">Página 1 de 1</span>
                <button type="button" class="wzw-tool-btn" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_btn_next">Próxima Página ▶</button>
            </div>

            <button type="button" class="wzw-action-btn" id="wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_btn_save">
                <span>📥</span> Salvar e Baixar PDF com Anotações
            </button>
        </div>
    </div>

    <script>
    (function() {
        const root = document.getElementById('wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c');
        if (!root) return;

        const dropzone = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_dropzone');
        const fileInput = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_file_input');
        const workspace = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_workspace');
        const container = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_canvas_container');
        const pdfCanvas = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_pdf_canvas');
        const drawCanvas = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_draw_canvas');
        const pageIndicator = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_page_indicator');
        const btnPrev = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_btn_prev');
        const btnNext = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_btn_next');
        const colorPicker = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_color_picker');
        const brushSizeSelect = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_brush_size');
        const brushLabel = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_brush_label');
        const stampGroup = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_stamp_group');
        const stampSelect = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_stamp_select');
        const customStampText = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_custom_stamp_text');
        const btnUndo = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_btn_undo');
        const btnClearPage = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_btn_clear_page');
        const btnSave = root.querySelector('#wzw_editpdf_40c092e3_67cb_48ed_b9ae_0a6143c2b76c_btn_save');

        const toolBtns = root.querySelectorAll('.wzw-tool-btn[data-tool]');

        let originalBuffer = null;
        let pdfDoc = null;
        let totalPages = 0;
        let currentPageNum = 1;
        let originalFileName = 'documento.pdf';

        let currentTool = 'pen';
        let pageAnnotations = {}; // { [pageNum]: Array of actions / paths }

        let isDrawing = false;
        let startX = 0, startY = 0;
        let currentPath = [];

        function setupPdfWorker() {
            if (window.pdfjsLib && !window.pdfjsLib.GlobalWorkerOptions.workerSrc) {
                window.pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.worker.min.js';
            }
        }

        toolBtns.forEach(btn => {
            btn.addEventListener('click', () => {
                toolBtns.forEach(b => b.classList.remove('active'));
                btn.classList.add('active');
                currentTool = btn.getAttribute('data-tool');

                if (currentTool === 'stamp') {
                    if (stampGroup) stampGroup.style.display = 'inline-flex';
                    if (brushLabel) brushLabel.style.display = 'none';
                    if (brushSizeSelect) brushSizeSelect.style.display = 'none';
                    if (stampSelect) {
                        const opt = stampSelect.options[stampSelect.selectedIndex];
                        if (opt && opt.dataset.color) colorPicker.value = opt.dataset.color;
                    }
                } else {
                    if (stampGroup) stampGroup.style.display = 'none';
                    if (brushLabel) brushLabel.style.display = 'inline-block';
                    if (brushSizeSelect) brushSizeSelect.style.display = 'inline-block';
                    if (currentTool === 'highlighter') {
                        brushSizeSelect.value = '24';
                        colorPicker.value = '#facc15';
                    } else if (currentTool === 'pen') {
                        brushSizeSelect.value = '5';
                        colorPicker.value = '#ef4444';
                    }
                }
            });
        });

        if (stampSelect) {
            stampSelect.addEventListener('change', () => {
                if (stampSelect.value === 'CUSTOM') {
                    if (customStampText) {
                        customStampText.style.display = 'inline-block';
                        customStampText.focus();
                    }
                } else {
                    if (customStampText) customStampText.style.display = 'none';
                    const opt = stampSelect.options[stampSelect.selectedIndex];
                    if (opt && opt.dataset.color) colorPicker.value = opt.dataset.color;
                }
            });
        }

        dropzone.addEventListener('click', () => fileInput.click());
        dropzone.addEventListener('dragover', (e) => { e.preventDefault(); dropzone.classList.add('drag-over'); });
        dropzone.addEventListener('dragleave', () => dropzone.classList.remove('drag-over'));
        dropzone.addEventListener('drop', (e) => {
            e.preventDefault();
            dropzone.classList.remove('drag-over');
            if (e.dataTransfer.files && e.dataTransfer.files[0]) handleFile(e.dataTransfer.files[0]);
        });
        fileInput.addEventListener('change', (e) => {
            if (e.target.files && e.target.files[0]) handleFile(e.target.files[0]);
        });

        async function handleFile(file) {
            if (file.type !== 'application/pdf' && !file.name.toLowerCase().endsWith('.pdf')) {
                alert('Selecione um arquivo PDF válido.');
                return;
            }
            originalFileName = file.name;
            setupPdfWorker();

            try {
                originalBuffer = await file.arrayBuffer();
                pdfDoc = await window.pdfjsLib.getDocument({ data: originalBuffer.slice(0) }).promise;
                totalPages = pdfDoc.numPages;
                currentPageNum = 1;
                pageAnnotations = {};

                dropzone.style.display = 'none';
                workspace.style.display = 'block';

                renderCurrentPage();
            } catch (err) {
                console.error(err);
                alert('Erro ao abrir PDF: ' + err.message);
            }
        }

        async function renderCurrentPage() {
            if (!pdfDoc) return;
            pageIndicator.textContent = `Página ${currentPageNum} de ${totalPages}`;
            btnPrev.disabled = (currentPageNum <= 1);
            btnNext.disabled = (currentPageNum >= totalPages);

            const page = await pdfDoc.getPage(currentPageNum);
            const scale = 1.4;
            const viewport = page.getViewport({ scale: scale });

            pdfCanvas.width = viewport.width;
            pdfCanvas.height = viewport.height;
            drawCanvas.width = viewport.width;
            drawCanvas.height = viewport.height;

            container.style.width = viewport.width + 'px';
            container.style.height = viewport.height + 'px';

            const ctxPdf = pdfCanvas.getContext('2d');
            await page.render({ canvasContext: ctxPdf, viewport: viewport }).promise;

            redrawOverlay();
        }

        btnPrev.addEventListener('click', () => {
            if (currentPageNum > 1) {
                currentPageNum--;
                renderCurrentPage();
            }
        });
        btnNext.addEventListener('click', () => {
            if (currentPageNum < totalPages) {
                currentPageNum++;
                renderCurrentPage();
            }
        });

        function redrawOverlay() {
            const ctx = drawCanvas.getContext('2d');
            ctx.clearRect(0, 0, drawCanvas.width, drawCanvas.height);

            const list = pageAnnotations[currentPageNum] || [];
            list.forEach(item => {
                ctx.save();
                if (item.type === 'pen' || item.type === 'highlighter') {
                    ctx.beginPath();
                    ctx.strokeStyle = item.color;
                    ctx.lineWidth = item.size;
                    ctx.lineCap = 'round';
                    ctx.lineJoin = 'round';
                    if (item.type === 'highlighter') {
                        ctx.globalAlpha = 0.4;
                    }
                    item.points.forEach((pt, i) => {
                        if (i === 0) ctx.moveTo(pt.x, pt.y);
                        else ctx.lineTo(pt.x, pt.y);
                    });
                    ctx.stroke();
                } else if (item.type === 'rect') {
                    ctx.strokeStyle = item.color;
                    ctx.lineWidth = item.size;
                    ctx.strokeRect(item.x, item.y, item.w, item.h);
                } else if (item.type === 'text') {
                    ctx.font = 'bold 18px Helvetica, Arial, sans-serif';
                    ctx.fillStyle = item.color;
                    ctx.fillText(item.text, item.x, item.y);
                } else if (item.type === 'stamp') {
                    ctx.save();
                    ctx.translate(item.x, item.y);
                    ctx.rotate(-0.15);
                    ctx.font = 'bold 22px Helvetica, Arial, sans-serif';
                    ctx.fillStyle = item.color;
                    ctx.strokeStyle = item.color;
                    ctx.lineWidth = 3;
                    const textW = ctx.measureText(item.text).width;
                    ctx.strokeRect(-10, -25, textW + 20, 36);
                    ctx.fillText(item.text, 0, 0);
                    ctx.restore();
                }
                ctx.restore();
            });
        }

        function getMousePos(e) {
            const rect = drawCanvas.getBoundingClientRect();
            const clientX = e.touches ? e.touches[0].clientX : e.clientX;
            const clientY = e.touches ? e.touches[0].clientY : e.clientY;
            return {
                x: (clientX - rect.left) * (drawCanvas.width / rect.width),
                y: (clientY - rect.top) * (drawCanvas.height / rect.height)
            };
        }

        drawCanvas.addEventListener('mousedown', startAction);
        drawCanvas.addEventListener('mousemove', moveAction);
        window.addEventListener('mouseup', endAction);

        drawCanvas.addEventListener('touchstart', startAction, { passive: false });
        drawCanvas.addEventListener('touchmove', moveAction, { passive: false });
        window.addEventListener('touchend', endAction);

        function startAction(e) {
            if (e.cancelable) e.preventDefault();
            isDrawing = true;
            const pos = getMousePos(e);
            startX = pos.x;
            startY = pos.y;

            if (currentTool === 'text') {
                isDrawing = false;
                const text = prompt('Digite o texto a ser inserido na página:');
                if (text && text.trim()) {
                    if (!pageAnnotations[currentPageNum]) pageAnnotations[currentPageNum] = [];
                    pageAnnotations[currentPageNum].push({
                        type: 'text',
                        text: text.trim(),
                        x: pos.x,
                        y: pos.y,
                        color: colorPicker.value
                    });
                    redrawOverlay();
                }
                return;
            }

            if (currentTool === 'stamp') {
                isDrawing = false;
                let stampText = stampSelect ? stampSelect.value : 'APROVADO';
                if (stampText === 'CUSTOM') {
                    stampText = (customStampText && customStampText.value ? customStampText.value.trim() : '');
                    if (!stampText) {
                        const customVal = prompt('Digite o texto do carimbo personalizado:', 'APROVADO');
                        if (customVal && customVal.trim()) {
                            stampText = customVal.trim().toUpperCase();
                            if (customStampText) customStampText.value = stampText;
                        } else {
                            return;
                        }
                    }
                }

                if (!pageAnnotations[currentPageNum]) pageAnnotations[currentPageNum] = [];
                pageAnnotations[currentPageNum].push({
                    type: 'stamp',
                    text: stampText.toUpperCase(),
                    x: pos.x,
                    y: pos.y,
                    color: colorPicker.value
                });
                redrawOverlay();
                return;
            }

            if (currentTool === 'pen' || currentTool === 'highlighter') {
                currentPath = [{ x: pos.x, y: pos.y }];
            }
        }

        function moveAction(e) {
            if (!isDrawing) return;
            if (e.cancelable) e.preventDefault();
            const pos = getMousePos(e);

            if (currentTool === 'pen' || currentTool === 'highlighter') {
                currentPath.push({ x: pos.x, y: pos.y });
                const ctx = drawCanvas.getContext('2d');
                ctx.save();
                ctx.strokeStyle = colorPicker.value;
                ctx.lineWidth = parseInt(brushSizeSelect.value, 10);
                ctx.lineCap = 'round';
                ctx.lineJoin = 'round';
                if (currentTool === 'highlighter') ctx.globalAlpha = 0.4;
                ctx.beginPath();
                const p1 = currentPath[currentPath.length - 2];
                const p2 = currentPath[currentPath.length - 1];
                ctx.moveTo(p1.x, p1.y);
                ctx.lineTo(p2.x, p2.y);
                ctx.stroke();
                ctx.restore();
            } else if (currentTool === 'rect') {
                redrawOverlay();
                const ctx = drawCanvas.getContext('2d');
                ctx.save();
                ctx.strokeStyle = colorPicker.value;
                ctx.lineWidth = parseInt(brushSizeSelect.value, 10);
                ctx.strokeRect(startX, startY, pos.x - startX, pos.y - startY);
                ctx.restore();
            }
        }

        function endAction(e) {
            if (!isDrawing) return;
            isDrawing = false;

            if (!pageAnnotations[currentPageNum]) pageAnnotations[currentPageNum] = [];

            if (currentTool === 'pen' || currentTool === 'highlighter') {
                if (currentPath.length > 1) {
                    pageAnnotations[currentPageNum].push({
                        type: currentTool,
                        points: currentPath,
                        color: colorPicker.value,
                        size: parseInt(brushSizeSelect.value, 10)
                    });
                }
                currentPath = [];
            } else if (currentTool === 'rect') {
                const pos = (e.touches && e.touches[0]) ? getMousePos(e) : { x: startX, y: startY };
                // Garante que o retângulo seja salvo com dimensões normalizadas
                pageAnnotations[currentPageNum].push({
                    type: 'rect',
                    x: Math.min(startX, startX + 1),
                    y: Math.min(startY, startY + 1),
                    w: Math.abs(startX - (pos.x || startX + 50)),
                    h: Math.abs(startY - (pos.y || startY + 50)),
                    color: colorPicker.value,
                    size: parseInt(brushSizeSelect.value, 10)
                });
            }
            redrawOverlay();
        }

        btnUndo.addEventListener('click', () => {
            if (pageAnnotations[currentPageNum] && pageAnnotations[currentPageNum].length > 0) {
                pageAnnotations[currentPageNum].pop();
                redrawOverlay();
            }
        });

        btnClearPage.addEventListener('click', () => {
            if (pageAnnotations[currentPageNum] && pageAnnotations[currentPageNum].length > 0) {
                if (confirm('Limpar todas as anotações desta página?')) {
                    pageAnnotations[currentPageNum] = [];
                    redrawOverlay();
                }
            }
        });

        btnSave.addEventListener('click', async () => {
            if (!originalBuffer || typeof PDFLib === 'undefined') return;

            btnSave.disabled = true;
            btnSave.innerHTML = '<span>⏳</span> Consolidando Anotações no PDF...';

            try {
                const { PDFDocument } = PDFLib;
                const pdfLibDoc = await PDFDocument.load(originalBuffer, { ignoreEncryption: true });
                const pages = pdfLibDoc.getPages();

                // Para cada página que possui anotações, renderiza o canvas da anotação em alta resolução e embute
                for (let pNum = 1; pNum <= pages.length; pNum++) {
                    const annots = pageAnnotations[pNum];
                    if (!annots || annots.length === 0) continue;

                    const page = pages[pNum - 1];
                    const { width, height } = page.getSize();

                    // Cria canvas temporário do tamanho exato da página do PDF
                    const tempCanvas = document.createElement('canvas');
                    tempCanvas.width = width * 2;
                    tempCanvas.height = height * 2;
                    const ctx = tempCanvas.getContext('2d');
                    ctx.scale(2, 2);

                    // Escala entre o canvas de exibição (drawCanvas) e a página real
                    const scaleX = width / drawCanvas.width;
                    const scaleY = height / drawCanvas.height;

                    annots.forEach(item => {
                        ctx.save();
                        if (item.type === 'pen' || item.type === 'highlighter') {
                            ctx.beginPath();
                            ctx.strokeStyle = item.color;
                            ctx.lineWidth = item.size * scaleX;
                            ctx.lineCap = 'round';
                            ctx.lineJoin = 'round';
                            if (item.type === 'highlighter') ctx.globalAlpha = 0.4;
                            item.points.forEach((pt, i) => {
                                const px = pt.x * scaleX;
                                const py = pt.y * scaleY;
                                if (i === 0) ctx.moveTo(px, py);
                                else ctx.lineTo(px, py);
                            });
                            ctx.stroke();
                        } else if (item.type === 'rect') {
                            ctx.strokeStyle = item.color;
                            ctx.lineWidth = item.size * scaleX;
                            ctx.strokeRect(item.x * scaleX, item.y * scaleY, item.w * scaleX, item.h * scaleY);
                        } else if (item.type === 'text') {
                            ctx.font = `bold ${18 * scaleX}px Helvetica, Arial, sans-serif`;
                            ctx.fillStyle = item.color;
                            ctx.fillText(item.text, item.x * scaleX, item.y * scaleY);
                        } else if (item.type === 'stamp') {
                            ctx.save();
                            ctx.translate(item.x * scaleX, item.y * scaleY);
                            ctx.rotate(-0.15);
                            ctx.font = `bold ${22 * scaleX}px Helvetica, Arial, sans-serif`;
                            ctx.fillStyle = item.color;
                            ctx.strokeStyle = item.color;
                            ctx.lineWidth = 3 * scaleX;
                            const textW = ctx.measureText(item.text).width;
                            ctx.strokeRect(-10 * scaleX, -25 * scaleY, textW + (20 * scaleX), 36 * scaleY);
                            ctx.fillText(item.text, 0, 0);
                            ctx.restore();
                        }
                        ctx.restore();
                    });

                    const pngUrl = tempCanvas.toDataURL('image/png');
                    const pngBytes = await fetch(pngUrl).then(r => r.arrayBuffer());
                    const pngImage = await pdfLibDoc.embedPng(pngBytes);

                    page.drawImage(pngImage, {
                        x: 0,
                        y: 0,
                        width: width,
                        height: height
                    });
                }

                const pdfBytes = await pdfLibDoc.save();
                const blob = new Blob([pdfBytes], { type: 'application/pdf' });
                const url = URL.createObjectURL(blob);
                const a = document.createElement('a');
                a.href = url;
                a.download = originalFileName.replace(/\.pdf$/i, '') + '-editado.pdf';
                a.click();
                URL.revokeObjectURL(url);
            } catch (err) {
                console.error(err);
                alert('Erro ao salvar PDF: ' + err.message);
            } finally {
                btnSave.disabled = false;
                btnSave.innerHTML = '<span>📥</span> Salvar e Baixar PDF com Anotações';
            }
        });
    })();
    </script>
    



<h2 class="wp-block-heading">Desenhe, Destaque Informações e Insira Carimbos com Precisão</h2>



<p class="wp-block-paragraph">Revisar contratos e trabalhos acadêmicos exige flexibilidade para fazer anotações rápidas à mão livre, sublinhar trechos vitais com marca-texto e validar fluxos operacionais com carimbos visíveis. Nossa suíte de edição oferece controle detalhado de cores, espessuras e uma biblioteca completa de carimbos corporativos (como <strong>APROVADO</strong>, <strong>REPROVADO</strong>, <strong>VISTO</strong> e <strong>REJEITADO</strong>) sem necessidade de registro.</p>



<p class="wp-block-paragraph">Para adicionar marcas d&#8217;água de proteção contra reprodução não autorizada, utilize nossa ferramenta dedicada de <a href="/web-ferramentas/marca-dagua-pdf/">inserir marca d&#8217;água em PDF</a> ou explore o <a href="/web-ferramentas/recortar-paginas-pdf/">recortador de páginas de PDF</a> para ajustar margens antes da entrega.</p>



<h2 class="wp-block-heading">Passo a Passo para Editar seu Documento</h2>



<ol class="wp-block-list">
    <li>Carregue o PDF que você deseja revisar na área de trabalho.</li>
    <li>Selecione no menu a ferramenta desejada: <em>Pincel</em>, <em>Marca-Texto</em>, <em>Texto</em>, <em>Retângulo</em> ou <em>Carimbo</em>.</li>
    <li>Escolha o carimbo (ex: <em>APROVADO</em> ou <em>REPROVADO</em>) e clique diretamente na página para aplicá-lo.</li>
    <li>Navegue pelas páginas, ajuste as marcações e clique em <strong>Salvar e Baixar PDF com Anotações</strong>.</li>
</ol>
<p>O post <a href="https://webzoneware.com/web-ferramentas/pdf/editor-anotador-pdf/">Editor e Anotador de PDF Online — Desenhar, Realçar e Escrever | Web-ZoneWare</a> apareceu primeiro em <a href="https://webzoneware.com">Web-Zoneware</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://webzoneware.com/web-ferramentas/pdf/editor-anotador-pdf/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
