當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Convert::ToXod方法代碼示例

本文整理匯總了PHP中Convert::ToXod方法的典型用法代碼示例。如果您正苦於以下問題:PHP Convert::ToXod方法的具體用法?PHP Convert::ToXod怎麽用?PHP Convert::ToXod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Convert的用法示例。


在下文中一共展示了Convert::ToXod方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: main

function main()
{
    global $inputPath, $outputPath;
    PDFNet::Initialize();
    // Sample 1:
    // Directly convert from PDF to XOD.
    echo nl2br("Converting: " . $inputPath . "newsletter.pdf" . " to " . $outputPath . "from_pdf.xod" . "\n");
    Convert::ToXod($inputPath . "newsletter.pdf", $outputPath . "from_pdf.xod");
    // Sample 2:
    // Directly convert from generic XPS to XOD.
    echo nl2br("Converting: " . $inputPath . "simple-xps.xps" . " to " . $outputPath . "from_xps.xod" . "\n");
    Convert::ToXod($inputPath . "simple-xps.xps", $outputPath . "from_xps.xod");
    // Sample 3:
    // Directly convert from PNG to XOD.
    echo nl2br("Converting: " . $inputPath . "butterfly.png" . " to " . $outputPath . "butterfly.xod" . "\n");
    Convert::ToXod($inputPath . "butterfly.png", $outputPath . "butterfly.xod");
    // Sample 4:
    // Directly convert from JPG to XOD.
    echo nl2br("Converting: " . $inputPath . "dice.jpg" . " to " . $outputPath . "dice.xod" . "\n");
    Convert::ToXod($inputPath . "dice.jpg", $outputPath . "dice.xod");
    echo nl2br("Done.\n");
}
開發者ID:anrao91,項目名稱:PDFNetWrappers,代碼行數:22,代碼來源:WebViewerConvertTest.php

示例2: debugLog

        debugLog("File not found: \"" . $FILE_DIR . $fileName . "\"");
        // send 404
        header("HTTP/1.1 404 Not Found");
        echo "<h1>404 Not Found</h1><br/>";
        echo "File \"" . $fileName . "\" cannot be found.";
        return;
    }
    debugLog("Converting and streaming file: \"" . $FILE_DIR . $fileName . "\"...");
    // set the correct content-type
    header("Content-Type: application/vnd.ms-xpsdocument");
    PDFNet::Initialize();
    // set the conversion option to not create thumbnails on XOD files because
    // they will not be streamed back to the client.
    $xodOptions = new XODOutputOptions();
    $xodOptions->SetOutputThumbnails(false);
    $filter = Convert::ToXod(realpath($FILE_DIR . $fileName), $xodOptions);
    $fReader = new FilterReader($filter);
    $bufferSize = 64 * 1024;
    $totalBytes = 0;
    debugLog("Start streaming...");
    do {
        $buffer = $fReader->Read($bufferSize);
        echo $buffer;
        flush();
        // prevents buffering the response so the client can receive them as they are written to the stream.
        $totalBytes += strlen($buffer);
        debugLog("Sent total: " . $totalBytes . " bytes");
    } while (strlen($buffer) > 0);
    debugLog("Done.");
} catch (Exception $e) {
    debugLog($e->getMessage());
開發者ID:anrao91,項目名稱:PDFNetWrappers,代碼行數:31,代碼來源:ConvertAndStream.php


注:本文中的Convert::ToXod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。