tcpdf - Redirect after output completed and file saved (not sure how to know when large PDF's fully saved) -


i use pdf generate pdf , save server this:

$fp = fopen( '$createdid.'.pdf', 'wb' ); fwrite( $fp, $pdf->output('example_009.pdf', 's')); fclose( $fp );

a user design on our site move onto php page calls above code want them redirect cart can checkout.

using

jquery(document).ready(function() {redirect() })

doesn't seem wait pdf finish before redirecting. tried embedding large image pdf test...i tried leaving page straight away make sure output , saving isn't happening behind scenes after leaving page.

how should make sure page isn't redirected until pdf created , saved server?

thanks,

joe

an overview of i'm doing below - e.g building pdf obj, outputting pdf obj hoping redirect page after pdf completed

// init pdf obj $pdf2 = new tcpdf(pdf_page_orientation, pdf_unit, pdf_page_format, true, 'utf-8', false);

// set defaults setpdfdefaults($pdf2,$pl,$resolution);

// add bg addbackground($pdf2,$templated,$bannerinfo['backgroundcolour'],$margintop,$bleedtop,$bleedbottom,$bleedleft,$bleedright, $bannerwidth, $bannerheight,$this);

// loop through images , text objects , add pdf obj drawobjects($pdf2,$json,$images,$sizeratio,$countbg,$margintop,$bleedtop,$margleft,$this,$debugga);

 $fp = fopen( '/homepages/40/d449000017/htdocs/bannerplanetmagento/js/bannercreator/savedbanners/'.$nsize.'/customer/banner'.$createdid.'.pdf', 'wb' );   fwrite( $fp, $pdf->output('example_009.pdf', 's'));   fclose( $fp );   $fpcustomer = fopen( '/homepages/40/d449000017/htdocs/bannerplanetmagento/js/bannercreator/savedbanners/'.$nsize.'/print/banner'.$createdid.'_print.pdf', 'wb' );   fwrite( $fpcustomer, $pdf2->output('example_009.pdf', 's'));   fclose( $fpcustomer ); 

var target = document.getelementbyid('loading-spinner'); var spinner = new spinner(opts).spin(target);

jquery(document).ready(function($) {

// performredirectaction() 

});


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -