busonero Posted January 8, 2005 Share Posted January 8, 2005 Hi ! i've just intslled the Contribution "Shipping Label Via PDF" and i've no PDF output. I get get the error : File does not begin with %PDF- As another contribution creating PDF invoice works perfectly, I suppose there is an error in the code of label_pdf.php described at Point 5 of the installation text., not in an inappropriate install of the contribution. Does anybody got this contributions running ? Thank you for your help Sincerely Roberto <?php require('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']); $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); include(DIR_WS_CLASSES . 'order.php'); $order = new order($oID); function tep_dr($address_format_id, $address, $html, $boln, $eoln) { $address_format_query = tep_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . (int)$address_format_id . "'"); $address_format = tep_db_fetch_array($address_format_query); $company = tep_output_string_protected($address['company']); if (isset($address['firstname']) && tep_not_null($address['firstname'])) { $firstname = tep_output_string_protected($address['firstname']); $lastname = tep_output_string_protected($address['lastname']); } elseif (isset($address['name']) && tep_not_null($address['name'])) { $firstname = tep_output_string_protected($address['name']); $lastname = ''; } else { $firstname = ''; $lastname = ''; } $street = tep_output_string_protected($address['street_address']); $suburb = tep_output_string_protected($address['suburb']); $city = tep_output_string_protected($address['city']); $state = tep_output_string_protected($address['state']); if (isset($address['country_id']) && tep_not_null($address['country_id'])) { $country = tep_get_country_name($address['country_id']); if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) { $state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state); } } elseif (isset($address['country']) && tep_not_null($address['country'])) { $country = tep_output_string_protected($address['country']); } else { $country = ''; } $postcode = tep_output_string_protected($address['postcode']); $zip = $postcode; $line1= "$firstname $lastname"; $line2= "$company"; $line3="$street"; $line4="$city" . ', ' . "$state $zip"; $line5="$country"; define('FPDF_FONTPATH','font/'); require('fpdf.php'); $pdf=new FPDF('L','mm',array(59, 101)); $pdf->AddPage(); $pdf->SetXY('4', '4'); $pdf->SetMargins('0','0','0'); $pdf->SetFont('Arial','Bi',9); $pdf->Cell(80,4,'the_name_of_your_organization',0,1); $pdf->SetX('4'); $pdf->Cell(80,4,'the_address_of_your_organization',0,1); $pdf->Cell(70,4,'',T,1); $pdf->SetX(35); $pdf->SetFont('Arial','',9); $pdf->Cell(40,4,"$line1",0,2); if($line2 != ''){ $pdf->Cell(40,4,"$line2",0,2); } $pdf->Cell(40,4,"$line3",0,2); $pdf->Cell(40,4,"$line4",0,2); if($line5 != 'United States'){ $pdf->Cell(40,4,"$line5",0,2); } $pdf->Output(); if ($html) { // HTML Mode $HR = '<hr>'; $hr = '<hr>'; if ( ($boln == '') && ($eoln == "\n") ) { // Values not specified, use rational defaults $CR = '<br>'; $cr = '<br>'; $eoln = $cr; } else { // Use values supplied $CR = $eoln . $boln; $cr = $CR; } } else { // Text Mode $CR = $eoln; $cr = $CR; $HR = '----------------------------------------'; $hr = '----------------------------------------'; } $statecomma = ''; $streets = $street; if ($suburb != '') $streets = $street . $cr . $suburb; if ($country == '') $country = tep_output_string_protected($address['country']); if ($state != '') $statecomma = $state . ', '; $fmt = $address_format['format']; eval("\$address = \"$fmt\";"); if ( (ACCOUNT_COMPANY == 'true') && (tep_not_null($company)) ) { $address = $company . $cr . $address; } } tep_dr($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Quote Link to comment Share on other sites More sharing options...
privacynet Posted January 8, 2005 Share Posted January 8, 2005 Did ya get the latest fpdf class as required? As I know you are using a contri called pdf-invoice, what uses a different (older) fpdf class. Requires the fpdf library available from: http://www.fpdf.org/ Nice to meet you again. I was very busy, so I had no time to answer your call?s via the german board. regards Andre Quote Link to comment Share on other sites More sharing options...
busonero Posted January 8, 2005 Author Share Posted January 8, 2005 Hi Andre' thank you for your reply. Even if i update the fpdf v.1.51 with the v.1.5.3 one it does not work. With the 1.53 doesn't work the pdf-invoice any more :-( Indeed i was surpreised and disappointed not to hear from you anymore after all my tries. Have a nice weekend Sincerely Roberto Did ya get the latest fpdf class as required? As I know you are using a contri called pdf-invoice, what uses a different (older) fpdf class. Nice to meet you again. I was very busy, so I had no time to answer your call?s via the german board. regards Andre <{POST_SNAPBACK}> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.