【问题标题】:pdflib - is there's a way to rotate the page of pdfpdflib - 有没有办法旋转 pdf 的页面
【发布时间】:2020-09-23 11:04:34
【问题描述】:

旋转前 这就是我用 A4 Page 生成的。 before

旋转后 生成后,我想像这样旋转页面。

请帮助我。 after

【问题讨论】:

    标签: pdflib


    【解决方案1】:

    完全有可能!

    查看PDFLib Cookbook(学习的绝佳资源!),更具体地说是rotate_pages 的示例。

    基本上,您将页面导入文档并以新方向放置。这将根据需要“旋转”页面。

    食谱中的 PHP 示例代码:

    /* Loop over all pages of the input document */
    for ($pageno = 1; $pageno <= $endpage; $pageno++)
    {
        $page = $p->open_pdi_page($indoc, $pageno, "");
    
        if ($page == 0)
            throw new Exception("Error: " . $p->get_errmsg());
    
        /* Page size may be adjusted by fit_pdi_page() */
        $p->begin_page_ext(0, 0, "width=a4.width height=a4.height");
    
        /* Place the imported page on the output page. Adjust the page size
        * automatically to the size of the imported page. Orientate the
        * page to the west; similarly you can orientate it to the east or
        * south, if required.
        */
        $p->fit_pdi_page($page, 0, 0, "adjustpage orientate=west");
    
        $p->close_pdi_page($page);
    
        $p->end_page_ext("");
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-02
      • 1970-01-01
      • 2013-07-03
      • 2010-09-30
      • 1970-01-01
      相关资源
      最近更新 更多