[SOLVED] PDF output corrupt

marcq

Member
Joomla! 3.7.2 | Fabrik 3.6 \ Github 02/06/2017
---------------------------------------------------------------

I have a problem with all the output of the pdf templates I have created.

custom_css.php doesn't seem to be applied. I tried to find out why and wanted to activate the PDF debug, but even by setting it to Yes my button is still triggering the generation of a pdf :

https://www.screencast.com/t/mTX8E5PNFA

Thank you in advance for your support. Cheers, marc
 
The domPDF library (and the setup) has changed to the new domPDF version in the recent GitHub.

What is your "button" doing exactly?
Does the standard PDF button (list, form) show the same issues?
 
Hi troester,

Thank you for your reply. My button is triggering a js code on click (Button Element Javascript)

Code:
printInvoicefe(this);

Code:
function printInvoicefe() {

    // GET FORM REFERENCE
    var form = Fabrik.getBlock('form_59');

    // GET VAR
    var form_nr = 59;
    var invoiceExist = form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue();
    var idRepeat = form.formElements.get('gprh_fabrik_user_registration_332_repeat___id').getValue();
    var memberid = form.formElements.get('gprh_fabrik_user_registration___id').getValue();
   
    var grouptab = '#group-tab59_';
    var tabnumber = '_6';
    var tabgroupnumber = grouptab + memberid + tabnumber;

        if     (
        (form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue() == '0')
        ) {
   
        // GENERATE THE INVOICE
        window.open('http://www.gprh.ch/index.php/gestion-membres-2/gestion-membres/membres-actifs-2/membres-actifs-attente-paiement/details/' + form_nr + '/' + memberid + '?format=pdf&layout=bootstrap_printinvoice_fe&repeatNum=' + idRepeat);
       
        form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').update('1');

        form.mockSubmit('apply');

    }     else if (
          (form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue() == '1')
        ) {
   
        // GENERATE THE INVOICE
        window.open('http://www.gprh.ch/index.php/gestion-membres-2/gestion-membres/membres-actifs-2/membres-actifs-attente-paiement/details/' + form_nr + '/' + memberid + '?format=pdf&layout=bootstrap_printinvoice_fe&repeatNum=' + idRepeat);
       
        form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').update('2');

        form.mockSubmit('apply');

    }     else if (
          (form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue() == '2')
        ) {
   
        // GENERATE THE INVOICE
        window.open('http://www.gprh.ch/index.php/gestion-membres-2/gestion-membres/membres-actifs-2/membres-actifs-attente-paiement/details/' + form_nr + '/' + memberid + '?format=pdf&layout=bootstrap_printinvoice_fe&repeatNum=' + idRepeat);

    }
};

Debug work indeed with the normal PDF button (Form layout).

And the PDF print is as he should be, not corrupt.

But I need being able to print my PDF from the "Imprimer Facture" button Element which is defined in one of the form tab.

Any clue how I could fix this, since it was working perfect before the update.

Cheers, marc
 
Your screencast is showing the site webamazingapps.com/..., your link is going to gprh.ch.

Is this the identical site at all?
It doesn't look like because your PDF debug setting doesn't have an effect.
 
Hi troester and hugh,

Thank you troester, Site is identical. I migrate the production version of the site to my test server. But no impact, problem remains.

