Skip to content

Instantly share code, notes, and snippets.

@xola139
Created April 12, 2017 15:47
Show Gist options
  • Select an option

  • Save xola139/da6538caab0f58752b57322ae8b4a033 to your computer and use it in GitHub Desktop.

Select an option

Save xola139/da6538caab0f58752b57322ae8b4a033 to your computer and use it in GitHub Desktop.
Agregar pdf en html apartir de un flujo de datos base63
//se crea el objeto para poder embeberlo dentro del html 'arrayFile' es el flujo de datos
var objbuilder = '';
objbuilder += ('<object width="100%" height="100%" data="data:application/pdf;base64,');
objbuilder += (arrayFile);
objbuilder += ('" type="application/pdf" class="internal">');
objbuilder += ('<embed src="data:application/pdf;base64,');
objbuilder += (arrayFile);
objbuilder += ('" type="application/pdf" />');
objbuilder += ('</object>');
$('#appendPDF').replaceWith(objbuilder);
//Se coloca un contenedor del pdf en este caso se utilizo img
<img id="appendPDF" class="img-responsive">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment