【问题标题】:CMS and store hi-resolution images in generated pdfCMS 并将高分辨率图像存储在生成的 pdf 中
【发布时间】:2014-08-05 07:55:31
【问题描述】:
我正在寻找用于发布软件手册的优质 CMS。
要求:
- 将手册页发布为带有缩略图的网页,并在点击图片后显示全分辨率,
- 将手册页导出为 pdf 文件全分辨率图像而不是缩略图。
我发现恕我直言,最好的 wiki 系统名为 Tiki Wiki (https://info.tiki.org/),但是当我导出为 pdf 时,我会得到低分辨率的缩略图。
【问题讨论】:
标签:
pdf
content-management-system
pdf-generation
wkhtmltopdf
tiki-wiki
【解决方案1】:
我通过非常简单的Tiki Wiki代码修改解决了这个问题:
修改 lib/wiki-plugins/wikiplugin_img.php 以强制使用完整的图像分辨率,而不是在打印页面模式下缩略图(插入代码 1)并将生成的 HTML 中的图像重新缩放 0.5 倍(插入代码2):
[...]
function wikiplugin_img( $data, $params )
{
[...]
$imgdata = array_merge($imgdata, $params);
// inserted code 1 (~410 line)
if ($GLOBALS['section_class']=="tiki_wiki_page print"){
$imgdata['thumb'] = '';
}
// end of inserted code 1
//function calls
if ( !empty($imgdata['default']) || !empty($imgdata['mandatory'])) {
[...]
$fwidth = '';
$fheight = '';
if (isset(TikiLib::lib('parser')->option['indexing']) && TikiLib::lib('parser')->option['indexing']) {
$fwidth = 1;
$fheight = 1;
} else {
// inserted code 2 (~410 line)
if ($GLOBALS['section_class']=="tiki_wiki_page print"){
$fwidth = $imageObj->get_width() / 2;
$fheight = $imageObj->get_height() / 2;
} else {
$fwidth = $imageObj->get_width();
$fheight = $imageObj->get_height();
}
// end of inserted code 2 (~638 line)
}
[...]
现在,通过 wkhtmltopdf 打印为 pdf 后,我们得到了带有小但全分辨率图像的 pdf。
其他修改:
-
将以下行添加到 cms/cssmenus.css(或打印模式中包含的其他 css)以增加图像标题的底部边距:
div.thumbcaption {
margin-bottom: 5mm;
}
删除 templates/tiki-show_content.tpl 中从 171 到 ~175 的行,以删除“原始文档位于”脚。