2014-10-09 2 views
1

배송 라벨을 만들고 인쇄 할 수있는 UPS 배송 API를 내 사이트에 통합하여 인쇄했습니다.UPS 배송 라벨에 회사 로고 추가

라벨이 만들어졌으며 사용자 또한 레이블을 인쇄 할 수 있습니다. 그러나 레이블은 기본적으로 사용중인 코드에서 반환되는 이미지 파일이지만, 회사 로고를 추가하고 싶습니다. 어떻게 할 수 있는지 알려주십시오.

  • 다음

    는 것, 난 당신이 레이저 라벨을 사용하고 있기 때문에 라벨

    function create_shipping_label($shipping_digest) { 
    // SHIP ACCEPT REQUEST 
    $xmlRequest1 = '<?xml version = "1.0″ encoding = "ISO-8859-1″?> 
    <AccessRequest> 
    <AccessLicenseNumber>' . UPS_ACCESS_LICENCE_NUMBER . '</AccessLicenseNumber> 
    <UserId>' . UPS_USERNAME . '</UserId> 
    <Password>' . UPS_PASSWORD . '</Password> 
    </AccessRequest> 
    <?xml version = "1.0″ encoding = "ISO-8859-1″?> 
    <ShipmentAcceptRequest> 
    <Request> 
    <TransactionReference> 
    <CustomerContext>Customer Comment</CustomerContext> 
    </TransactionReference> 
    <RequestAction>ShipAccept</RequestAction> 
    <RequestOption>1</RequestOption> 
    </Request> 
    <ShipmentDigest>' . $shipping_digest . '</ShipmentDigest> 
    </ShipmentAcceptRequest> 
    '; 
    
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, PREFIX."ups.com/ups.app/xml/ShipAccept"); 
    // uncomment the next line if you get curl error 60: error setting certificate verify locations 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
    // uncommenting the next line is most likely not necessary in case of error 60 
    // curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_HEADER, 0); 
    curl_setopt($ch, CURLOPT_POST, 1); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest1); 
    curl_setopt($ch, CURLOPT_TIMEOUT, 3600); 
    $xmlResponse = curl_exec($ch); // SHIP ACCEPT RESPONSE 
    
    
    $xml = $xmlResponse; 
    
    
    
    preg_match_all("/\<ShipmentAcceptResponse\>(.*?)\<\/ShipmentAcceptResponse\>/s",  $xml, $bookblocks); 
    
    
    foreach ($bookblocks[1] as $block) { 
        preg_match_all("/\<GraphicImage\>(.*?)\<\/GraphicImage\>/", $block, $author); // GET LABEL 
        preg_match_all("/\<TrackingNumber\>(.*?)\<\/TrackingNumber\>/", $block, $tracking); // GET TRACKING NUMBER 
    
    
    
    // ($author[1][0] . "\n"); 
    

    }

      return '<img id="shipping_label_image" src="data:image/gif;base64,' . $author[1][0] . '"/>'; 
    

    }

답변

0

을 만드는 데 사용했던 코드입니다 c로 추가 HTML을 반환하기 만하면됩니다. 배송 라벨 이미지 위 또는 아래의 이미지를 클릭하십시오.