1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        spatie-pdf-to-imagePDF 轉(zhuǎn)圖像工具

        聯(lián)合創(chuàng)作 · 2023-09-29 23:08

        spatie-pdf-to-image 提供了一個易于使用的類來將 PDF 轉(zhuǎn)換為圖像。

        要求

        需安裝 Imagick 和 Ghostscript

        安裝

        該軟件包可以通過 composer 安裝:

        composer require spatie/pdf-to-image
        

        用法

        將 pdf 轉(zhuǎn)換為圖像很容易。

        $pdf = new Spatie\PdfToImage\Pdf($pathToPdf);
        $pdf->saveImage($pathToWhereImageShouldBeStored);
        

        如果傳遞給saveImage的路徑有擴展jpg,jpegpng,圖像像將被保存為該格式。否則輸出將是 jpg。

        其他方法

        可以獲得 PDF 中的總頁數(shù):

        $pdf->getNumberOfPages(); //returns an int
        

        默認情況下,將呈現(xiàn) PDF 的第一頁。如果想渲染另一個頁面,你可以這樣做:

        $pdf->setPage(2)
            ->saveImage($pathToWhereImageShouldBeStored); //saves the second page
        

        可以覆蓋輸出格式:

        $pdf->setOutputFormat('png')
            ->saveImage($pathToWhereImageShouldBeStored); //the output wil be a png, no matter what
        

        可以將壓縮質(zhì)量設(shè)置為 0 到 100:

        $pdf->setCompressionQuality(100); // sets the compression quality to maximum
        
        瀏覽 28
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            av五月天在线 | 国产免费福利小视频 | 久操免费在线 | 国产又粗又猛又爽 | 女生扒开尿道让男生捅 | 国产乱叫456在线 | 大香蕉伊人综合 | 古装一级黄色片 | 天天性综合 | 午夜成人无码免费视频 |