PDFview Inline Images
danielb - October 11, 2007 - 04:29
| Project: | Pdfview |
| Version: | 5.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Everytime I try to put an image into my PDFview content, there is a forced line break right after the image.
So for my series of thumbnail images, they appear one-per-line, and it looks quite sloppy.
I know the table layout idea doesn't work. What are my options?

#1
extend pdfview or hack tcpdf to skip line break after the 'img' tag.
#2
I take it that u found a solution, considering the changelog of tcpdf reads
- Image function now has a new "align" parameter that indicates the alignment of the pointer next to image insertion and relative to image height. The value can be:T: top-right for LTR or top-left for RTL
M: middle-right for LTR or middle-left for RTL
B: bottom-right for LTR or bottom-left for RTL
N: next line
- Attribute "align" was added to <img> html tag to set the above image "align" parameter. Possible values are:
top: top-right for LTR or top-left for RTL
middle: middle-right for LTR or middle-left for RTL
bottom: bottom-right for LTR or bottom-left for RTL
meaning u can just pass align='top' in ur img-tag to the pdfview_html theme function and it'll place ur images on the same line
even though it's been ages since u posted this issue, I still felt like posting this solution, since ppl (like me) still end up here after hours of googling
I'm using the PDFview module because i'm forced to use D5 instead of D6 and I'm trying to make a proper pdf generation of my ubercart product pages
maybe useful to some(in template.php):
<?php
function phptemplate_pdfview_node(&$pdf, $node) {
$pdf->AddPage();
$pdf = theme('pdfview_title', $pdf, $node->title);
//$author = strip_tags(theme('username', $node));
//$pdf = theme('pdfview_author', $pdf, $author);
//$pdf = theme('pdfview_published', $pdf, $node->created);
if (node_hook($node, 'view')) {
node_invoke($node, 'view');
}
else {
$node = node_prepare($node);
}
node_invoke_nodeapi($node, 'view');
// checking if there are any images
if (isset($node->field_image_cache['0'])) {
// displaying all images on the same line
foreach ($node->field_image_cache as $images) {
$content = $content . "<img align='top' src='" . base_path() . "files/imagecache/product/files/" . $images['filename'] . "' width='100px' height='100px'> ";
}
// adding empty paragraph to make sure text doesn't end up in the middle of the images
$content.= "<p></p>";
// closing the "if"
}
if (isset($node->model) && isset($node->length)) {
// adding modelnumber and dimensions on seperate lines but within the same paragraph and starting with a linebreak
$content .= "\n<p>Reference: " . $node->content['model']['#value'] . "\n";
$content .= "Dimensions: " . $node->length . " " . $node->length_units . " x " . $node->width . " " . $node->length_units . " x " . $node->height . " " . $node->length_units . "</p>";
}
// adding product description, replaceing <p> with nothing and </p> with \n so you don't end up with 7 miles between each paragraph
$content .= str_replace("<p>", "", str_replace("</p>", "\n", $node->content['body']['#value']));
//$content = drupal_render($node->content);
$content = pdfview_check_images($content);
$pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN);
//$pdf->setBarcode("" . $node->content['model']['#value'] . "");
$pdf = theme('pdfview_html', $pdf, $content);
return $pdf;
}
?>
this spits out a somewhat decent PDF version of a product node
I know it's messy, but it works >:D
hope it helps some1 but myself and my client :p
#3
Thanks, I'll be sure to come back here next time I have to build one of these monstrosities.