Skip to content

Invalid object reference for $obj. #770

Description

@noise3
  • PHP Version: 8.0
  • PDFParser Version: 2.12.0

Description: With this PDF I get this error: "Invalid object reference for $obj." on line 544 of the file RawDataParser.php

PDF input

gráfico anual collado.pdf

Expected output & actual output

The text of the file

Code

$parser = new \Smalot\PdfParser\Parser();

// Leemos el PDF
try {
$config = new \Smalot\PdfParser\Config();
$config->setIgnoreEncryption(true);
$pdf = $parser->parseFile($pdfGenCu_FicheroTemporalRecibido, $config);

// Sacamos el texto y por si acaso, lo pasamos todo a mayúsculas
$contenidoPDF = $pdf->getText();
$contenidoPDF = strtoupper($contenidoPDF);
// Vamos a quitar los dobles espacios si hubiera
$contenidoPDF = preg_replace('/\s\s+/', ' ', $contenidoPDF);

} catch (Exception $e) {
$alert_text = 'Error al procesar el PDF: ' . $e->getMessage();
if (method_exists($e, 'getLine') && $e->getLine() !== null) {
$alert_text .= ' en la línea ' . $e->getLine();
}
if (method_exists($e, 'getFile') && $e->getFile() !== null) {
$alert_text .= ' en el fichero ' . $e->getFile();
}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions