Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
How to decode PDF binary data to Postscript readable text

I'm currently searching for a way to extract the code (PostScript) behind a PDF just from its binary data. I have an input of type file that has an onChange event handler attached. The event handler looks like this:


const handleFileChange = (e) => {
  const [file] = e.target.files

  const reader = new FileReader()
  
  reader.addEventListener("loadend", () => {
    const buffer = reader.result
    const view = new DataView(buffer)
    
    const decoder = new TextDecoder("ascii")
    const text = decoder.decode(view)
  })
  
  reader.readAsArrayBuffer(file)
}

This code produces text that looks like this %PDF-1.3 %Äåòåë§ó ÐÄÆ 3 0 obj << /Filter /FlateDecode /Length 4573 >> stream xµ\ëŽÜ¶þϧ жVwi‚ hìM The beginning is just fine, it's everything afterward is the issue - %Äåòåë§ó ÐÄÆ & µ\ëŽÜ¶þϧ жVwi‚ hìM. It's illegible. I'm not sure if I just have the wrong encoding selected or what I'm setting out to do is all but impossible. Am I missing something here? If yes, what exactly? I appreciate any and all help. Thank you!

(resources are also welcomed)

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda