When I try to view the pdf version of a custom node, the only two things that the pdf show are the title of the node and the submission information. The rest of the page (that's supposed to contain custom fields) is blank.

Advise?

CommentFileSizeAuthor
Numbers_Activities_(1-100).pdf550.39 KBdnystwn
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

redmonp’s picture

Seconded. The module exports standard page nodes to pdf just fine, but does not export any CCK fields, just the cck title, user and timestamp.

Egon Bianchet’s picture

Component: Miscellaneous » Code

I committed some really basic CCK support to DRUPAL-5 ... It relies to the TCPDF html conversion, so the results are just bad.

The best way to get pdf output for complex nodes is still to override the themeable functions and fine-tune the output.

danielb’s picture

I found a way to do it.
go to your theme's template.php and create this function:

function phptemplate_pdfview_node(&$pdf, $node) {}

copy the content of theme_pdfview_node() from the pdfview.module file into there.

Now make a new array $node_content and give it the value of $node->content, and then from then on use $node_content instead of the default $node->content (you'll have to go through and replace these in the rest of the function)

Comment out the following lines if you want to get rid of author/published

$author = strip_tags(theme('username', $node));
$pdf = theme('pdfview_author', $pdf, $author);
$pdf = theme('pdfview_published', $pdf, $node->created);

Now concern yourself with this: $content_array['body']['#value']

You can modify the body#value field as much as you like like this;

$content_array['body']['#value'] = "some new text".$some_variable.$content_array['body']['#value'];
or
$content_array['body']['#value'] .= $some_stuff;

It understands some HTML markup, and will interpret "backslash n" for newline (\n) as well, afaik.

feel free to also do some print_r($content_array) and see what info is available to you. You may want to set some of your sub-arrays to the empty-string like "" to hide certain CCK fields.

danielb’s picture

btw half way through that post i started calling $node_content : "$content_array"... woops :/