CMS and store hi-resolution images in generated pdf

痞子三分冷 提交于 2019-12-13 04:18:39

问题


I'm looking for good CMS for publishing software manuals.

Requirements:

  • publish manual pages as web pages with thumbnails and shows full resolution after click on image,
  • exporting manual pages to a pdf file with full resolution images instead to thumbnails.

I found IMHO best wiki system named Tiki Wiki (https://info.tiki.org/) but when I export to pdf then I gets low resolution thumbnail.


回答1:


I solve this problem by very simple Tiki Wiki code modification:

Modify lib/wiki-plugins/wikiplugin_img.php to force using full image resolution instead to thumbnail in print page mode (inserted code 1) and rescale images in generated HTML by 0.5 factor (inserted code 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)

     }

[...]

Now, after printing to pdf by wkhtmltopdf we gets pdf with small but full resolution images.

Additional modifies:

  • Adds following lines to cms/cssmenus.css (or other css included in print mode) for increase bottom margin of image caption:

    div.thumbcaption {
        margin-bottom: 5mm;
    }
    
  • Removes lines from 171 to ~175 in templates/tiki-show_content.tpl for remove the "The original document is available at" foot.



来源:https://stackoverflow.com/questions/24227632/cms-and-store-hi-resolution-images-in-generated-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!