Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Last active June 17, 2019 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/6582c078fb3dc0f9643e85f5171ee612 to your computer and use it in GitHub Desktop.
Save parzibyte/6582c078fb3dc0f9643e85f5171ee612 to your computer and use it in GitHub Desktop.
<?php
# Incluir autoload
include "vendor/autoload.php";
$parseador = new \Smalot\PdfParser\Parser();
$nombreDocumento = "6-imagenes.pdf";
$documento = $parseador->parseFile($nombreDocumento);
$imagenes = $documento->getObjectsByType('XObject', 'Image');
$contador = 0; # Un índice
foreach ($imagenes as $imagen) {
file_put_contents(sprintf("Imagen_%02d.jpg", $contador + 1), $imagen->getContent());
$contador++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment