Article en PDF

More
7 years 7 months ago - 7 years 7 months ago #63910 by ggppdk
Replied by ggppdk on topic Article en PDF
Hello

that is expected, because you passed variable that do not exist, replace line:

try replacing line:
Code:
$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($displayData['item'], $displayData['params']);

with:
Code:
$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($item, $this->params);


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 7 years 7 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
7 years 7 months ago #63914 by charlynancy
Replied by charlynancy on topic Article en PDF
Hi Georgios,
Thank you for your code, it is fixing the error (variable that do not exist).
But the PDF function does not operate.
I tested it with com_content : that give the same problem.
I will try other third component or create an php function to generate PDF.

If you have an advice to obtain this function (generating PDF page in Flexicontent) it would certainly help me for this task.

Please Log in or Create an account to join the conversation.

More
7 years 7 months ago - 7 years 7 months ago #63917 by charlynancy
Replied by charlynancy on topic Article en PDF
i believe that i found a quiet good solution : Install the TCPDF Library in joomla.

Here is an extension to install it
I will try to explain in a tuto , how to implement this in the template of FlexiContent.
but I still have more testing this solution...
Last edit: 7 years 7 months ago by charlynancy.

Please Log in or Create an account to join the conversation.

More
7 years 7 months ago #63920 by micker
Replied by micker on topic Article en PDF
if you can do this and doing a tuto !!!!!
i will be happy

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
7 years 7 months ago - 7 years 7 months ago #63955 by charlynancy
Replied by charlynancy on topic Article en PDF
Voici le tuto :
1°) Télécharger TCPDF Library puis installer le sur votre site
il s'installe comme un plugin , la difficulté c'est que le fichier est gros et l'installation peut échouer le temps d'upload du zip pouvant être trop long
Donc, Je l'ai installé en uploadant le zip dans mon répertoire /tmp/
Puis, en le dézipant dans le répertoire /tmp/ j'ai obtenu le répertoire /tmp/tcpdf-master/ et c'est à partir de ce répertoire que j'ai fait l'installation

2°) on modifie le code de sa template Flexicontent .
Je prendrai l'exemple de la template présentation en HTML en mode fiche.
Nous allons générer un fichier PDF de la fiche (l'item en mode détail)
Ce PDF contiendra du code HTML et un champs personnalise que nous avons créé (ce champs s'appelle field_resume)
Dans le prochain topic je vais détailler la modification du code de la template presentation...
Last edit: 7 years 7 months ago by charlynancy.

Please Log in or Create an account to join the conversation.

More
7 years 7 months ago #63956 by charlynancy
Replied by charlynancy on topic Article en PDF
Modification du code de la template presentation

1°) dupliquez la template presentation et appelez la presentation-pdf
2°)coller dans le fichier /components/com_flexicontent/templates/presentation-pdf/item.php
le contenu du code du fichier /components/com_flexicontent/tmpl_common/item_layouts/modular.php
3°)Voilà on peut maintenant commencer à éditer le fichier /components/com_flexicontent/templates/presentation-pdf/item.php
je vais faire apparaître mon lien vers mon fichier PDF sous le titre de ma fiche, donc après le code suivant (environ ligne 172)
Code:
<!-- EOF item title --> <?php endif; ?>
voici le code à ajouter avec les commentaires php pour explications
Code:
<?php //activer le champs field_resume pour pouvoir l'afficher de manière personalisée $myfield_html = FlexicontentFields::getFieldDisplay($item, 'field_resume'); ?> <?php // Include the main TCPDF library (search for installation path). require_once JPATH_LIBRARIES . '/tcpdf/tcpdf.php'; // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // remove default header $pdf->setPrintHeader(false); // set footer fonts $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set font $pdf->SetFont('dejavusans', '', 10); // add a page $pdf->AddPage(); // create some HTML content $html = '<h1>HTML Example</h1> <div>autre code html </div> <div style="text-align:center">blabla<br /> blabla </div>' . $item->fields['field_resume']->display; //ci-dessus j'appelle l'affichage de mon champs perso field_resume // output the HTML content $pdf->writeHTML($html, true, false, true, false, ''); // reset pointer to the last page $pdf->lastPage(); //Close and output PDF document, j'enregistre le Pdf dans le répertoire /images/ $pdf->Output($_SERVER['DOCUMENT_ROOT'] . 'SOUS_REPERTOIRE/images/' . $this->item->alias . '.pdf', 'F'); //attention à bien préciser le chemin, personnalisez 'SOUS_REPERTOIRE/images/' //si votre site est installé dans un sous-répertoire de votre dossier racine ça donnera donc 'SOUS_REPERTOIRE/images/' //mon chemin complet était par exemple /var/www/default/SOUS_REPERTOIRE/images // Voila on va maintenant générer un lien vers le fichier pdf crée , le nom du fichier sera l'alias de la fiche echo '<a target="_BLANK" href="images/' . $this->item->alias . '.pdf"><strong>Imprimez le PDF</strong></a>'; ?>

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.304 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline