Skip to content

Print PDF file - Imagick cant find file but it exists in supplied folder #1

@mountainclimbing

Description

@mountainclimbing

Hello,

Am trying the example "print_from_pdf.php"

$pdf = "resources\document.pdf";
$connector = new NetworkPrintConnector("IP Address", 9100);
$printer = new Printer($connector);
try {
$pages = ImagickEscposImage::loadPdf($pdf);
foreach ($pages as $page) {
$printer -> graphics($page);
}
$printer -> cut();
} catch (Exception $e) {
/*

  • loadPdf() throws exceptions if files or not found, or you don't have the
  • imagick extension to read PDF's
    */
    echo $e -> getMessage() . "\n";
    } finally {
    $printer -> close();
    }

I have succesfully installed the imagick extension but I keep receiving the error:

Uncaught exception 'Exception' with message 'exception 'ImagickException' with message 'UnableToOpenBlob `resources\document.pdf': No such file or directory @ error/blob.c/OpenBlob/2702'

Which relates to file not being available but I have the file in said directory/folder. What could I be missing?

Am I suppose to edit anything on "ImagickEscposImage.php" to supply the pdf file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions