当前位置: 首页>>代码示例>>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;未经允许,请勿转载。