Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have setup Printnode and run test and i have added api correctly on driver it still shows a error #95

Open
webscepts123 opened this issue Dec 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@webscepts123
Copy link

Laravel Printing Version

^3.0

Laravel Version

11.31

Print Driver

Printnode

Bug description

I have setup Printnode and run test and i have added api correctly on driver it still shows a error

Steps to reproduce

i have added

use Rawilk\Printing\Facades\Printing;

public function printReceipt(Request $request)
{
// Validate the incoming request
$request->validate([
'printer_id' => 'required|string',
'receipt_content' => 'required|string',
]);

// Get the printer ID and receipt content from the request
$printerId = $request->input('printer_id');
$receiptContent = $request->input('receipt_content');

// Log the API key and driver configuration for debugging
\Log::info('Using PrintNode API Key:', [config('printing.drivers.printnode.api_key')]);
\Log::info('Current Driver:', [config('printing.drivers')]);

// Send the print job to the specified printer
try {
    $response = Printing::print($receiptContent, [
        'printer' => $printerId,
    ]);

    // Check the response
    if ($response) {
        return response()->json(['message' => 'Print job created successfully!']);
    } else {
        return response()->json(['error' => 'Failed to create print job.'], 500);
    }
} catch (\Exception $e) {
    return response()->json(['error' => 'Print job failed: ' . $e->getMessage()], 500);
}

}

env('PRINTING_DRIVER', 'printnode'), /* |-------------------------------------------------------------------------- | Drivers |-------------------------------------------------------------------------- | | Configuration for each driver. | */ 'drivers' => [ 'printnode' => [ 'api_key' => env('PRINTNODE_API_KEY'), // Use environment variable ] ], /* |-------------------------------------------------------------------------- | Default Printer Id |-------------------------------------------------------------------------- | | If you know the id of a default printer you want to use, enter it here. | */ 'default_printer_id' => null, /* |-------------------------------------------------------------------------- | Receipt Printer Options |-------------------------------------------------------------------------- | */ 'receipts' => [ /* * How many characters fit across a single line on the receipt paper. * Adjust according to your needs. */ 'line_character_length' => 45, /* * The width of the print area in dots. * Adjust according to your needs. */ 'print_width' => 550, /* * The height (in dots) barcodes should be printed normally. */ 'barcode_height' => 64, /* * The width (magnification) each barcode should be printed in normally. */ 'barcode_width' => 2, ], ]; on env file PRINTNODE_API_KEY=correctly added image but it still shows Print job failed: You must provide an api key for the PrintNode driver. i haved done everything please check on this why it happening ### Relevant log output ```shell Print job failed: You must provide an api key for the PrintNode driver. ```
@webscepts123 webscepts123 added the bug Something isn't working label Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant