PrintNode/PrintNode-PHP

Printing On PHP

jecorrales3 opened this issue · 1 comments

Hi, I'm so facinated with this API, I've read all about it, I just want to print from my APP WEB and I think that this can help me, but, firstly I need to know something else:

Context Software
My system basically takes the register of a person, with his personal data.

  • ID
  • Name
  • LastName
  • HourRegister
  • DateRegister
  • Barcode (ID)
  • And the place that he goes, and with the label from my Dymo I print that data on it!

How I'm Doing The Printing For My Software
Actually my software is in production, and the printing proccess is with the preview printing from the navigator and what I need is for it to always be printed.

  • My Label is designed with HTML and that section is printed.
  • With the method window.print()

Why I'm here?

  • Because I need to know if the label was printed or not, and, with the preview printed I can press the button Cancel and only register the people without the label and the Label is my obvjective.

Label

  • 30256 Shipping

Questions

  1. Is it necessary that will be printed on PDF?
  2. If that is false, how can I create my Label?
  3. In production I have 3 PC's, so, I need to one account for everyone or ?
  4. What is wrong with this code, I've prove with some examples and it doesn't work!

CODE

` <?php
include 'PrintNode/Loader.php';

$credentials = new PrintNode\Credentials('xxxxx.xxxxxx',
'xxxxxxxxxxxxxxxxxxxx');
$credentials->setApiKey(PRINTNODE_APIKEY);
$request = new PrintNode\Request($credentials);

// Initialise a Child Account

$account = new PrintNode\Account();
// Set properties on the Child Account
$account->Account = array(
"firstname" => "11",
"lastname" => "111",
"password" => "111111",
"email" => "11111@11111.co"
);
// Post the Child Account to the API
$aNewAccount = $request->post($account);
// You can get the Child Account ID from the response object
$id = $aNewAccount->GetDecodedContent()["Account"]["id"];
?>`

RESULT

Fatal error: Class 'PrintNode\Entity' not found in C:\xampp\htdocs\Prueba\Code\PrintNode\Account.php on line 15

You can use a php script to generate a PDF file then submit that to the API with your selected printer and it will print.

For multiple printers, I would suggest you setup a main server and network share all your printers so you can just install PrintNode client on the main machine and access all the available printers without a problem.