as per subject

CommentFileSizeAuthor
#11 boost-651226-2.patch13.25 KBberliner
#3 boost-651226.patch4.22 KBmikeytown2
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikeytown2’s picture

whats the path that the PDF module generates? is it something like node/12/pdf?

giorgio79’s picture

# Printer-friendly version (webpage format) (at www.example.com/print/nid)
# PDF version (at www.example.com/printpdf/nid)

Here is some more info: http://drupal.org/project/print :)

mikeytown2’s picture

FileSize
4.22 KB

try this patch, let me know if it works. Caching new content types is semi trivial; add a little bit of code and the rest should work like magic. To test & make sure it works, I would set Boost Tags: Set Header and tags; and look at the header; make sure there is a boost header in there.

giorgio79’s picture

Status: Active » Needs review

Thanks Mikey, will be testing this in the next few days, I am just installing this new site :)

mikeytown2’s picture

gzipping the pdf doesn't gain much; for a 3.5mb text pdf, i was able to get it down to 3.0mb. Source of that was 2.5mb text file, gzipping that reduces it down to 0.5mb.

giorgio79’s picture

It is still sweet to not have to generate the pdf at every request :)

mikeytown2’s picture

does the code work?

goldlilys’s picture

Subscribing

Ok, it's been 2 years and no one has replied. But does the code work? I keep getting random characters when printpdf gets cached by boost. Is there a fix for that?

designar’s picture

The module changed a bit internal – so we have to create a new patch for it.
I read the author don't see the need for the pdf caching and understand his point, but for some projects that might very helpful.

I'm going to try to add the new extension and filetype, but it will take some time, any tips are welcome ;)

mikeytown2’s picture

7.x version of boost makes caching PDF's (or any other content type) very easy, create a sub module that implements a boost hook. I am aware of this issue, working on the best way to make this happen; granted I'm spread pretty thin right now so it will take time.

berliner’s picture

Version: 6.x-1.x-dev » 6.x-1.21
FileSize
13.25 KB

New patch against 6.x-1.21.
I didn't include htaccess rules for gzipped pdfs (they are generated anyway) because I had troubles with my browsers (Safari and Chrome) on delivery (they always downloaded zipped and didn't show up as pdf files). If somebody has a good idea to solve this it should be included. For the moment cached pdfs are delivered uncompressed even if the browser accepts gzipped data.

Anonymous’s picture

PDF's should not be compressed, they are post script files that are zipped internally with some code. I'd look at the FilesMatch and Forcetype directives for .htaccess in Apache to solve the handling of the way they are downloaded.

berliner’s picture

Still, they are smaller when they are zipped. I do not particularly insist on this, but I could see the bandwidth benefits.

Anonymous’s picture

I worked on the fdpf project which was then used for updf and phpMyAdmin, the processing power to rezip the pdf's is not going to make it that worthwhile IMHO.

berliner’s picture

I agree and respect your expertise :-)
Concerning the proposed patch: the gzipped pdfs are already created, because I didn't find a way of preventing the generation. So in this case it would be useful to deliver them. The processing has already been done. On the basis of your argument it would make a lot of sense to prevent the compression of the pdfs altogether.

jvieille’s picture

Issue summary: View changes

This code works well.
I did need to cache images, I replicate the pdf stuff for the corresponding miage/jpeg and image/png that I was looking for caching.
This apparently works for anything.

A few mistakes, in boost.module:

in boost_cache_set()

-   elseif (stristr($types, 'image/jpeg') && BOOST_CACHE_HTML) {
+  elseif (stristr($types, 'image/jpeg') && BOOST_CACHE_PDF) {
        $extension = BOOST_PDF_EXTENSION;
     }

in boost_htaccess_cache_dir_generate()

added

-   if (!BOOST_DISABLE_CLEAN_URL && (BOOST_CACHE_HTML || BOOST_CACHE_XML || BOOST_CACHE_JSON)) {
+  if (!BOOST_DISABLE_CLEAN_URL && (BOOST_CACHE_HTML || BOOST_CACHE_XML || BOOST_CACHE_JSON || BOOST_CACHE_PDF)) {
/

modified

  +  if (BOOST_CACHE_PDF) {
-    $files .= "$_xml|";
+ $files .= "$_pdf|";
    $files = trim($files, '|');
    $string .= "<FilesMatch \"\.($files)$\">\n";
    $string .= "  ForceType application/pdf\n";
    $string .= "</FilesMatch>\n";
  }

Thanks!

anandbej’s picture

I need to know whether a file is cached or not.
Is the time taken for the pdf loading the only indicator to say whether the pdf is cached or not?

Where is the cached pdf saved? only in the browser or somewhere in the directory inside the server?

apaderno’s picture

Status: Needs review » Closed (outdated)

I am closing this feature request, as Drupal 6 is no longer supported. Please re-open it if you would like the feature implemented in the Drupal 7 or 8 version of the module.