最終更新:2010-02-27 (土) 02:47:08 (5165d)  

PukiWiki/自作プラグイン/PDF表示

PukiWikiGoogle Docs Viewerを使ってPDFを表示するプラグイン。

pdf.inc.php

<?php
// PukiWiki - Yet another WikiWikiWeb clone.
//
// Inline-pdf plugin by tokkyo

// Output inline-google_docs_viewer tag from a URI
function plugin_pdf_convert()
{
	$args = func_get_args();
	$url = isset($args[0]) ? $args[0] : '';
	$encoded_url=urlencode($url);

	return <<<EOD
<div>
<iframe src="http://docs.google.com/viewer?url={$encoded_url}&embedded=true" width="600" height="780" style="border: none;"></iframe>
<br>
<a href="$url">このPDFへのリンク</a>
</div>
EOD;
}
?>

サンプル

#pdf(http://labs.google.com/papers/bigtable-osdi06.pdf)

このPDFへのリンク