segy / Mpdf

CakePHP 2.x Component for creating PDF files from HTML using mPDF class
30 stars 19 forks source link

image doesn't work fine, and external files too #10

Open elbasri opened 9 years ago

elbasri commented 9 years ago

hey segy, firstly, thanks a lot for this beauty work :) i test it on my localhost (using xampp) and work great :) but isnt in the webserver, i test the mpdf directly on my webspace and work fine, but your plugin (in cakephp) doesnt ! this is the issues: -css files doesnt work, until change the including methode from : <?php echo $this->Html->css('screen.css');?> to and i dont know why !!!! -images doesnt work too until change from the helper methode <?php $this->html->image('img/images/image.jpg') ?> to !! and doesnt work too when add "/" like: all those problems happen whene i use the plugin on the webserver,but in my local server (on my pc) all is work fine ! im trying many methodes and diffirents versions of mpdf (the recent version too 6) without any new !

hope that you have any idea thanks :)

ghost commented 9 years ago

Hi devnasser

Try this in the view of your pdf file.

<?php $dir= $this->webroot."img/cake.icon.png"; ?>

<?php echo $dir; ?>

elbasri commented 9 years ago

Hey, thanks for reply... its work fine :) good day

2015-07-17 20:03 UTC+01:00, Juan09130424 notifications@github.com:

Hi devnasser Try this in the view of your pdf file.

<?php $dir= $this->webroot."img/cake.icon.png"; ?>

<?php echo $dir; ?>


Reply to this email directly or view it on GitHub: https://github.com/segy/Mpdf/issues/10#issuecomment-122374321

HugoRojas commented 7 years ago

Hey im using the Mpdf but i facing some problems, please can you help me out. The view after creating the PDF its totally different that the original... The menu for example is being displayed when its suppose to not... Here i put my example... Thaks and i really aprreciate your help guys!!

Controller -> Users

