Issues on the PDF and TeX generation

Events happening in the community are now at Drupal community events on www.drupal.org.
franqui's picture

I found two disturbing issues when creating a PDF or a Tex file from a node.

First, the PDF is not updated, once it is created the first time. The reason is this test located in the drutex_node2pdf_wrapper function:

  if (!is_file("$pdf_dir/{$node->nid}.pdf")) {
    drutex_node2pdf($nid);
  }

I just commented the test in my site. PDF should be generated each time it is requested, as node might have been updated in the meanwhile.

Second, the redirection to the recently generated file is wrong. Again the reason is a line in the drutex_node2pdf_wrapper:

drupal_goto("$pdf_dir/{$node->nid}.pdf");

The drupal_goto() function redirects to an internal Drupal node, which is fine if clean URLs are enabled (i.e.: http://mysite.com/node/24). However, if they're not enabled (which is my case) you get a redirection to http://mysite.com/?q=file/tex/24.pdf, instead of the right URL http://mysite.com/file/tex/24.pdf. This can be easily fixed:

drupal_goto(file_create_url("$pdf_dir/{$node->nid}.pdf"));

as the function file_create_url() does not create a link to an internal node, but to a file, which is the case.

Hope this helps the devs and gets fixed in next releases of the module.

Great module, btw. Congratulations, guys.

Fran.

Comments

That does the trick! Thanks!

globber's picture

That does the trick! Thanks!

SoC 2006: DruTeX

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: