public function generatepdf() { App::import('Vendor', 'linnwork/api/Auth'); App::import('Vendor', 'linnwork/api/Factory'); App::import('Vendor', 'linnwork/api/PrintService'); $username = Configure::read('linnwork_api_username'); $password = Configure::read('linnwork_api_password'); $multi = AuthMethods::Multilogin($username, $password); $auth = AuthMethods::Authorize($username, $password, $multi[0]->Id); $token = $auth->Token; $server = $auth->Server; $orderIdArray[] = $this->request->data['pkorderid']; $IDs = $orderIdArray; $parameters = '[]'; $result = PrintServiceMethods::CreatePDFfromJobForceTemplate('Invoice Template', $IDs, 27, $parameters, 'PDF', $token, $server); $results = PrintServiceMethods::CreatePDFfromJobForceTemplate('Invoice Template', $IDs, 27, $parameters, 'PDF', $token, $server); $pdf = $result->URL . "#" . $results->URL; if ($result->URL && $result->URL) { echo $pdf; exit; } else { echo "2"; exit; } }
public function getPdfOfOpenOrderss() { $this->layout = 'index'; App::import('Vendor', 'linnwork/api/Auth'); App::import('Vendor', 'linnwork/api/Factory'); App::import('Vendor', 'linnwork/api/PrintService'); $username = Configure::read('linnwork_api_username'); $password = Configure::read('linnwork_api_password'); $multi = AuthMethods::Multilogin($username, $password); $auth = AuthMethods::Authorize($username, $password, $multi[0]->Id); $token = $auth->Token; $server = $auth->Server; $orderIdArray[] = '4fc02c93-2718-4604-bc29-0d4190fb91bb'; $orderIdArray[] = '17a7742a-9649-4ca9-a054-061dfc27a13e'; $orderIdArray[] = '064a394f-623e-4c47-9d19-4cb230069f86'; $IDs = $orderIdArray; $parameters = array(); $orderIds = array(); $orderIds[] = '100031'; $orderIds[] = '100030'; $orderIds[] = '100029'; $orderIds[] = '100028'; $templateType = "Invoice Template"; $printPdfLink = $result = PrintServiceMethods::CreatePDFfromJobForceTemplate($templateType, $IDs, 18, $parameters, 'PDF', $token, $server); $this->set('printPdfLink', $printPdfLink); $this->set('orderIds', $orderIds); }
//$result = PrintServiceMethods::GetTemplateList('Invoice Template',$token, $server); //done $orderIdArray[] = 'ffd3fdef-2af3-4a5c-8b18-445affdaf8ab'; $orderIdArray[] = '696e9699-62f0-4584-a5c1-744745dbf16d'; $IDs = $orderIdArray; $parameters = '[]'; $result = PrintServiceMethods::CreatePDFfromJobForceTemplate('Invoice Template', $IDs, 16, $parameters, 'EuracoGroup', $token, $server); echo "<pre>"; print_r($result); exit; //$result = PrintServiceMethods::DownloadVirtualPrinterClient($token, $server); //done $result = PrintServiceMethods::VP_GetPrinters($token, $server); //done /*echo "<pre>"; print_r($result); exit;*/ $result = PrintServiceMethods::PrintTemplatePreview(16, $token, $server); //done $url = $result->URL; //https://usprinting1.linnworks.net/Download.svc/File/2f457d721aac04e984a48c0f83c08fa5-28f613a3-808e-43fb-ba75-ccd2cb33e96d/pdf ?> <script> var url = 'https://usprinting1.linnworks.net/Download.svc/File/2f457d721aac04e984a48c0f83c08fa5-50e99fe3-c24c-467c-abf8-2479fcd2221b/pdf'; var win=window.open(url, '_blank'); win.focus(); </script> <?php exit; //$result = OrdersMethods::RemoveOrderItem('b0cb3352-fba8-4c92-8d43-841f6763a756','eed796c7-d1ab-4641-934a-26a5f6cecf5a',$fulfilmentCenter,$token, $server); //done //$result = OrdersMethods::UpdateOrderItem('b0cb3352-fba8-4c92-8d43-841f6763a756',$orderItem,$fulfilmentCenter,'Direct','MyStore',$token, $server); /*echo "<pre>"; print_r($result);