public function add(){ // Code related to controller $this->Mpdf->init(); $this->Mpdf->setFilename('Factura.pdf'); $this->Mpdf->setOutput('I'); }

add.ctp //Code related to he view <?php $this->layout="PDF"; ?>

layouts/PDF.ctp <?php echo $this->fetch('content'); ?>

This is the original view

orignal

This is the one after rendered to pdf

rendered

Thanks guys!

ghost commented 7 years ago

Hi The problem is because mpdf dont soport all css when display pdf. For example i think that you use navbar and i supouse that mpdf not support this style.

You can to use other mpdf plugin , like dompdf that support more style .

2016-09-29 11:05 GMT-05:00 HugoRojas notifications@github.com:

Hey im using the Mpdf but i facing some problems, please can you help me out. The view after creating the PDF its totally different that the original... The menu for example is being displayed when its suppose to not... Here i put my example... Thaks and i really aprreciate your help guys!!

Controller -> Users

public function add(){ // Code related to controller $this->Mpdf->init(); $this->Mpdf->setFilename('Factura.pdf'); $this->Mpdf->setOutput('I'); }

add.ctp //Code related to he view <?php $this->layout="PDF"; ?>

layouts/PDF.ctp <?php echo $this->fetch('content'); ?>

This is the original view

[image: orignal] https://cloud.githubusercontent.com/assets/10120792/18961981/867cea74-8634-11e6-953e-1ee138a3a8fe.PNG

This is the one after rendered to pdf

[image: rendered] https://cloud.githubusercontent.com/assets/10120792/18961993/92d70002-8634-11e6-9372-6ad81df73af0.PNG

Thanks guys!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250511398, or mute the thread https://github.com/notifications/unsubscribe-auth/AL-HkaIBiDoPvF_Ilvj2MLeT6P4Mtjb7ks5qu-G8gaJpZM4DnfTS .

HugoRojas commented 7 years ago

Thanks for the answer, i already using another plugin which uses dompdf and its working but i just have a confussion about the css files located in View/Layouts/pdf/default.ctp because i can't get to load the view as the original one.

Could you please help me to find out my issue, it won't take more than 10 minutes.

We can use Skype and share my screen in you want.

I really appreciate it man. Thank you so much

2016-09-29 12:47 GMT-05:00 Juan09130424 notifications@github.com:

Hi The problem is because mpdf dont soport all css when display pdf. For example i think that you use navbar and i supouse that mpdf not support this style.

You can to use other mpdf plugin , like dompdf that support more style .

2016-09-29 11:05 GMT-05:00 HugoRojas notifications@github.com:

Hey im using the Mpdf but i facing some problems, please can you help me out. The view after creating the PDF its totally different that the original... The menu for example is being displayed when its suppose to not... Here i put my example... Thaks and i really aprreciate your help guys!!

Controller -> Users

public function add(){ // Code related to controller $this->Mpdf->init(); $this->Mpdf->setFilename('Factura.pdf'); $this->Mpdf->setOutput('I'); }

add.ctp //Code related to he view <?php $this->layout="PDF"; ?>

layouts/PDF.ctp <?php echo $this->fetch('content'); ?>

This is the original view

[image: orignal] https://cloud.githubusercontent.com/assets/10120792/18961981/867cea74- 8634-11e6-953e-1ee138a3a8fe.PNG

This is the one after rendered to pdf

[image: rendered] https://cloud.githubusercontent.com/assets/10120792/18961993/92d70002- 8634-11e6-9372-6ad81df73af0.PNG

Thanks guys!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250511398, or mute the thread https://github.com/notifications/unsubscribe-auth/AL-HkaIBiDoPvF_ Ilvj2MLeT6P4Mtjb7ks5qu-G8gaJpZM4DnfTS .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250540174, or mute the thread https://github.com/notifications/unsubscribe-auth/AJpuWNyCQAbekWqXSBYM3yswWPYMj2zQks5qu_mlgaJpZM4DnfTS .

ghost commented 7 years ago

i cant to speak english very well . I am mexican. but is because pdf no support some css that you use.

2016-09-29 12:55 GMT-05:00 HugoRojas notifications@github.com:

Thanks for the answer, i already using another plugin which uses dompdf and its working but i just have a confussion about the css files located in View/Layouts/pdf/default.ctp because i can't get to load the view as the original one.

Could you please help me to find out my issue, it won't take more than 10 minutes.

We can use Skype and share my screen in you want.

I really appreciate it man. Thank you so much

2016-09-29 12:47 GMT-05:00 Juan09130424 notifications@github.com:

Hi The problem is because mpdf dont soport all css when display pdf. For example i think that you use navbar and i supouse that mpdf not support this style.

You can to use other mpdf plugin , like dompdf that support more style .

2016-09-29 11:05 GMT-05:00 HugoRojas notifications@github.com:

Hey im using the Mpdf but i facing some problems, please can you help me out. The view after creating the PDF its totally different that the original... The menu for example is being displayed when its suppose to not... Here i put my example... Thaks and i really aprreciate your help guys!!

Controller -> Users

public function add(){ // Code related to controller $this->Mpdf->init(); $this->Mpdf->setFilename('Factura.pdf'); $this->Mpdf->setOutput('I'); }

add.ctp //Code related to he view <?php $this->layout="PDF"; ?>

layouts/PDF.ctp <?php echo $this->fetch('content'); ?>

This is the original view

[image: orignal] https://cloud.githubusercontent.com/assets/ 10120792/18961981/867cea74- 8634-11e6-953e-1ee138a3a8fe.PNG

This is the one after rendered to pdf

[image: rendered] https://cloud.githubusercontent.com/assets/ 10120792/18961993/92d70002- 8634-11e6-9372-6ad81df73af0.PNG

Thanks guys!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250511398, or mute the thread https://github.com/notifications/unsubscribe-auth/AL-HkaIBiDoPvF_ Ilvj2MLeT6P4Mtjb7ks5qu-G8gaJpZM4DnfTS .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250540174, or mute the thread https://github.com/notifications/unsubscribe-auth/ AJpuWNyCQAbekWqXSBYM3yswWPYMj2zQks5qu_mlgaJpZM4DnfTS .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250542543, or mute the thread https://github.com/notifications/unsubscribe-auth/AL-HkdKAJmyG71CCoBttkPdCy-uXSktMks5qu_uvgaJpZM4DnfTS .

HugoRojas commented 7 years ago

Genial yo tambien hablo espanol, bueno agradeceria mucho tu ayuda ya cambie de motor ahora uso dompdf solo tengo una duda

2016-09-29 13:46 GMT-05:00 Juan09130424 notifications@github.com:

i cant to speak english very well . I am mexican. but is because pdf no support some css that you use.

2016-09-29 12:55 GMT-05:00 HugoRojas notifications@github.com:

Thanks for the answer, i already using another plugin which uses dompdf and its working but i just have a confussion about the css files located in View/Layouts/pdf/default.ctp because i can't get to load the view as the original one.

Could you please help me to find out my issue, it won't take more than 10 minutes.

We can use Skype and share my screen in you want.

I really appreciate it man. Thank you so much

2016-09-29 12:47 GMT-05:00 Juan09130424 notifications@github.com:

Hi The problem is because mpdf dont soport all css when display pdf. For example i think that you use navbar and i supouse that mpdf not support this style.

You can to use other mpdf plugin , like dompdf that support more style .

2016-09-29 11:05 GMT-05:00 HugoRojas notifications@github.com:

Hey im using the Mpdf but i facing some problems, please can you help me out. The view after creating the PDF its totally different that the original... The menu for example is being displayed when its suppose to not... Here i put my example... Thaks and i really aprreciate your help guys!!

Controller -> Users

public function add(){ // Code related to controller $this->Mpdf->init(); $this->Mpdf->setFilename('Factura.pdf'); $this->Mpdf->setOutput('I'); }

add.ctp //Code related to he view <?php $this->layout="PDF"; ?>

layouts/PDF.ctp <?php echo $this->fetch('content'); ?>

This is the original view

[image: orignal] https://cloud.githubusercontent.com/assets/ 10120792/18961981/867cea74- 8634-11e6-953e-1ee138a3a8fe.PNG

This is the one after rendered to pdf

[image: rendered] https://cloud.githubusercontent.com/assets/ 10120792/18961993/92d70002- 8634-11e6-9372-6ad81df73af0.PNG

Thanks guys!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250511398, or mute the thread https://github.com/notifications/unsubscribe-auth/AL-HkaIBiDoPvF_ Ilvj2MLeT6P4Mtjb7ks5qu-G8gaJpZM4DnfTS .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250540174, or mute the thread https://github.com/notifications/unsubscribe-auth/ AJpuWNyCQAbekWqXSBYM3yswWPYMj2zQks5qu_mlgaJpZM4DnfTS .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250542543, or mute the thread https://github.com/notifications/unsubscribe-auth/AL- HkdKAJmyG71CCoBttkPdCy-uXSktMks5qu_uvgaJpZM4DnfTS

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250556268, or mute the thread https://github.com/notifications/unsubscribe-auth/AJpuWDg8YAx8_UUmPZf1XTqd44hILEa9ks5qvAeDgaJpZM4DnfTS .

ghost commented 7 years ago

El problema de los renderizadores de pdf es que no soportan la mayoria de los estilos , por ejemplo no soportan bootstrap ni nada por el estilo , lo que e echo es un layout para los css y declarar todos los estilos en el head del layout y hacer los estilos con instruciones basicas. background border todo eso y poco a poco lo vas checando que renderize correctamente.

Lee esta documentacion https://mpdf.github.io/css-stylesheets/supported-css.html

https://github.com/dompdf/dompdf/wiki/CSSCompatibility

2016-09-29 13:52 GMT-05:00 HugoRojas notifications@github.com:

Genial yo tambien hablo espanol, bueno agradeceria mucho tu ayuda ya cambie de motor ahora uso dompdf solo tengo una duda

2016-09-29 13:46 GMT-05:00 Juan09130424 notifications@github.com:

i cant to speak english very well . I am mexican. but is because pdf no support some css that you use.

2016-09-29 12:55 GMT-05:00 HugoRojas notifications@github.com:

Thanks for the answer, i already using another plugin which uses dompdf and its working but i just have a confussion about the css files located in View/Layouts/pdf/default.ctp because i can't get to load the view as the original one.

Could you please help me to find out my issue, it won't take more than 10 minutes.

We can use Skype and share my screen in you want.

I really appreciate it man. Thank you so much

2016-09-29 12:47 GMT-05:00 Juan09130424 notifications@github.com:

Hi The problem is because mpdf dont soport all css when display pdf. For example i think that you use navbar and i supouse that mpdf not support this style.

You can to use other mpdf plugin , like dompdf that support more style .

2016-09-29 11:05 GMT-05:00 HugoRojas notifications@github.com:

Hey im using the Mpdf but i facing some problems, please can you help me out. The view after creating the PDF its totally different that the original... The menu for example is being displayed when its suppose to not... Here i put my example... Thaks and i really aprreciate your help guys!!

Controller -> Users

public function add(){ // Code related to controller $this->Mpdf->init(); $this->Mpdf->setFilename('Factura.pdf'); $this->Mpdf->setOutput('I'); }

add.ctp //Code related to he view <?php $this->layout="PDF"; ?>

layouts/PDF.ctp <?php echo $this->fetch('content'); ?>

This is the original view

[image: orignal] https://cloud.githubusercontent.com/assets/ 10120792/18961981/867cea74- 8634-11e6-953e-1ee138a3a8fe.PNG

This is the one after rendered to pdf

[image: rendered] https://cloud.githubusercontent.com/assets/ 10120792/18961993/92d70002- 8634-11e6-9372-6ad81df73af0.PNG

Thanks guys!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250511398, or mute the thread https://github.com/notifications/unsubscribe-auth/AL-HkaIBiDoPvF_ Ilvj2MLeT6P4Mtjb7ks5qu-G8gaJpZM4DnfTS .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250540174, or mute the thread https://github.com/notifications/unsubscribe-auth/ AJpuWNyCQAbekWqXSBYM3yswWPYMj2zQks5qu_mlgaJpZM4DnfTS .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250542543, or mute the thread https://github.com/notifications/unsubscribe-auth/AL- HkdKAJmyG71CCoBttkPdCy-uXSktMks5qu_uvgaJpZM4DnfTS

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250556268, or mute the thread https://github.com/notifications/unsubscribe-auth/AJpuWDg8YAx8_ UUmPZf1XTqd44hILEa9ks5qvAeDgaJpZM4DnfTS

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250557949, or mute the thread https://github.com/notifications/unsubscribe-auth/AL-HkfBPpcFk7_xyjJMMw7cQS5adBGCkks5qvAkEgaJpZM4DnfTS .

HugoRojas commented 7 years ago

Si, lo voy a leer man... De hecho queria usar este

http://codepen.io/supah/pen/jqbMYG

y nada me explota, me sale esto

[image: Imágenes integradas 1]

2016-09-29 13:59 GMT-05:00 Juan09130424 notifications@github.com:

El problema de los renderizadores de pdf es que no soportan la mayoria de los estilos , por ejemplo no soportan bootstrap ni nada por el estilo , lo que e echo es un layout para los css y declarar todos los estilos en el head del layout y hacer los estilos con instruciones basicas. background border todo eso y poco a poco lo vas checando que renderize correctamente.

Lee esta documentacion https://mpdf.github.io/css-stylesheets/supported-css.html

https://github.com/dompdf/dompdf/wiki/CSSCompatibility

2016-09-29 13:52 GMT-05:00 HugoRojas notifications@github.com:

Genial yo tambien hablo espanol, bueno agradeceria mucho tu ayuda ya cambie de motor ahora uso dompdf solo tengo una duda

2016-09-29 13:46 GMT-05:00 Juan09130424 notifications@github.com:

i cant to speak english very well . I am mexican. but is because pdf no support some css that you use.

2016-09-29 12:55 GMT-05:00 HugoRojas notifications@github.com:

Thanks for the answer, i already using another plugin which uses dompdf and its working but i just have a confussion about the css files located in View/Layouts/pdf/default.ctp because i can't get to load the view as the original one.

Could you please help me to find out my issue, it won't take more than 10 minutes.

We can use Skype and share my screen in you want.

I really appreciate it man. Thank you so much

2016-09-29 12:47 GMT-05:00 Juan09130424 notifications@github.com:

Hi The problem is because mpdf dont soport all css when display pdf. For example i think that you use navbar and i supouse that mpdf not support this style.

You can to use other mpdf plugin , like dompdf that support more style .

2016-09-29 11:05 GMT-05:00 HugoRojas notifications@github.com:

Hey im using the Mpdf but i facing some problems, please can you help me out. The view after creating the PDF its totally different that the original... The menu for example is being displayed when its suppose to not... Here i put my example... Thaks and i really aprreciate your help guys!!

Controller -> Users

public function add(){ // Code related to controller $this->Mpdf->init(); $this->Mpdf->setFilename('Factura.pdf'); $this->Mpdf->setOutput('I'); }

add.ctp //Code related to he view <?php $this->layout="PDF"; ?>

layouts/PDF.ctp <?php echo $this->fetch('content'); ?>

This is the original view

[image: orignal] https://cloud.githubusercontent.com/assets/ 10120792/18961981/867cea74- 8634-11e6-953e-1ee138a3a8fe.PNG

This is the one after rendered to pdf

[image: rendered] https://cloud.githubusercontent.com/assets/ 10120792/18961993/92d70002- 8634-11e6-9372-6ad81df73af0.PNG

Thanks guys!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250511398, or mute the thread https://github.com/notifications/unsubscribe- auth/AL-HkaIBiDoPvF_ Ilvj2MLeT6P4Mtjb7ks5qu-G8gaJpZM4DnfTS .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250540174, or mute the thread https://github.com/notifications/unsubscribe-auth/ AJpuWNyCQAbekWqXSBYM3yswWPYMj2zQks5qu_mlgaJpZM4DnfTS .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250542543, or mute the thread https://github.com/notifications/unsubscribe-auth/AL- HkdKAJmyG71CCoBttkPdCy-uXSktMks5qu_uvgaJpZM4DnfTS

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250556268, or mute the thread https://github.com/notifications/unsubscribe-auth/AJpuWDg8YAx8_ UUmPZf1XTqd44hILEa9ks5qvAeDgaJpZM4DnfTS

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250557949, or mute the thread https://github.com/notifications/unsubscribe-auth/AL-HkfBPpcFk7_ xyjJMMw7cQS5adBGCkks5qvAkEgaJpZM4DnfTS

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/segy/Mpdf/issues/10#issuecomment-250559661, or mute the thread https://github.com/notifications/unsubscribe-auth/AJpuWKTZoORNVpfFhufulWhNYpHPPnYsks5qvAqIgaJpZM4DnfTS .