【问题标题】:Can one convert pdf to swf dynamically?可以动态地将pdf转换为swf吗?
【发布时间】:2013-06-18 01:33:11
【问题描述】:

可以动态地将 PDF 转换为 SWF 吗?我一直在尝试,但事实证明这很困难。

这是我的代码:

<?php
include('include\settings.php');

$title = "k";
$makeswf= mysql_query("SELECT * FROM books WHERE title = '$title'");
$rows = mysql_num_rows($makeswf);

if ($rows !=0)
{
while($rows = mysql_fetch_assoc($makeswf))
{

//where blocation is the pdf file need to be converted.

$file = $rows['blocation'];

echo exec('D:\wamp\www\dspzlibrary\converter\pdf2swf.exe books\$file.pdf -o books\$file.swf -f -T 9 -t -s storeallcharacters');
}

  }

else
echo"empty";

?>

这是我收到的错误:

错误无法打开书籍\$file.pdf

我们将不胜感激。

【问题讨论】:

  • "这里是代码" - 我想你可能忘记把代码贴在那里了。
  • 代码没有这样格式化。 php 标签导致它被忽略显示。

标签: php file pdf flash converter


【解决方案1】:

错误消息告诉您发生了什么。可执行文件pdf2swf.exe 正在尝试打开$file.pdf,而不是实际的文件名。

在 PHP 中,您需要用双引号 "" 进行内联变量替换。

echo exec("D:\wamp\www\dspzlibrary\converter\pdf2swf.exe books\$file.pdf -o books\$file.swf -f -T 9 -t -s storeallcharacters");

见:http://php.net/manual/en/language.types.string.php

双引号字符串最重要的特点是变量名会被扩展。

【讨论】:

  • 在 "" 双引号后暂时没有锁
猜你喜欢
  • 2020-01-09
  • 2016-07-16
  • 2015-04-22
  • 2011-05-05
  • 1970-01-01
  • 1970-01-01
  • 2013-01-11
  • 2020-01-01
相关资源
最近更新 更多