Yii Framework Forum: Problemi Con Il Css E L'estensione Epdf - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problemi Con Il Css E L'estensione Epdf Rate Topic: -----

#1 User is offline   michele 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 221
  • Joined: 02-August 12

Posted 12 October 2012 - 08:37 AM

Salve ragazzi non riesco ad importare il css nel file pdf generato dall'estensione ePdf

seguendo la guida ovvero:

$stylesheet = file_get_contents(Yii::getPathOfAlias('webroot.css') . '/form.css');
               $html2pdf->writeHTML($stylesheet);


nel file pdf mi stampa questo

/** * CSS styles for forms generated by yiic. * * The styles can be applied to the following form structure: * *** xyz * hint text

*
** xyz * hint text
*
** xyz * hint text
*
*
* * The above code will render the labels and input fields in separate lines. * In order to render them in the same
line, please use the "wide" form as follows, * ** ...... *
* * @author Qiang Xue <qiang.xue@gmail.com> * @link http://www.yiiframework.com/ * @copyright Copyright ©
2008-2010 Yii Software LLC * @license http://www.yiiframework.com/license/ */ div.form { } div.form input, div.form
textarea, div.form select { height: 20px; width: 60px; margin: 0em; } div.form fieldset { border: 1px solid #DDD;
padding: 10px; margin: 0 0 10px 0; -moz-border-radius:7px; } div.form label { font-weight: bold; font-size: 0.9em;
display: block; } div.form .row { margin: 0px; } div.form #prefixarchivioPratiche { border-right-style: solid;
border-left-style: solid; border-bottom-style: solid; border-top-style: solid; border-right-width: 1px; border-left-width:
1px; border-bottom-width: 1px; border-top-width: 1px; border-right-color: blue; border-left-color: blue;
border-bottom-color: blue; border-top-color: blue; } div.form .hint { margin: 0; padding: 0; color: #999; } div.form
.note { font-style: italic; } div.form span.required { color: red; } div.form div.error label:first-child, div.form label.error,
div.form span.error { color: #C00; } div.form div.error input, div.form div.error textarea, div.form div.error select,
div.form input.error, div.form textarea.error, div.form select.error { background: #FEE; border-color: #C00; } div.form
div.success input, div.form div.success textarea, div.form div.success select, div.form input.success, div.form
textarea.success, div.form select.success { background: #E6EFC2; border-color: #C6D880; } div.form
.errorSummary { border: 2px solid #C00; padding: 7px 7px 12px 7px; margin: 0 0 20px 0; background: #FEE;
font-size: 0.9em; } div.form .errorMessage { color: red; font-size: 0.9em; } div.form .errorSummary p { margin: 0;
padding: 5px; } div.form .errorSummary ul { margin: 0; padding: 0 0 0 20px; } div.wide.form label { float: left;
margin-right: 10px; position: relative; text-align: right; width: 100px; } div.wide.form .row { clear: left; } div.wide.form
.buttons, div.wide.form .hint, div.wide.form .errorMessage { clear: left; padding-left: 110px; }

0

#2 User is offline   sensorario 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,986
  • Joined: 07-September 10
  • Location:Cesena (Italy)

Posted 12 October 2012 - 08:39 AM

Qual'è il problema?
0

#3 User is offline   michele 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 221
  • Joined: 02-August 12

Posted 12 October 2012 - 08:45 AM

Che il css viene scritto sotto forma di stringa e non applica le regole agli oggetti
0

#4 User is offline   sensorario 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,986
  • Joined: 07-September 10
  • Location:Cesena (Italy)

Posted 12 October 2012 - 08:49 AM

Mmmm sono confuso: è un css, dunque un file di testo. Quindi io mi aspetto che me lo scriva come file di testo. Ma non conosco il metodo/libreria che stai usando quindi potrei sbagliarmi.
0

#5 User is offline   michele 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 221
  • Joined: 02-August 12

Posted 12 October 2012 - 08:54 AM

in teoria dovrebbè vederlo con un normale file css e quindi non scriverlo ma applicare le regole agli oggetti.

http://www.yiiframew.../extension/pdf/
0

#6 User is offline   emafer 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 182
  • Joined: 23-February 12
  • Location:Amandola

Posted 12 October 2012 - 09:28 AM

E questo te lo da dopo aver dato il render o il render partial?
Da quanto ho capito tu carichi il css se poi non passi altri dati lui lo stampa, altrimenti lo applica.
Possibile?
ti va di postare il codice?
0

#7 User is offline   sensorario 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,986
  • Joined: 07-September 10
  • Location:Cesena (Italy)

Posted 12 October 2012 - 03:19 PM

Non devi, forse, includerlo tra i tag <style> e </style>.
Infondo se lo legge come HTML ...
0

#8 User is offline   michele 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 221
  • Joined: 02-August 12

Posted 13 October 2012 - 04:46 AM

allora ragazzi ho risolto per metà avvore ho cambiato oggetto ed ora mpdf, questo però funziana per metà ovvero attribuisce qualke regola ma non tutte.

$mpdf = Yii::app()->ePdf->mpdf();
               $mpdf = Yii::app()->ePdf->mpdf('', 'A4');
               $stylesheet1 = file_get_contents(Yii::getPathOfAlias('webroot.css') . '/screen.css');

               $mpdf->writeHTML($stylesheet1,1); 

0

#9 User is offline   emafer 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 182
  • Joined: 23-February 12
  • Location:Amandola

Posted 13 October 2012 - 06:59 AM

Scusa ma non manca sempre il render dell'html cui il css deve essere applicato?
0

#10 User is offline   michele 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 221
  • Joined: 02-August 12

Posted 13 October 2012 - 07:11 AM

ed infatti lo faccio :

$html2pdf->writeHTML($tabella,2);


dove :

$tabella = $this->widget('zii.widgets.grid.CGridView', array(
	                                   'dataProvider'=>PrefixarchivioPratiche::model()->search(),
                                           'enablePagination'=>FALSE, 
                                           'columns'=>array(
                                                               'N_pratica',
                                                               'anno',
                                                               'nome',
                                                               'collocazione'
                                                              )
                                       ),true);

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users