-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Home
Jaime Poch edited this page Sep 22, 2022
·
1 revision
Welcome to the html5-qrcode wiki!
<!doctype html>
<title>Simple Document Scanner</title> <style> :root{ --accent:#ff6ea1; --bg1:linear-gradient(135deg,#fffaf0,#ffeef8); --card-bg:rgba(255,255,255,0.95); } *{box-sizing:border-box;margin:0;padding:0} html,body{height:100%;font-family:system-ui,-apple-system,Segoe UI,Roboto,'Helvetica Neue',Arial;background:var(--bg1);display:flex;align-items:center;justify-content:center;padding:18px} .card{width:100%;max-width:980px;background:var(--card-bg);border-radius:14px;padding:18px;box-shadow:0 12px 30px rgba(0,0,0,0.12);overflow:hidden} .top{display:flex;gap:12px;align-items:center;justify-content:space-between;margin-bottom:12px} h1{font-size:20px;color:var(--accent);letter-spacing:0.6px} .controls{display:flex;gap:8px;flex-wrap:wrap;align-items:center} button,input[type=file]{padding:8px 12px;border-radius:10px;border:1px solid rgba(0,0,0,0.06);background:white;cursor:pointer} .btn-primary{background:var(--accent);color:white;border:none} .stage{display:flex;gap:12px} .viewer{flex:1;min-height:420px;background:linear-gradient(180deg,#fff,#fff7ff);border-radius:10px;padding:10px;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden} video,canvas,img{max-width:100%;max-height:100%;display:block} .overlay{ position:absolute;left:0;top:0;right:0;bottom:0; pointer-events:auto; } .crop-box{ position:absolute;border:2px dashed rgba(255,110,150,0.85);border-radius:8px; touch-action:none; background:linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)); } .handle{ width:18px;height:18px;border-radius:4px;background:var(--accent);position:absolute;box-shadow:0 3px 8px rgba(0,0,0,0.18) } .handle.tl{left:-9px;top:-9px;cursor:nwse-resize} .handle.tr{right:-9px;top:-9px;cursor:nesw-resize} .handle.bl{left:-9px;bottom:-9px;cursor:nesw-resize} .handle.br{right:-9px;bottom:-9px;cursor:nwse-resize} .side-controls{width:360px;max-width:40%;padding:12px;display:flex;flex-direction:column;gap:10px} .slider-row{display:flex;gap:8px;align-items:center} label{font-size:13px;color:#444} input[type=range]{flex:1} .small{font-size:12px;color:#666} .actions{display:flex;gap:8px;flex-wrap:wrap} .notice{font-size:13px;color:#666;margin-top:6px} @media (max-width:880px){.stage{flex-direction:column}.side-controls{width:100%;max-width:none}} </style><div class="stage">
<div class="viewer" id="viewer">
<video id="video" autoplay playsinline style="display:none"></video>
<img id="sourceImg" alt="source" style="display:none;max-width:100%;height:auto">
<canvas id="preview" style="display:none"></canvas>
<!-- interactive overlay for cropping -->
<div class="overlay" id="overlay" style="display:none">
<div class="crop-box" id="cropBox" style="left:8%;top:10%;width:84%;height:80%">
<div class="handle tl"></div>
<div class="handle tr"></div>
<div class="handle bl"></div>
<div class="handle br"></div>
</div>
</div>
</div>
<div class="side-controls">
<div>
<label class="small">Preview / Controls</label>
<div class="notice">Use camera or upload image. Drag crop corners to frame the document. Click Capture to make a scan; use sliders to tidy it up.</div>
</div>
<div class="slider-row">
<label>Rotate</label>
<input id="rotate" type="range" min="-180" max="180" value="0">
<span id="rotVal" class="small">0°</span>
</div>
<div class="slider-row">
<label>Brightness</label>
<input id="brightness" type="range" min="-100" max="100" value="0">
<span id="bVal" class="small">0</span>
</div>
<div class="slider-row">
<label>Contrast</label>
<input id="contrast" type="range" min="-100" max="100" value="0">
<span id="cVal" class="small">0</span>
</div>
<div class="slider-row">
<label>Sharpen</label>
<input id="sharpen" type="range" min="0" max="100" value="0">
<span id="sVal" class="small">0</span>
</div>
<div>
<label class="small">Actions</label>
<div class="actions">
<button id="applyFilters" class="btn-primary">Apply & Preview</button>
<button id="autoCenter">Auto-center crop</button>
<button id="reset">Reset</button>
</div>
</div>
<div style="margin-top:8px">
<label class="small">Output</label>
<div class="notice">After preview, click <strong>Download Scan</strong> to save PNG (high-res export).</div>
</div>
</div>
</div>