php - Wkhtmltopdf unable to use the relative path for save() in Laravel 4 -


i using pdf snappy generate pdf files views in laravel 4.

i can use code using download() without problem , file generated , can save it:

$pdf = pdfsnappy::loadview($pdfview, $dataforpdf); return $pdf->download( 'invoice.pdf' );  

however, when try use save() code:

$pathtofile = "invoices/2015/full/invoice.pdf";  $pdf = pdfsnappy::loadview($pdfview, $dataforpdf); return $pdf->save( $pathtofile ); 

i error message:

object of class barryvdh\\snappy\\pdfwrapper not converted string 

if try this:

$pathtofile = url() . '/' . "invoices/2015/full/invoice.pdf";  $pdf = pdfsnappy::loadview($pdfview, $dataforpdf); return $pdf->save( $pathtofile ); 

i error message:

the output file's directory http://laravel.dev/invoices/2015/full/ not created. 

i on windows using wamp, problem?

how can save file /public folder in laravel inside invoices/2015/full/ ?

ok, seems solution remove return this:

return $pdf->save( $pathtofile );

and use code instead:

$pdf->save( $pathtofile );

and no additional url tweaking necessary, can use relative "public" paths want save pdfs.

hope helps in future ;)


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -