Flex阅读器开发手册

Publish: February 10, 2012 Category: FlexPaper 649 Comments

Flex阅读器(FlexPaper)


Flex阅读器是一款由Devaldi开发的(Free)Flex程序库,它的功能是将服务器上的swf文件通过它生成的控件在浏览器上以类似PdfReader进行展示。可用它来制作精美的电子杂志和在线电子读物。


Flex阅读器安装及编程


  • 在(http://flexpaper.devaldi.com/)下载FlexPaper SWC,将FlexPaper_SDK4.swc拷贝到你的Flex项目libs中即可


  • 一个简单的例子,复制你的SWF到你的bin-debug目录,如man.swf,添加FlexPaper组件到你的flex代码中





  • Flex代码


<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

layout="absolute"

width="800" height="500"

xmlns:flexpaper="com.devaldi.controls.flexpaper.*">

<flexpaper:FlexPaperViewer width="800" height="500"

Scale="1" SwfFile="man.swf" />

</mx:Application>

 


  • 使用技巧

    (以下 mybook为FlexPaperViewer 的ID)

    除去打印控件图标

      在初始化组件事件处理函数中加入

                  mybook._FlexPaperViewer_GradientImageButton1.visible=false;

          也可以除去整个工具栏

                  mybook.removeElementAt(0);

    除去LOGO图标

          在初始化组件事件处理函数中且在文档加载处理函数中加入(removeElementAt(2)LOGO组件)

                 var A:Object=mybook.getChildAt(1);

                 A.removeElementAt(2);

           也可以写为(paper1为页面组件id):

                      mybook.paper1.removeElementAt(2);

    将工具栏的位置放入页面的底部

           在初始化组件事件处理函数中加入

                     mybook.removeElement(mybook.paper1);

                    mybook.addElementAt(mybook.paper1,0);

  • 参数: (以下参数可用于FlexPaper)


  • SwfFile(String)


打开Swf文件


  • Scale(Number)


放大因子,是一个0以上的数(带小数 1 = 100%) 。


  • ZoomTransition(String)


光学变焦过渡,默认值是easeOut,可取值: easenone, easeout, linear, easeoutquad


  • ZoomTime(Number)


时间过渡让变焦达到新的放大因子,值为0或更大的数。


  • ZoomInterval(Number)


区间的滑动缩放。放大因子缺省值是0.1。如同在工具栏上使用滑动条按钮的效果。


  • FitPageOnLoad(Boolean)


(布尔) 适合初始页大小(依高度而定)的装载页。如同在工具栏上使用fit-page按钮的效果。


  • FitWidthOnLoad(Boolean)


(布尔)适合初始页宽度大小的装载页。如同在工具栏上使用fit-width按钮的效果。


  • llocaleChain(String)


设置语言。

目前支持以下语言:

en_US(英语)

fr_FR(法国)

zh_CN(中国、简体)

es_ES(西班牙)

pt_BR(巴西葡萄牙语)

ru_RU(俄罗斯)

fi_FN芬兰

de_DE(德国)

nl_NL(荷兰)

tr_TR(土耳其)

se_SE(瑞典)

pt_PT(葡萄牙)

el_EL(希腊)

da_DN(丹麦)

cz_CS(捷克)

it_IT(意大利)

pl_PL(波兰)

pv_FN芬兰

hu_HU(匈牙利)


  • FullScreenAsMaxWindow(Boolean)


(布尔)以最大化方式打开一个新浏览器窗口。


  • ProgressiveLoading(Boolean)


(布尔) 将视本地负荷情况逐步地下载显示文档,而不是下载完后再显示。至少Flash9 以上版本的SWF生成文档


  • MaxZoomSize(Number)


(数值) 最大允许设置缩放等级


  • MinZoomSize(Number)


(数值) 允许设置最小缩放等级


  • SearchMatchAll(Boolean)


(布尔) 当被设置为真时,可执行搜索功能。


  • InitViewMode(String)


(字符串) 设置启动视图模式。例如“Portrait”或“TwoPage”。


  • ViewModeToolsVisible(Boolean)


(布尔)显示或隐藏视图模式与工具栏


  • ZoomToolsVisible(Boolean)


(布尔) 从工具栏显示或隐藏变焦工具


  • NavToolsVisible(Boolean)


(布尔)显示或隐藏导航工具


  • CursorToolsVisible(Boolean)


(布尔) 显示或隐藏光标工具


  • SearchToolsVisible(Boolean)


(布尔)显示或隐藏的搜索工具


  • 下面例子可以通过参数的使用预编译的flash版


var fp = new FlexPaperViewer( 'FlexPaperViewer', 'viewerPlaceHolder', {

config : {

SwfFile : "Paper.swf",

Scale : 0.6,

ZoomTransition : "easeOut",

ZoomTime : 0.5,

ZoomInterval : 0.1,

FitPageOnLoad : false,

FitWidthOnLoad : false,

PrintEnabled : false,

FullScreenAsMaxWindow : true,

ProgressiveLoading : true,

MinZoomSize : 0.2,

MaxZoomSize : 5,

SearchMatchAll : false,

InitViewMode : 'Portrait',

ViewModeToolsVisible : true,

ZoomToolsVisible : true,

NavToolsVisible : true,

CursorToolsVisible : true,

SearchToolsVisible : true,

localeChain : "zh_CN" }});

  • 函数功能


  • .gotoPage(Number pageNumber)


定位到你指定的页面


  • .fitWidth()


适合宽度设置模式


  • .fitHeight()


适合高度模式


  • .loadSwf(String swffile)


载入一个新文件


  • .getCurrPage()


载入一个页为当前页


  • .nextPage()


下一页为当前页


  • .prevPage()


移动到前一页


  • .Zoom(Number factor)


变焦到指定的大小因子


  • .searchText(String text)


搜索指定的文本


  • .switchMode(String mode)


开启观赏模式。"Portrait", "Two Page", "Tile" // “肖像模式”、“两个页面”、“平铺


  • .printPaper()


文件打印


  • .highlight(String url)


高亮突出链接地址


  • .postSnapshot(String url)


网页“快照”文档指定的url




  • Events事件


  • onDocumentLoaded (no arguments)


文档完成装载时


  • onDocumentLoadedError (String errormessage)


文档完成装载错误发生时


  • onProgress (Number bytesloaded, Number bytestotal)


文档装载时的过程中(装入的字节)


  • onCurrentPageChanged (Number pagenumber)


当当前页面发生改变时


  • onExternalLinkClicked (String link)


当一个用户点击一个外部链接。

(Only works when supplying argument "-s linknameurl" in conversion with PDF2SWF)


  • onDocumentPrinted (no arguments)


当一个文件已完成打印时




服务器端的SWFTools


为了让PlexPaper能运行首先得要有SWF文件,而在服务器内常使用开源的SwfTools自动完成这种转换, SWFTools 是一组用来处理 Flash 的 swf文件的工具包,包括:

1. 合并工具 swfcombine

2. 抽取工具 swfextract

3. PDF/JPEG/PNG/AVI/TTF/WAV 到 SWF 的转换工具 :pdf2swf, jpeg2swf, png2swf, avi2swf, font2swf, and wav2swf|

4. 文本解析工具 swfstrings

5. SWF 解析器 swfdump

6. SWF 读写库 rfxswflib




  • 一个简单的将PDF文档转成SWF的用法:


windows C:\SWFTools\pdf2swf 源文件.pdf -o 目标文件.swf -f -T 9

linux /usr/local/bin/pdf2swf $pdfFile -o $swfFile -f -T 9 -t -s storeallcharacters > /dev/null


  • PDF2SWF转换文件参数


-h , --help 打印帮助短消息并退出

-V , --version 打印版本信息并退出

-o , --output file.swf 直接输出到文件。如果文件名为(file%.swf)输出每页为单独的文件。输出文件为:file[1-n].swf

-p , --pages range 仅转换中的页面范围与范围例如 1-20 or 1,4,6,9-11

-P , --password password 使用密码破译加密的pdf文件。

-v , --verbose 显示详细信息。

-z , --zlib 使用flash 6 MX压缩和解压缩。

-i , --ignore 允许pdf2swf更改pdf的绘制顺序。

-j , --jpegquality quality 设置嵌入jpeg图片的质量,以质量。 0质量最差,100质量最佳。缺省值:85

-s , --set param=value 设置SWF编码器的特定参数。

-w , --samewindow 在转换为pdf的超链接时,不让链接打开一个新窗口。

-t , --stop 在每页中插入停止命令。

-T , --flashversion num 设置Flash版本。

-F , --fontdir directory 添加到搜索字体的路径目录。

-b , --defaultviewer 添加到搜索路径的字体目录。

-l , --defaultloader 一个标准的预加载器swf文件的链接加载。

-B , --viewer filename 查看器文件名以swf文件的链接。

-L , --preloader filename 预加载器文件名以swf文件的链接。

-q , --quiet 取消正常的消息,也可使用-qq取消警告。

-S , --shapes 不使用SWF的字体,但一切都存储为形状。

-f , --fonts 存储完整的字体在SWF。不减少使用的字符。

-G , --flatten 尽可能从文件中删除尽可能多的剪贴图层。

-I , --info 不做实际的转换,只显示在PDF中所有页面的列表。

-Q , --maxtime n 在n秒后,中止转换。仅Unix可用。




  • 下面的4个常用的参数意义:


-f 字体应该嵌入,提高可检索的文档

-T 设定目标flash版到9,提高稳定性

-t 每一帧之间插入一个停止,提高稳定性

-s storeallcharacters 存储文档中的所有字符文本的信息,提高了可搜索性

 

可选参数:

-G14 使文件更小、更快的渲染

-s subpixels=1.5 subpixels = 1.5 在文档中调整图像分辨率。

在某些情况下应使用文件含有丰富的大的图像。

值(1.5),可以尝试要求质量档案。

请参阅http://wiki.swftools.org/index.php/Pdf2swfhttp://wiki.swftools.org/index.php/Pdf2swffor

一个完整的PDF2SWF例子。



 


  • Linux下源码编译安装 SwfTools


安装swftools 及其编译支持库(jpegsrc,freetype)

1.安装jpegsrc.v7.tar.gz

tar -zxvf jpegsrc.v7.tar.gz

cd jpeg-7

./configure

make

make install

2.安装freetype-2.3.12.tar.gz

tar -zxvf freetype-2.3.12.tar.gz

cd freetype-2.3.12

./configure

make

make install

3.安装swftools-2011-01-23-1815.tar.gz

tar -zxvf swftools-2011-01-23-1815.tar.gz

cd swftools-2011-01-23-1815

ldconfig /usr/local/lib

./configure

make

make install


编程实例


(以下的应用实例仅为参考,如要真正运行服务器端需要本人的写的flexsys_class 类库支持的运行环境)


  • XML定义文件: (sysbooks.xml)


<?xml version="1.0" encoding="utf-8"?>

<root>

<title label="技术文档" key="">

<node label="服务器安装手册" key="serverMan.swf" pdfFile="服务器安装手册.pdf"/>

</title>

<title label="帮助文档" key="">

<node label="信贷档案操作说明" key="xdarMan.swf" pdfFile="信贷模块操作说明.pdf"/>

</title>

<title label="信贷资料" key="">

<node label="信贷资料管理系统实施方案" key="xdarMan1.swf" pdfFile="信贷资料管理系统实施方案.pdf"/>

</title>

</root>

  • 客户端程序: (sysbooks.mxml)


<?xml version="1.0" encoding="utf-8"?>

<mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx"

layout="absolute" width="100%" height="100%"

mouseMove="vrule1_mouseMoveHandler(event)"

mouseUp="vrule1_mouseUpHandler(event)"

xmlns:flexpaper="com.devaldi.controls.flexpaper.*"

creationComplete="initApp()">

<fx:Style source="flex_root.css" />

<fx:Script>

<![CDATA[

import mx.collections.*;

import mx.controls.Alert;

import mx.events.DragEvent;

import mx.events.ListEvent;

import mx.managers.CursorManager;

import mx.rpc.events.FaultEvent;

import mx.rpc.events.ResultEvent;

import mylib.*;

public var Ocookies:MyCookies;

[Bindable]

public var http_server:String;

[Bindable]

private var userKey:String;

[Bindable]

private var xmldoc:XML;

[Embed(source="images/resizeCursorH.gif")]

public var Movecus:Class;

private var cursorID:int;

private var moveCursorFlag:Boolean=false;

public var pdf_filename:String="";

public function initApp():void {

Ocookies=this.parentApplication.Ocookies;

http_server=Ocookies.ServerAddr;

userKey=Ocookies.UserInfo.user_key;

search_xml.send();

//除去打印控件图标

mybook._FlexPaperViewer_GradientImageButton1.visible=false;

//也可以除去整个工具栏

mybook.removeElementAt(0);

//除去LOGO图标

var A:Object=mybook.getChildAt(1);

A.removeElementAt(2);

}

//Cursor控制---------------------------------------------------------

protected function vrule1_mouseOverHandler(event:MouseEvent):void{

cursorID = CursorManager.setCursor(Movecus,2,-10,-10);

}

protected function vrule1_mouseOutHandler(event:MouseEvent):void{

CursorManager.removeCursor(cursorID);

}

protected function vrule1_mouseDownHandler(event:MouseEvent):void{

moveCursorFlag=true;

}

protected function vrule1_mouseUpHandler(event:MouseEvent):void{

moveCursorFlag=false;

}

protected function vrule1_mouseMoveHandler(event:MouseEvent):void{

if(!moveCursorFlag) return;

myTree.width=event.stageX - 5;

if(myTree.width<100){

myTree.width=100;

moveCursorFlag=false;

}

if(myTree.width>500) myTree.width=500;

}

//---------------------------------------------------------Cursor控制

public function handleFault(event:FaultEvent):void{

Alert.show(event.fault.faultString , "通信错误");

}

//装入

public function fsearch_xml(event:ResultEvent):void{

xmldoc=XML(event.result);

myTree.validateNow();

for each(var item:XML in myTree.dataProvider) myTree.expandChildrenOf(item,true);

}

protected function myTree_changeHandler(event:ListEvent):void{

var data:Object=myTree.selectedItem;

var sFile:String=data.@key;

if(sFile!=""){

var pdfFile:String=data.@pdfFile;

var sGet:String="?pdfFile="+pdfFile+"&swfFile="+sFile;

mybook.SwfFile=http_server+"/flex_root/PHP/sys/getHelpPDF.php"+sGet;

}

//除去LOGO图标

var A:Object=mybook.getChildAt(1);

A.removeElementAt(2);

}

]]>

</fx:Script>

<fx:Declarations>

<mx:HTTPService id="search_xml"

url="{http_server}/flex_root/PHP/sys/sysbooks.xml"

method="POST"

showBusyCursor="true"

result="fsearch_xml(event)"

fault="handleFault(event)"

resultFormat="e4x">

</mx:HTTPService>

</fx:Declarations>

<s:HGroup width="100%" height="100%" gap="0" x="0" y="0">

<mx:Tree id="myTree" width="180" height="100%"

dataProvider="{xmldoc.title}" labelField="@label" change="myTree_changeHandler(event)">

</mx:Tree>

<mx:VRule height="100%" tabEnabled="true"

mouseOver="vrule1_mouseOverHandler(event)"

mouseOut="vrule1_mouseOutHandler(event)"

mouseDown="vrule1_mouseDownHandler(event)" />

<s:BorderContainer width="100%" height="100%" backgroundColor="#cccccc">

<flexpaper:FlexPaperViewer id="mybook" width="100%" height="100%" FitPageOnLoad="true"

Scale="1" SwfFile="" />

</s:BorderContainer>

</s:HGroup>

</mx:Module>

  • 服务器端程序: (getHelpPDF.php)


<?php

//获得PDF文件至swf文件的转换

function __autoload($class_name) {

require_once($class_name . '.php');

}

$oSYS=new flexsys_class();

$SysDataPath=$oSYS->BASE_data;

$name=iconv("utf-8","gb2312//IGNORE",$_GET["pdfFile"]);

$pdfFile=$SysDataPath."/pubftp/help/".$name;

$swfFile=$SysDataPath."/pubftp/help/".$_GET["swfFile"];

if(!file_exists($pdfFile)) exit;

$pdfTime=filemtime($pdfFile);

if(!file_exists($swfFile)){

$swfTime=0;

}else{

$swfTime=filemtime($swfFile);

}

if($pdfTime > $swfTime){

if(PHP_OS=="Linux"){

@system("/usr/local/bin/pdf2swf $pdfFile -o $swfFile -f -T 9 -t -s storeallcharacters > /dev/null");

}else{

@system('"c:/usr/web_root/pdf2swf.exe" $pdfFile -o $swfFile -f -T 9 -t -s storeallcharacters');

}

}

echo $oSYS->downWebFile($swfFile);

?>

非常强大的图象处理函数iMagick

Publish: February 8, 2012 Category: PHP 250 Comments

 

imagick是连接PHP和ImageMagick的通道。

ImageMagick是Linux下非常强大的图象处理函数。
特点比如:
1、除了对图象的基本出来外,还可以对图象进行滤镜处理。
2、支持80多种图片格式(包括GIF)。
3、生成的图片同分辨率情况下质量好于GD(JPG)
4、生成的图片同分辨率情况下文件大小比GD小一倍以上(JPG)
5、太多了

imagick没有文档,有的函数没有写说明,我补充了一份。

PHP iMagick Function Document

PHP 4.3.8 imageMagick 6.0.0 iMagick 0.9.9

导读:iMagick的作者并未告诉大家可以使用那些函数以及方法,这些函数和方法都是从source文件中的定义找到。作者摸索测试。请大家在有example的代码情况下做测试,不然很难用明白。


Function Description
图片构造类 image_handle = imagick_readimage([image file]) 读取图片到handle
  bool = imagick_writeimage([source image handle],[new name & filetype]) 写图片
  UN KNOW USE = imagick_writeimages  
  new_handle = imagick_clonehandle([image handle]) 复制出新句柄
  image_handle = imagick_image2blob([blob handle]) 将数据流数据转换成为image数据
  imagick_blob2image 与image2blob相反
  image_handle = imagick_getcanvas([color],[canvas width],[canvas height]) 创建一个画布
  UN KNOW USE = imagick_newimagelist  
错误句柄类 bool = imagick_iserror([image handle]) 最后一次执行是否成功
  rason_string = imagick_failedreason([image handle]) 如果执行iImagick函数返回假将可以从本函数抛出失败
  desc_string = imagick_faileddescription([image handle]) 显示抛出的异常描述
  error_string = imagick_error([image handle]) 返回错误内容
获取图片信息类 image_width = imagick_getwidth([image handle]) 获得图片宽度
  image_height = imagick_getheight([image handle]) 获得图片高度
  mime_string = imagick_getmimetype([image handle]) 获得图片MIME类型
  depth_int = imagick_getimagedepth([image handle]) 获得图片DEPTH值
  colors_num = imagick_getnumbercolors([image handle]) 获得图片颜色数量
  bool = imagick_isgrayimage([image handle]) 是否会度图片
  bool = imagick_ismonochromeimage([image handle]) 是否单色图片
  bool = imagick_isopaqueimage([image handle]) 是否不透明图片
  bool = imagick_ispaletteimage([image handle]) 是否彩色图片
  image_type = imagick_getimagetype([image handle]) 获得图片颜色值
  bool = imagick_isimagesequal([image handle1],([image handle2])) 图片是否相同
  magick_type = imagick_getmagick([image handle]) 获得图片类型
  int = imagick_getcolorspace([image handle])  
图片转换类 bool = imagick_convert([image handle],[new type]) 将图片数据转换成为指定格式
  bool = imagick_setcompressiontype([image handle],[compression type]) 指定图片的压缩方式
  bool = imagick_setcompressionquality([image handle],[quality value]) 指定图片的压缩质量
尺寸调整类 bool = imagick_resize([image handle],[new width],[new height],[filter type],[blur],[geometry]) 改变图片尺寸
  UN KNOW USE imagick_magnify  
  UN KNOW USE imagick_minify  
  bool = imagick_scale([image handle],[new width],[new height],[geometry]) 按照指定比例缩小图片
  bool = imagick_sample([image handle],[new width],[new height],[geometry]) 缩小产生样本图片
  bool = imagick_zoom([image handle],[new width],[new height],[geometry]) 放大图片
字体设置类 bool = imagick_setfontsize([image handle],[size]) 设置字体大小
  UN KNOW USE imagick_setfontstyle  
  bool = imagick_setfontface([image handle],[Font Name]) 设置采用的字体
绘图类 bool = imagick_begindraw([image handle]) 开始在一个image上绘画
  bool = imagick_drawannotation([image handle],[x],[y],[text]) 在image上的x y开始画一些文字符号
  bool = imagick_drawrectangle([image handle],[up x],[up y],[low x],[low y]) 画一个矩形
  bool = imagick_drawellipse([image handle],[starting x],[starting y],[ending x],[ending y],[start rotation in degrees],[end rotation in degrees]) 画一个椭圆形
  bool = imagick_drawarc([image handle],[origin x],[origin y],[ x radius],[ y radius],[ start rotation in degrees],[ end rotation in degrees]) 画一个弧形
  bool = imagick_drawcircle([image handle],[origin x],[origin y],[perimater x],[perimater y]) 画一个圆
  bool = imagick_drawline([image handle],[starting x],[starting y],[ending x],[ending y]) 画一条线
  bool = imagick_drawpoint([image handle],[x coordinate ],[y coordinate ]) 画一个点
  bool = imagick_setfillcolor([image handle],[color vlaue]) 设置填充颜色
  bool = imagick_setfillopacity([image handle],[opactiy]) 设置不透明度
质量增强类 bool = imagick_rotate([image handle],[degrees]) 设置旋转图片的角度
  bool = imagick_shear([image handle],[x coordinate],[y coordinate]) 旋转剪切
  bool = imagick_contrast([image handle],[contrast value]) 提高或降低图象对比度
  bool = imagick_equalize([image handle]) 色彩均匀化
  bool = imagick_gamma([image handle],[gamma value 0.8 - 2.3]) 图象GAMMA调整
  bool = imagick_level([image handle],[gamma value 0.8 - 2.3]) 图象GAMMA调整
  bool = imagick_modulate([image handle],[modulate]) 调整亮度,饱和度,色彩
  bool = imagick_negate([image handle],[gray scale value]) 反色图片
  bool = imagick_normalize([image handle]) 规格化图片
图片装饰类 bool = imagick_border([image handle],[ x starting position of border ],[y starting position of border ],[width of border],[height of border]) 在图片上化一个边框
  UN KNOW USE imagick_frame  
  bool = imagick_raise([image handle],[ x starting position of border ],[ y starting position of border ],[ width of border],[ height of border],[raise non-zero]) 浮雕效果
效率滤镜类 bool = imagick_charcoal([image handle],[the radius of pixel neighborhood],[the standard deviation of the Gaussian, in pixels]) 碳笔
  bool = imagick_implode([image handle],[define the extent of the implosion]) 内曝效果
  bool = imagick_oilpaint([image handle],[the radius of the circular
neighborhood])
油画效果
  bool = imagick_solarize([image handle],[define the extent of solarization - this value is between 0 and MaxRGB]) 反转曝光
  bool = imagick_swirl([image handle],[define the tightness of the swirling
effect ])
旋涡
  bool = imagick_wave([image handle],[the amplitude of the wave],[the frequency of the wave]) 水波纹
图片滤镜类 bool = imagick_blur([image handle],[the radius of the Gaussian, in
pixels, not counter the center pixel],[the standard deviation of the
Gaussian, in pixels])
模糊
  bool = imagick_despeckle([image handle]) 平滑聚焦图象
  bool = imagick_edge([image handle],[the radius of the pixel neighbor- hood; using 0 will cause a suitable radius to be selected for you]) 边缘锐化
  bool = imagick_emboss([image handle],[the radius of the pixel neighbor-
hood],[the standard deviation of the Gaussian, in pixels])
浮雕效果
  bool = imagick_enhance([image handle]) 图象增强
  bool = imagick_gaussianblur([image handle],[he radius of the Gaussian, in pixels, not counting the center pixel; using 0 will cause a suitable radius to be selected for you],[the standard deviation of the Gaussian, in pixels]) 高斯模糊
  bool = imagick_medianfilter([image handle],[the radius of the pixel neighbor-hood]) 平滑过滤图象
  bool = imagick_motionblur([image handle],[the radius of the Gaussian, in
pixels, not counter the center pixel],[the standard deviation of the
Gaussian, in pixels],[apply the effect along this angle])
动感模糊
  bool = imagick_reducenoise([image handle],[the radius of the pixel neighborhood]) 降噪
  bool = imagick_shade 阴影
  bool = imagick_sharpen 锐化
  bool = imagick_spread 发散
  bool = imagick_threshold 临界值
  bool = imagick_unsharpmask unsharpmask锐化
  UN KNOW USE bool = imagick_flatten  
图片列表类 bool = imagick_next  
  bool = imagick_prev  
  bool = imagick_first  
  bool = imagick_goto  
  bool = imagick_getlistsize  
  bool = imagick_getlistindex  
  bool = imagick_getimagefromlist  
  bool = imagick_pushlist  
  bool = imagick_poplist  
图片变形类 bool = imagick_chop  
  bool = imagick_crop([image handle],[x starting position of border],[y starting position of border],[width of border],[height of border]) 从图片上截取
  bool = imagick_flip ([image handle]) 图象翻转
  bool = imagick_flop 左右转换
  bool = imagick_roll  
  bool = imagick_profile  
  bool = imagick_rgbtransform 色彩变更
  bool = imagick_transformrgb 色彩变更
  bool = imagick_mosaic  
  bool = imagick_transparent([image handle],[color value]) 设置指定颜色成为透明色
图片量子化 bool = imagick_ordereddither([image handle])  
图片合成类 bool = imagick_composite 图象融合
图片属性设置 bool = imagick_set_image_comment([image handle],[the comment to set in the image]) 设置图象的一些参数
  bool = imagick_set_image_quality([image handle],[quality value]) 设置图象的质量
句柄销毁类 bool = imagick_destroyhandle([image handle]) 干掉指定的image handle
兼容的函数 imagick_read => imagick_readimage  
  imagick_free => imagick_destroyhandle  
抛弃的函数 imagick_add_resource  
  imagick_list_magickinfo  
  imagick_new  
  imagick_init  
  imagick_copy_sample  
  imagick_copy_resize  
  imagick_copy_crop  
  imagick_copy_shear  
  imagick_copy_rotate  
  imagick_copy_morph  
  imagick_dump  

Document Version 0.1 by hoowa_sun

Document Copyright By hoowa_sun. your need copyright line of pub into others.


 

LNMP集成环境

Publish: February 8, 2012 Category: PHP,MYSQL,Centos,Nginx 366 Comments

http://lnmp.org/

flexpaper 参数说明

Publish: February 8, 2012 Category: PHP,FlexPaper 358 Comments

 

Flexpaper可能用到如下参数


   SwfFile (String) 需要使用Flexpaper打开的文档
   Scale (Number) 初始化缩放比例,参数值应该是大于零的整数
   ZoomTransition (String) Flexpaper中缩放样式,它使用和Tweener一样的样式,默认参数值为easeOut.其他可选值包括: easenone, easeout, linear, easeoutquad
   ZoomTime (Number) 从一个缩放比例变为另外一个缩放比例需要花费的时间,该参数值应该为0或更大。
   ZoomInterval (Number) 缩放比例之间间隔,默认值为0.1,该值为正数。
   FitPageOnLoad (Boolean) 初始化得时候自适应页面,与使用工具栏上的适应页面按钮同样的效果。
   FitWidthOnLoad (Boolean) 初始化的时候自适应页面宽度,与工具栏上的适应宽度按钮同样的效果。
   localeChain (String) 设置地区(语言),目前支持以下语言。

en_US (English) 
fr_FR (French) 
zh_CN (Chinese, Simple) 
es_ES (Spanish) 
pt_BR (Brazilian Portugese) 
ru_RU (Russian) 
fi_FN (Finnish) 
de_DE (German) 
nl_NL (Netherlands) 
tr_TR (Turkish) 
se_SE (Swedish) 
pt_PT (Portugese) 
el_EL (Greek) 
da_DN (Danish) 
cz_CS (Czech) 
it_IT (Italian) 
pl_PL (Polish) 
pv_FN (Finnish) 
hu_HU (Hungarian)
   FullScreenAsMaxWindow (Boolean) 当设置为true的时候,单击全屏按钮会打开一个flexpaper最大化的新窗口而不是全屏,当由于flash播放器因为安全而禁止全屏,而使用flexpaper作为独立的flash播放器的时候设置为true是个优先选择。
   ProgressiveLoading (Boolean) 当设置为true的时候,展示文档时不会加载完整个文档,而是逐步加载,但是需要将文档转化为9以上的flash版本(使用pdf2swf的时候使用-T 9 标签)。
   MaxZoomSize (Number) 设置最大的缩放比例。
   MinZoomSize (Number) 最小的缩放比例。
   SearchMatchAll (Boolean) 设置为true的时候,单击搜索所有符合条件的地方高亮显示。
   InitViewMode (String) 设置启动模式如"Portrait" or "TwoPage".
   ViewModeToolsVisible (Boolean) 工具栏上是否显示样式选择框。
   ZoomToolsVisible (Boolean) 工具栏上是否显示缩放工具。
   NavToolsVisible (Boolean) 工具栏上是否显示导航工具。
   CursorToolsVisible (Boolean) 工具栏上是否显示光标工具。
  

SearchToolsVisible (Boolean)

工具栏上是否显示搜索。


 

SWFTOOLS PDF2SWF 参数详解

Publish: February 8, 2012 Category: PHP,Centos 16 Comments

font2swf.exe 
gif2swf.exe 
jpeg2swf.exe 
pdf2swf.exe 
png2swf.exe 
wav2swf.exe 
具体的功能就顾名思义了。 

其中把pdf转成swf的工具就是pdf2swf了。在命令行中运行pdf2swf src.pdf des.swf一般能满足需求。而命令行参数可以通过pdf2swf -f得到: 

-h , –help                      Print short help message and exit              打印帮助信息 
-V , –version                Print version info and exit                        打印版本号 
-o , –output file.swf         Direct output to file.swf. If file.swf contains ‘13568621′ (file13568630.swf), then each page指定输出的swf文件名 
-p , –pages range             Convert only pages in range with range e.g. 1-20 
or 1,4,6,9-11 or 

指定转换的页面范围,使用的页码描述方法与打印机打印文件时候的选页一样 

-P , –password password       Use password for deciphering the pdf.指定打开pdf的密码 
-v , –verbose                 Be verbose. Use more than one -v for greater effect.转换时输出详细的内容 
-z , –zlib                    Use Flash 6 (MX) zlib compression.使用Flash 6的zlib压缩机制 
-i , –ignore                  Allows pdf2swf to change the draw order of the pdf. This may make the generated允许程序修改pdf的绘制顺序,可能会导致结果与原来有差异 
-j , –jpegquality quality     Set quality of embedded jpeg pictures to quality. 0 is worst (small), 100 is best (big). (default:85)设置转换其中的jpeg图片的质量,从0到100,默认值是85。 
-s , –set param=value         Set a SWF encoder specific parameter.  See pdf2swf -s help for more information.  设置SWF转码时候的参数,具体参数可以用pdf2swf -s help获取 
-w , –samewindow              When converting pdf hyperlinks, don’t make the links open a new window.        设置转换后的swf打开原pdf中的连接时使用相同的窗口 
-t , –stop                    Insert a stop() command in each page.            在每页结尾添加一个stop()命令 
-T , –flashversion num        Set Flash Version in the SWF header to num.         设置SWF所使用的flash版本号 
-F , –fontdir directory       Add directory to the font search path.                    指定字体文件所在路径 
-b , –defaultviewer           Link a standard viewer to the swf file.             指定默认的swf导航文件,用来翻页、放大缩小等等 
-l , –defaultloader           Link a standard preloader to the swf file which will be displayed while the main swf is loading.     指定默认的swf加载文件,用来显示加载进程效果 
-B , –viewer filename         Link viewer filename to the swf file.   指定swf导航文件,作用同-b 
-L , –preloader filename      Link preloader filename to the swf file.      指定swf加载文件,作用同-l 
-q , –quiet                   Suppress normal messages.  Use -qq to suppress warnings, also.  不打印普通信息,用-qq就不打印警告信息。 
-S , –shapes                  Don’t use SWF Fonts, but store everything as shape. 不使用字体,所有都转为形状。 
-f , –fonts                   Store full fonts in SWF. (Don’t reduce to used characters). 在swf中保存全部字体。 
-G , –flatten                 Remove as many clip layers from file as possible. 在文件中尽量去除影片层,合并它们 
-I , –info                    Don’t do actual conversion, just display a list of all pages in the PDF. 不做实际转换,仅显示PDF的信息。 
-Q , –maxtime n               Abort conversion after n seconds. Only available on Unix. 如果运行时间超时则退出。 

-------------------------------------------------------------------------------- 
然后看看-s都可以设置些什么: 
PDF Parameters: 
PDF device global parameters: 
fontdir= a directory with additional fonts 指定字体目录, 与1级参数的-F相若 
font= an additional font filename 增加额外的字体文件 
pages= the range of pages to convert (example: pages=1-100,210-) 指定页面范围,与1级参数的-p相若 
zoom= the resolution (default: 72) 指定分辨率,默认为72dpi 
languagedir= Add an xpdf language directory 增加一个xpdf的语言目录,对非西欧字符有用 
multiply= Render everything at the resolution 在几倍分辨率下渲染 
poly2bitmap Convert graphics to bitmaps 把其中的图形转成点阵 
bitmap Convert everything to bitmaps 把所有内容转成点阵(包括字体) 

SWF Parameters: 

SWF layer options: 
jpegsubpixels=<pixels> resolution adjustment for jpeg images (same as jpegdpi, but in pixels) jpeg图片的分辨率 
ppmsubpixels=<pixels> resolution adjustment for  lossless images (same asppmdpi, but in pixels) 无损图片的分辨率 
subpixels=<pixels>     shortcut for setting both jpegsubpixels and ppmsubpixels 快速设置上两个参数 
drawonlyshapes           convert everything to shapes (currently broken) 所有都转成图形 
ignoredraworder         allow to perform a few optimizations for creating smaller SWFs 允许执行一些小优化 
linksopennewwindow   make links open a new browser window 链接打开新窗口 
linktarget                  target window name of new links       新链接窗口的名称 
linkcolor=<color)        color of links (format: RRGGBBAA)    链接的颜色 
linknameurl         Link buttons will be named like the URL they refer to (handy for iterating through links with actionscript)   链接名称与链接URL一致 
storeallcharacters      don’t reduce the fonts to used characters in the output file 保存所有的字符字体 
enablezlib                switch on zlib compression (also done if flashversion>=7) 使用zlib压缩 
bboxvars                 store the bounding box of the SWF file in actionscript variables 在as中保存swf的区域大小 
dots                        Take care to handle dots correctly 保存单点显示 
reordertags=0/1     (default: 1) perform some tag optimizations 执行某些tag优化 
internallinkfunction=<name> when the user clicks a internal link (to a different page) in the converted file, this actionscript function is called 内部链接函数,如果点击一个内部链接,将调用该actionscript函数 
externallinkfunction=<name> when the user clicks an external link (e.g. http://www.foo.bar/) on the converted file, this actionscript function is called 外部链接函数,如果点击一个外部链接,将调用该actionscript函数 
disable_polygon_conversion  never convert strokes to polygons (will remove capstyles and joint styles) 不要将笔画转成多边形 
caplinewidth=<width>        the minimum thichness a line needs to have so that capstyles become visible (and are converted)           线条最低转换宽度,比这个细的线条将不转换 
insertstop                  put an ActionScript “STOP” tag in every frame 在swf的每个桢中添加stop()函数 
protect                     add a “protect” tag to the file, to prevent loadingin the Flash editor 增加protect标签,禁止在flash中加载该swf 
flashversion=<version>  the SWF fileversion (6) 设置最低swf版本 
framerate=<fps>         SWF framerate  设置桢率 
minlinewidth=<width>  convert horizontal/vertical boxes smaller than thiswidth to lines (0.05)将宽度少于某值的矩形转成线条 
simpleviewer     Add next/previous buttons to the SWF 使用简单的导航 
animate           insert a showframe tag after each placeobject (animate draw order of PDF files) ??? 
jpegquality=<quality>  set compression quality of jpeg images 设置jpeg的压缩质量 
splinequality=<value>  Set the quality of spline convertion to value (0-100, default: 100). 设置样条曲线的转换质量 
disablelinks                Disable links.  禁止链接