Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
Numbers_Activities_(1-100).pdf | 550.39 KB | dnystwn |
Comments
Comment #1
redmonp CreditAttribution: redmonp commentedSeconded. The module exports standard page nodes to pdf just fine, but does not export any CCK fields, just the cck title, user and timestamp.
Comment #2
Egon Bianchet CreditAttribution: Egon Bianchet commentedI 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.
Comment #3
danielb CreditAttribution: danielb commentedI 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.
Comment #4
danielb CreditAttribution: danielb commentedbtw half way through that post i started calling $node_content : "$content_array"... woops :/