any news about caching support via view cache? Actually if I enable it in the view I receive the pdf as expected the first time but a pdf containing a single empty page next time

Comments

I forgot to say... I can enable "Query results" without problem, is the "Rendered output" cache option that breaks things

Currently I m fighting with stabilizing of the module. I need to this later. The rendered output cache cant work, because this works on the HTML layer, but we are above this. A potential approach could be to store the PDF object in a cache and load it later. But at the moment I have no time to implement this.

sub

Any update on this? Generating these PDFs is a huge load on a server. Anything with much traffic is likely to have issues.

Status:Active» Postponed

Status:Postponed» Needs work
Issue tags:+accepted feature request

For the next version caching will be supported.

If you want to add more info about witch caching system you're using. Because I'm thinking in the normal caching drupal system.

Issue tags:+#views_pdf_7.x-2.x

Adding tagging next version.

I haven't really thought this through, just throwing ideas out. Maybe something like D6's Imagecache module or D7's core Image system may be a good model to base this on.

maybe i dont undertand, because of that i ask :)
do you mean to create the pdf when it is called and the saving it?
that sounds interesting for the use case of a magazine, where you create the pdf when a user needs it.

though, this should be an option, in my opinion, because there is other use case: invoices. if you want to send the pdf by email after the product is sent, you need to save it to the server with rules (it is working already).

maybe, in the magazine example, it could be done by a rule that checks if the pdf exists and if not, it creates. what do you think?

by the way, @mrfree, @sachbearbeiter and @kerasai, which is your use case?
would you like to collaborate to betatest, develop or document this feature? :)

or making a cron task? since you say it is a huge load on the server (i imagine a magazine with 50 pages), then to act as image cache will not avoid that. if it is a cron task, you can see the moments where your server can run it better...

In response to my suggestion in #8:

This is not a simple problem, so there's probably not a simple answer. In a very vague way, this is how it would need to work:

Generate and save the PDF:

Let this happen when the user requests it. So that means when an HTTP request is made to the path/file, not when a link to it is rendered in a page. D7 Image system does this, and it wouldn't be incredibly difficult to build something that works similarly.

HTTP request to sites/default/files/viewspdf/[subdirs/filename]

  • First time through there is no file, so Drupal generates the file and serves it to the user.
  • Subsequent times, the file already exists and Apache (or whatever webserver you're using) serves the file directly to the user.

Considerations that come to my mind

  • Arguments/contextual filters for the View
  • Private file system

Invalidate stale PDFs:

Determine when the content of that PDF has changed and purge appropriate cached files.

  • Cron or time-based purging of files. This is a crude solution, it would have some drawbacks but would work.
  • Monitor events that change output of the View. IMO, this is the complicated part. Somehow you'd have to track what's in the result of the View and figure out when the output of the View has changed.

@kerasai very good and fast reply :)

Generate and save the PDF:

2 cases depending the size of the pdf: in my case 1 or 2 pages that doesnt load the server, while in a magazine that i made, there where sometimes 80 pages and then it was a problem... in this last case is where i recommend cron to make the task in an hour that you see correct.

image cache can be good for a site with many articles that change often, but if you have a big pdf, like the weekly magazine as a whole, the problem keeps being the load on the server.

Invalidate stale PDFs:
not always important, since in an invoice, there are not changes.

Version:7.x-1.x-dev» 7.x-2.x-dev