DigSig Element Rendering problem in PDF.

Status
Not open for further replies.

Ninpo

Member
I am not using Joomla 3.6 yet. Still on Joomla 3.51. I have a form that uses a Digital Signature element. The signature shows up in the details view and PDF view of the report but only when PDF debugging is set to true.

When I turned off PDF debugging to create and download the actual PDF, the signature is blank in the default PDF bootstrap template as well as the custom PDF template that I created.

I decided to print_r() the element that contains the signature directly into my custom report. The images attached shows what the print_r() statement spits out. The first image is the print_r() in the PDF, the second image is the print_r() in the PDF debug view. You can see that the coordinates are printed but the signature is never rendered in the actual PDF, only in the PDF debugging view.

Am I missing something to make the signature appear in the PDF, not just the PDF debug view?
 

Attachments

  • Missing Sig.png
    Missing Sig.png
    240.4 KB · Views: 141
  • Debug View.png
    Debug View.png
    155.1 KB · Views: 135
So I cracked open the code on the DigSig element and found where the problem was. In the digsig.php file line #71 you are trying to determine the requested format from JInput.

PHP:
$format     = $input->get('format');

You are attempting to use this code to convert the coordinates to an image for the PDF on line #84 - 95.

PHP:
if ($format === 'pdf')
            {
                $formModel = $this->getFormModel();
                $formId    = $formModel->getId();
                $rowId     = ArrayHelper::getValue($data, $pk);
                $elementId = $this->getId();

                $layoutData->link = COM_FABRIK_LIVESITE
                    . 'index.php?option=com_' . $this->package . '&task=plugin.pluginAjax&plugin=digsig&method=ajax_signature_to_image&'
                    . 'format=raw&element_id=' . $elementId . '&formid=' . $formId . '&rowid=' . $rowId . '&repeatcount=0';

                $layout = new JLayoutFile('fabrik-element-digsig-details-pdf', $basePath, array('debug' => false, 'component' => 'com_fabrik', 'client' => 'site'));
            }

However, JInput and $_GET are both not returning this value correctly. Instead JInput is returning 'html', so the conversion code is never executed. If I force the $format variable to be pdf by direct assignment, it works. I only did this to test the conversion process, but I know that this force will break the detail view so this is not a viable option. Upon diving further I discovered that the "format=pdf" is actually being returned as a $_SERVER["QUERY_STRING"] value, not as a $_GET or JInput value. Attached is a screen shot of my debug session showing the values of both the $format and the $_SERVER["QUERY_STRING"] calls in a watch window.
 

Attachments

  • DigSig Problem.png
    DigSig Problem.png
    581.7 KB · Views: 134
It's working on my site (PDF in form/details/list view).
Which Fabrik version are you running?
I think there was a fix addressing format=pdf some time ago.
 
This is the specs on the system I am running.
Joomla! 3.5.1
Apache/2.2.29 (Unix) mod_wsgi/3.5 Python/2.7.10 PHP/5.6.10 mod_ssl/2.2.29 OpenSSL/0.9.8zh DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.22.0
Fabrik 3.4.3
Fabrik Element - Digital Signature Pad 3.4.3

It's not the absolute latest version of Fabrik "3.5" but the last GitHub check-in, of significance, with digsig.php file was 4 months ago and the version I am running has these changes.

The link that creates the pdf is formatted as such;
Admin Side: http://<my host>/administrator/index.php?option=com_fabrik&task=details.view&format=pdf&formid=24&rowid=1
Client Side: http://<my host>/<report name>/details/24/1?format=pdf

So it's not a SEF issue since the admin side has the same problem and is not SEF. I also tested by disabling SEF, but had the same results. For some reason JInput is returning "HTML" instead of "PDF" for the format. The PDF format string is being returned in the server's query string and in the server's argv. This happens regardless of the PDF debugging switch, the difference is that when it is rendered to the screen, the DigSig does not need the special handling that is done when it is actually creating the PDF. So you do not see the issue unless PDF debugging is set to false.

Prior to posting this thread, I did see a post about this, from last year, talking about it; http://fabrikar.com/forums/index.php?threads/digital-signature-element-image-storage.40334/

The method to convert the signature to image works great, but only if you can reliably determine the format, which is my issue at the moment.
 
Last edited:
The format should be included in $_GET (and so in JInput) (it is on my site).

Are you running something like Admintools which may strip/reject URL params?
 
Nope not using admintools, I have in the past but I experienced too many conflicts with other extensions. I do use flexicontent for my CCK, but this should not affect the URL params. $_GET reports 'html' as well. Attached is a screen capture showing the $format, $_GET and $_SERVER responses.
 

Attachments

  • Watches Window.png
    Watches Window.png
    53.6 KB · Views: 115
Really no idea what is going on on your site.

In the PDF $_GET is an array[7], $_SERVER["QUERY_STRING"] contains a lot more than just format... , all including format=pdf
array(7) { ["option"]=> string(10) "com_fabrik" ["view"]=> string(7) "details" ["formid"]=> string(2) "24" ["rowid"]=> string(1) "1" ["format"]=> string(3) "pdf" ["Itemid"]=> string(3) "228" ["lang"]=> string(2) "de" }

string(86) "option=com_fabrik&view=details&formid=24&rowid=1&format=pdf&Itemid...

It's not the absolute latest version of Fabrik "3.5" but the last GitHub check-in,
If you are running the last GitHub and have done the "Post GitHub update steps" all Fabrik should show 3.5
http://fabrikar.com/forums/index.php?wiki/update-from-github/#post-github-update-steps
 
I figured out what was happening. There was a conflict with a plugin that was causing this value to be stripped out.

In Joomla 3.6.0 and Fabrik 3.5 the PDF button will not even create a PDF and in Joomla 3.51 and Fabrik 3.4.3 the value is just stripped because of this conflict.

The plugin that caused this problem is "System - Flexisystem, core functions". In that plugin there is a switch called "Redirect pdf format". If this option is set to "Yes", which is the default state, then it causes these strange issues with Fabrik. Once I set it to "No", all was good and the signature element got rendered.

Maybe there can be some sort of FAQ addendum about this for anyone that is running Flexicontent with Fabrik since it's such an obscure thing.

Below is an annotated screen shot of the plugin that caused this conflict.
 

Attachments

  • Fabrik Conflict.png
    Fabrik Conflict.png
    176.6 KB · Views: 345
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top