In print_pdf_generate_path() the cache system is only activated if $node->nid is set. For non-content pages that use a "psuedo node" set up by _print_generate_path(), there is no $node->nid , so the generated pdf is not cached.

In the attached patch the pdf is cached using the node id as a filename if the pdf is based on a node, or a slugged version of the page path if the pdf is not node based.

CommentFileSizeAuthor
print-pdf-cache-for-non-nodes.patch934 bytestripper54

Comments

tripper54’s picture

Status: Active » Needs review
jcnventura’s picture

Status: Needs review » Closed (works as designed)

There's a reason why the caching mechanism is like this.. Simply put, there's no way to be sure that the cache is valid for non-content pages, as they get generated on the spot. The current behavior of the system is to delete the cached file when the node is updated to force a re-generation, and this is not possible with non-content pages.

See http://drupal.org/node/516466#comment-6390678 for a brief description of the caching mechanism.