PageSourceSearch

https://exploremydata.com/assets/pdfToCsv-DS8vB88D.js

js exploremydata.com collected 2026-09-25 20:07:59 UTC 2,284 bytes, 1 lines download raw bytes

1import{_ as z}from"./vite-preload-ckwbz45p.js";import"./polyfills-1THQ3rSd.js";import{p as T,n as $}from"./pdfParser-BPKa0u6N.js";import{previewFromAoa as v,textBlob as E,replaceExtension as N,stripExtension as S}from"./util-CkZ8KZK2.js";import{withTrailingNewline as g,parseCsvText as k}from"./csvShared-8k83eY5V.js";import"./vendor-fflate-CXh1ITwj.js";import"./staleBundle-B9uSr-c7.js";import"./schemaGrouping-Cr-OBP6k.js";import"./vendor-papaparse-Btpkh8vH.js";import"./cjs-helpers-D6-XlEtG.js";import"./detectTableRegion-B60ufQHb.js";function h(e,t){const i=e.replace(/[^\w.-]+/g,"-").replace(/^-+|-+$/g,"");return i.length>0?i.slice(0,60):`table-${t+1}`}function A(e){return e.map(t=>({label:t.label,...typeof t.rowCount=="number"?{rowCount:t.rowCount}:{},...typeof t.columnCount=="number"?{columnCount:t.columnCount}:{}}))}async function D(e,t,i,l){if(e.length===0)throw new Error("No tables were found in that PDF.");const d=i.filter(o=>o>=0&&o<e.length),s=d.length>0?d:e.map((o,r)=>r),a=l?[l]:[],n=s[0],c=g(e[n].csv),{rows:f,warnings:x}=k(c);a.push(...x);const p=e.length>1?{kind:"tables",tables:A(e),selected:s}:void 0;if(s.length===1)return{filename:N(t,"csv"),blob:E(c,"text/csv"),text:c,copyKind:"csv",preview:v(f,20),warnings:a,...p?{discovered:p}:{}};const{zipSync:P,strToU8:y}=await z(async()=>{const{zipSync:o,strToU8:r}=await import("./vendor-fflate-CXh1ITwj.js");return{zipSync:o,strToU8:r}},[]),w={},b=new Set;for(const o of s){const r=e[o];let m=`${h(r.label,o)}.csv`,_=2;for(;b.has(m);)m=`${h(r.label,o)}-${_++}.csv`;b.add(m);const u=y(g(r.csv));w[m]=u instanceof Uint8Array?u:new Uint8Array(u)}const C=P(w,{level:6});return a.push(`${s.length} tables were exported as separate CSV files inside the zip.`),{filename:`${S(t)||"tables"}.zip`,blob:new Blob([C],{type:"application/zip"}),preview:v(f,20),warnings:a,...p?{discovered:p}:{}}}const j=async e=>{if(!e.file)throw new Error("Pick a PDF to convert.");e.ctx.onProgress("Loading the PDF engine…");const{tables:t,warning:i}=await T(e.file,{onProgress:n=>e.ctx.onProgress(n),onPasswordNeeded:n=>e.ctx.requestPassword(n)}),l=e.tables??t.map((n,c)=>c),s=e.options.numbers==="plain"?t.map(n=>({...n,csv:$(n.csv)})):t;return{status:"ok",output:await D(s,e.filename,l,i)}};export{D as buildPdfOutput,j as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.