You can find all details (Hugh post #4) needed in Site Name & Notes - GPRH - test and development site.

Thanks in advance for your support. cheers, marc
 
Site is identical. I migrate the production version of the site to my test server.
So it't an identical copy but not the same site and setting debug or changing CSS on your copy won't have an effect on gprh.ch (which you are calling with the link).
Your link must point to your test site, too, if you want to test the PDF.
 
Hi there,
Deep apologies, I add different site versions on my test server and I changed the path in the wrong template default.php file. I oversaw it. It is working perfectly now.
Sorry to have bother you with this.
Cheers and thanks, marc
 
Hi,

Problem remains.

When I'm printing the PDF file in my development server the format, css is applied.

I created an akeeba backup which I installed with Akeeba kickstart in my customer production server.

Installation succeed without any issue.

I changed the url in my form_59.js file accordingly :

File and function of the production server :

Code:
function printInvoicefe() {

  // GET FORM REFERENCE
  var form = Fabrik.getBlock('form_59');

  // GET VAR
  var form_nr = 59;
  var invoiceExist = form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue();
  var idRepeat = form.formElements.get('gprh_fabrik_user_registration_332_repeat___id').getValue();
  var memberid = form.formElements.get('gprh_fabrik_user_registration___id').getValue();
  var grouptab = '#group-tab59_';
  var tabnumber = '_6';
  var tabgroupnumber = grouptab + memberid + tabnumber;

    if  (
    (form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue() == '0')
      ) {
     
      window.open('http://www.gprh.ch/index.php/gestion-membres-2/gestion-membres/membres-actifs-2/membres-actifs-attente-paiement/details/' + form_nr + '/' + memberid + '?format=pdf&layout=bootstrap_printinvoice_fe&repeatNum=' + idRepeat);
   
      form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').update('1');

      form.mockSubmit('apply');

    } else if (
      (form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue() == '1')
      ) {
     
      // GENERATE THE INVOICE
      window.open('http://www.gprh.ch/index.php/gestion-membres-2/gestion-membres/membres-actifs-2/membres-actifs-attente-paiement/details/' + form_nr + '/' + memberid + '?format=pdf&layout=bootstrap_printinvoice_fe&repeatNum=' + idRepeat);
     
      form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').update('2');

      form.mockSubmit('apply');

    }   else if (
      (form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue() == '2')
      ) {
     
      // GENERATE THE INVOICE
      window.open('http://www.gprh.ch/index.php/gestion-membres-2/gestion-membres/membres-actifs-2/membres-actifs-attente-paiement/details/' + form_nr + '/' + memberid + '?format=pdf&layout=bootstrap_printinvoice_fe&repeatNum=' + idRepeat);
      } 
};
function printInvoicefe() {

  // GET FORM REFERENCE
  var form = Fabrik.getBlock('form_59');

  // GET VAR
  var form_nr = 59;
  var invoiceExist = form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue();
  var idRepeat = form.formElements.get('gprh_fabrik_user_registration_332_repeat___id').getValue();
  var memberid = form.formElements.get('gprh_fabrik_user_registration___id').getValue();
  var grouptab = '#group-tab59_';
  var tabnumber = '_6';
  var tabgroupnumber = grouptab + memberid + tabnumber;

    if  (
    (form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue() == '0')
      ) {
     
      window.open('http://www.gprh.ch/index.php/gestion-membres-2/gestion-membres/membres-actifs-2/membres-actifs-attente-paiement/details/' + form_nr + '/' + memberid + '?format=pdf&layout=bootstrap_printinvoice_fe&repeatNum=' + idRepeat);
   
      form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').update('1');

      form.mockSubmit('apply');

    } else if (
      (form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue() == '1')
      ) {
     
      // GENERATE THE INVOICE
      window.open('http://www.gprh.ch/index.php/gestion-membres-2/gestion-membres/membres-actifs-2/membres-actifs-attente-paiement/details/' + form_nr + '/' + memberid + '?format=pdf&layout=bootstrap_printinvoice_fe&repeatNum=' + idRepeat);
     
      form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').update('2');

      form.mockSubmit('apply');

    }   else if (
      (form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue() == '2')
      ) {
     
      // GENERATE THE INVOICE
      window.open('http://www.gprh.ch/index.php/gestion-membres-2/gestion-membres/membres-actifs-2/membres-actifs-attente-paiement/details/' + form_nr + '/' + memberid + '?format=pdf&layout=bootstrap_printinvoice_fe&repeatNum=' + idRepeat);
      } 
};

File and function in my development server :

Code:
function printInvoicefe() {

    // GET FORM REFERENCE
    var form = Fabrik.getBlock('form_59');

    // GET VAR
    var form_nr = 59;
    var invoiceExist = form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue();
    var idRepeat = form.formElements.get('gprh_fabrik_user_registration_332_repeat___id').getValue();
    var memberid = form.formElements.get('gprh_fabrik_user_registration___id').getValue();
 
    var grouptab = '#group-tab59_';
    var tabnumber = '_6';
    var tabgroupnumber = grouptab + memberid + tabnumber;

    if  (
    (form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue() == '0')
      ) {
   
      window.open('http://www.webamazingapps.com/projects/gprh_3105063/index.php/gestion-membres-2/gestion-membres/membres-actifs-2/membres-actifs-attente-paiement/details/' + form_nr + '/' + memberid + '?format=pdf&layout=bootstrap_printinvoice_fe&repeatNum=' + idRepeat);
 
      form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').update('1');

      form.mockSubmit('apply');

    } else if (
      (form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue() == '1')
      ) {
   
      // GENERATE THE INVOICE
      window.open('http://www.webamazingapps.com/projects/gprh_3105063/index.php/gestion-membres-2/gestion-membres/membres-actifs-2/membres-actifs-attente-paiement/details/' + form_nr + '/' + memberid + '?format=pdf&layout=bootstrap_printinvoice_fe&repeatNum=' + idRepeat);
   
      form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').update('2');

      form.mockSubmit('apply');

    }   else if (
      (form.formElements.get('gprh_fabrik_user_registration_332_repeat___status_invoice').getValue() == '2')
      ) {
   
      // GENERATE THE INVOICE
      window.open('http://www.webamazingapps.com/projects/gprh_3105063/index.php/gestion-membres-2/gestion-membres/membres-actifs-2/membres-actifs-attente-paiement/details/' + form_nr + '/' + memberid + '?format=pdf&layout=bootstrap_printinvoice_fe&repeatNum=' + idRepeat);
      }
};


Please look at the attached files :
DEVSERVER-102-20.pdf : PDF output from the dev server which is ok
PRODSERVER-102-20.pdf : PDF output from the prod server which is corrupt

Would still need some help here. Thanks in advance, cheers, Marc
 

Attachments

  • DEVSERVER-102-20.pdf
    1.1 MB · Views: 61
  • PRODSERVER-102-20.pdf
    1 MB · Views: 59
Last edited:
emm,
Sorry, I copy| paste the wrong code in my thread, but in the production server side js file we have the right url for the "window.open('http://www.gprh.ch/index.php..." and it isn't working.

Thanks in advance for your support. marc
 
Last edited:
Your notes say
"Finance d?entr?e" Button Element : "Imprimer Facture"
but there's no button element (gprh site)
+
there's no backend acces with the creditals you gave.
 
Hi troester,
I'm a catastrophy...
I have checked the access both backend and frontend and it is working. You will find again all information in My Sites GPRH plus a link to a video which shows whats happen.
Button are available now, I forgot to prepare the record, since a date needs to be filled into the element in order to make the button available.
Now it should be good, sorry I'm exhausted. Thank you in advance for your help, cheers, marc
 
Hi troester,

Please use fabrikar (username) for frontend and fabrik (username) for backend and it will work.

https://www.screencast.com/t/WXYS3ehD3OW

Indeed if you use fabrik in frontend you will have many redirections which are caused by an extension. I need to fine tune the new version of redirect on login.

I tested the 2 versions and logins work with debug PDF set to yes.

Thank you in advance for your support, cheers, marc
 
Creditals are working (in the backend).
But in frontend I can't login because of "to many redirects"
 
Hi,

I have checked everything and the problem still remains.

PDF output are printed correctly from my development server environment, but when I'm pushing my files into production (with akeeba kickstart tool), then the PDF output are corrupt.

I'm stuck and I need your expertise here. I have checked and enabled access to the production version in frontend and backend. Logins and passwords are working (no strange redirection etc.) and details can be found under "Your Fabrik Sites" -> GPRH. I would appreciate if you could have a look.

Thanks in advance, cheers, marc

Please find attached the PDF template
 

Attachments

  • PHP PDF.txt
    22.3 KB · Views: 52
solved, just needed to add the path of the custom_css file into my custom template code :

Code:
<link rel="stylesheet" href="components/com_fabrik/views/details/tmpl/bootstrap_printinvoice_ori/custom_css.php"></a>
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top