导航:首页 > 编程语言 > php实现文档预览

php实现文档预览

发布时间:2022-05-27 12:58:56

php 怎么实现在线预览 word 文档

php 在线预览 word 文档,有多种方法,本质上来说,大多是调用客户端电脑系统安装的 Word 软件。

可以用 php 语言的 com 支持功能函数来完成,比如:

$word=newCOM("word.application")ordie("UnabletoinstanciateWord");
$word->Documents->Open($url.$wordname);


或者使用 word 文档的插件来完成,比如:swftools 等。

⑵ php实现仿网易邮箱在线预览文档功能

先把文件存到你能找到的盘上或放在桌面上,然后打开你的邮箱,点写信---写上收件人地址----写上标题-----点上传附件-----出现对话框点击浏览,找到你的文件双击,然后确定---点击发送文件就行了。

⑶ php在线预览word,txt,xls文件,怎么做

思路
这种类似网络文库的flash预览文档的东东,其主要思路如下:
将word/excel/ppt格式的文档,即office支持的主要文档格式通过OpenOffice转成pdf的插件,将文档先转成pdf格式。
通过swftools(http://www.swftools.org/)这个软件将pdf转成flash格式。
最后flash的显示,可以使用flexpaper,亦可以自己写一个显示flash格式的东东,然后成功显示多种格式的文档,即类似网络文库的实现。

pdf的预览是将pdf的每一页转为图片,对应的放大、缩小均是对图片直接进行操作,此时放大、缩小会有失真的情况出现。
其他例如work/excel/ppt等文档,均是转为了html页面,是的在线预览时可以选中文字,图片等。

具体 很麻烦 需要 详细 请 私信!

⑷ 朋友你好,请问你用PHP如何实现在线预览PDF/WORD文档的,能传代码给我吗非常感谢

php自带pdf函数,你可以直接使用,具体看php手册,我大概给你列一些

PDF_activate_item — Activate structure element or other content item
PDF_add_annotation — Add annotation [deprecated]
PDF_add_bookmark — Add bookmark for current page [deprecated]
PDF_add_launchlink — Add launch annotation for current page [deprecated]
PDF_add_locallink — Add link annotation for current page [deprecated]
PDF_add_nameddest — Create named destination
PDF_add_note — Set annotation for current page [deprecated]
PDF_add_outline — Add bookmark for current page [deprecated]
PDF_add_pdflink — Add file link annotation for current page [deprecated]
PDF_add_table_cell — Add a cell to a new or existing table
PDF_add_textflow — Create Textflow or add text to existing Textflow
PDF_add_thumbnail — Add thumbnail for current page
PDF_add_weblink — Add weblink for current page [deprecated]
PDF_arc — Draw a counterclockwise circular arc segment
PDF_arcn — Draw a clockwise circular arc segment
PDF_attach_file — Add file attachment for current page [deprecated]
PDF_begin_document — Create new PDF file
PDF_begin_font — Start a Type 3 font definition
PDF_begin_glyph — Start glyph definition for Type 3 font
PDF_begin_item — Open structure element or other content item
PDF_begin_layer — Start layer
PDF_begin_page_ext — Start new page
PDF_begin_page — Start new page [deprecated]
PDF_begin_pattern — Start pattern definition
PDF_begin_template_ext — Start template definition
PDF_begin_template — Start template definition [deprecated]
PDF_circle — Draw a circle
PDF_clip — Clip to current path
PDF_close_image — Close image
PDF_close_pdi_page — Close the page handle
PDF_close_pdi — Close the input PDF document [deprecated]
PDF_close — Close pdf resource [deprecated]
PDF_closepath_fill_stroke — Close, fill and stroke current path
PDF_closepath_stroke — Close and stroke path
PDF_closepath — Close current path
PDF_concat — Concatenate a matrix to the CTM
PDF_continue_text — Output text in next line
PDF_create_3dview — Create 3D view
PDF_create_action — Create action for objects or events
PDF_create_annotation — Create rectangular annotation
PDF_create_bookmark — Create bookmark
PDF_create_field — Create form field
PDF_create_fieldgroup — Create form field group
PDF_create_gstate — Create graphics state object
PDF_create_pvf — Create PDFlib virtual file
PDF_create_textflow — Create textflow object
PDF_curveto — Draw Bezier curve
PDF_define_layer — Create layer definition
PDF_delete_pvf — Delete PDFlib virtual file
PDF_delete_table — Delete table object
PDF_delete_textflow — Delete textflow object
PDF_delete — Delete PDFlib object
PDF_encoding_set_char — Add glyph name and/or Unicode value
PDF_end_document — Close PDF file
PDF_end_font — Terminate Type 3 font definition
PDF_end_glyph — Terminate glyph definition for Type 3 font
PDF_end_item — Close structure element or other content item
PDF_end_layer — Deactivate all active layers
PDF_end_page_ext — Finish page
PDF_end_page — Finish page
PDF_end_pattern — Finish pattern
PDF_end_template — Finish template
PDF_endpath — End current path
PDF_fill_imageblock — Fill image block with variable data
PDF_fill_pdfblock — Fill PDF block with variable data
PDF_fill_stroke — Fill and stroke path
PDF_fill_textblock — Fill text block with variable data
PDF_fill — Fill current path
PDF_findfont — Prepare font for later use [deprecated]
PDF_fit_image — Place image or template
PDF_fit_pdi_page — Place imported PDF page
PDF_fit_table — Place table on page
PDF_fit_textflow — Format textflow in rectangular area
PDF_fit_textline — Place single line of text
PDF_get_apiname — Get name of unsuccessfull API function
PDF_get_buffer — Get PDF output buffer
PDF_get_errmsg — Get error text
PDF_get_errnum — Get error number
PDF_get_font — Get font [deprecated]
PDF_get_fontname — Get font name [deprecated]
PDF_get_fontsize — Font handling [deprecated]
PDF_get_image_height — Get image height [deprecated]
PDF_get_image_width — Get image width [deprecated]
PDF_get_majorversion — Get major version number [deprecated]
PDF_get_minorversion — Get minor version number [deprecated]
PDF_get_parameter — Get string parameter
PDF_get_pdi_parameter — Get PDI string parameter [deprecated]
PDF_get_pdi_value — Get PDI numerical parameter [deprecated]
PDF_get_value — Get numerical parameter
PDF_info_font — Query detailed information about a loaded font
PDF_info_matchbox — Query matchbox information
PDF_info_table — Retrieve table information
PDF_info_textflow — Query textflow state
PDF_info_textline — Perform textline formatting and query metrics
PDF_initgraphics — Reset graphic state
PDF_lineto — Draw a line
PDF_load_3ddata — Load 3D model
PDF_load_font — Search and prepare font
PDF_load_iccprofile — Search and prepare ICC profile
PDF_load_image — Open image file
PDF_makespotcolor — Make spot color
PDF_moveto — Set current point
PDF_new — Create PDFlib object
PDF_open_ccitt — Open raw CCITT image [deprecated]
PDF_open_file — Create PDF file [deprecated]
PDF_open_gif — Open GIF image [deprecated]
PDF_open_image_file — Read image from file [deprecated]
PDF_open_image — Use image data [deprecated]
PDF_open_jpeg — Open JPEG image [deprecated]
PDF_open_memory_image — Open image created with PHP's image functions [not supported]
PDF_open_pdi_page — Prepare a page
PDF_open_pdi — Open PDF file [deprecated]
PDF_open_tiff — Open TIFF image [deprecated]
PDF_pcos_get_number — Get value of pCOS path with type number or boolean
PDF_pcos_get_stream — Get contents of pCOS path with type stream, fstream, or string
PDF_pcos_get_string — Get value of pCOS path with type name, string, or boolean
PDF_place_image — Place image on the page [deprecated]
PDF_place_pdi_page — Place PDF page [deprecated]
PDF_process_pdi — Process imported PDF document
PDF_rect — Draw rectangle
PDF_restore — Restore graphics state
PDF_resume_page — Resume page
PDF_rotate — Rotate coordinate system
PDF_save — Save graphics state
PDF_scale — Scale coordinate system
PDF_set_border_color — Set border color of annotations [deprecated]
PDF_set_border_dash — Set border dash style of annotations [deprecated]
PDF_set_border_style — Set border style of annotations [deprecated]
PDF_set_char_spacing — Set character spacing [deprecated]
PDF_set_ration — Set ration between pages [deprecated]
PDF_set_gstate — Activate graphics state object
PDF_set_horiz_scaling — Set horizontal text scaling [deprecated]
PDF_set_info_author — Fill the author document info field [deprecated]
PDF_set_info_creator — Fill the creator document info field [deprecated]
PDF_set_info_keywords — Fill the keywords document info field [deprecated]
PDF_set_info_subject — Fill the subject document info field [deprecated]
PDF_set_info_title — Fill the title document info field [deprecated]
PDF_set_info — Fill document info field
PDF_set_layer_dependency — Define relationships among layers
PDF_set_leading — Set distance between text lines [deprecated]
PDF_set_parameter — Set string parameter
PDF_set_text_matrix — Set text matrix [deprecated]
PDF_set_text_pos — Set text position
PDF_set_text_rendering — Determine text rendering [deprecated]
PDF_set_text_rise — Set text rise [deprecated]
PDF_set_value — Set numerical parameter
PDF_set_word_spacing — Set spacing between words [deprecated]
PDF_setcolor — Set fill and stroke color
PDF_setdash — Set simple dash pattern
PDF_setdashpattern — Set dash pattern
PDF_setflat — Set flatness
PDF_setfont — Set font
PDF_setgray_fill — Set fill color to gray [deprecated]
PDF_setgray_stroke — Set stroke color to gray [deprecated]
PDF_setgray — Set color to gray [deprecated]
PDF_setlinecap — Set linecap parameter
PDF_setlinejoin — Set linejoin parameter
PDF_setlinewidth — Set line width
PDF_setmatrix — Set current transformation matrix
PDF_setmiterlimit — Set miter limit
PDF_setpolydash — Set complicated dash pattern [deprecated]
PDF_setrgbcolor_fill — Set fill rgb color values [deprecated]
PDF_setrgbcolor_stroke — Set stroke rgb color values [deprecated]
PDF_setrgbcolor — Set fill and stroke rgb color values [deprecated]
PDF_shading_pattern — Define shading pattern
PDF_shading — Define blend
PDF_shfill — Fill area with shading
PDF_show_boxed — Output text in a box [deprecated]
PDF_show_xy — Output text at given position
PDF_show — Output text at current position
PDF_skew — Skew the coordinate system
PDF_stringwidth — Return width of text
PDF_stroke — Stroke path
PDF_suspend_page — Suspend page
PDF_translate — Set origin of coordinate system
PDF_utf16_to_utf8 — Convert string from UTF-16 to UTF-8
PDF_utf32_to_utf16 — Convert string from UTF-32 to UTF-16
PDF_utf8_to_utf16 — Convert string from UTF-8 to UTF-16

⑸ PHP怎样读取word文档实现在线预览,并且不受操作系统的限制,利用COM组件的话太受限了

你可以尝试一下PHPWord,用它可以把任意word文件转换为html网页,这样任何人都可以在浏览器里查看你的word文件了。

PHPWord

尽管目前只是测试版但是功能还是很强劲!完美兼容MF Word并且支持打开.doc or.docx。可以插入文本,文本符,分页,页眉/页脚,表格,列表中的元素,超链接等等。

地址:http://phpword.codeplex.com

⑹ 求救,php实现word等文档的web端文件预览,类似于百度文库

貌似php不擅长这个,只能提供思路给你。
事实上word文档是无法在非IE(就算是IE还要已经装了office才行)上预览的,通过网络文库看到的也一样,真实的过程是文件在上传后已经通过特定的类库解析成xml格式,然后存储,然后预览的时候是将这些数据配合样式模拟成word文档的样子而已。
估计PHP用于解析word文档的类库不好找,你可以通过.net辅助一下。
浏览器上传 -> PHP读取上传文件内容 -> PHP发送文件信息给.net程序 ->PHP获取.net程序返回的xml 并处理保存
当用户要看的时候php读出xml,然后配合适当的css展示。

⑺ 如何用预览php网页文件

  1. 进入网络软件中心下载“WampServer”

  2. 软件地址:http://rj..com/soft/detail/10636.html

  3. 默认安装

  4. 安装完成以后将php文件存放于C:wampwww

  5. 浏览器中输入网址localhost/你的php文件名.php

  6. 即可预览PHP网页文件

⑻ PHP如何实现网页预览功能

html文件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css">#yl{ width:200px; height:300px; background-image:url(images/timg1.jpg); background-size:200px 300px;}#file{ width:200px; height:300px; float:left; opacity:0;}</style></head> <body> <form id="sc" action="ylchuli.php" method="post" enctype="multipart/form-data" target="shangchuan"> <input type="hidden" name="tp" value="" id="tp" /> <div id="yl"> <input type="file" name="file" id="file" onchange="document.getElementById('sc').submit()" /> </div> </form> <iframe style="display:none" name="shangchuan" id="shangchuan"></iframe> </body> <script type="text/javascript"> //回调函数,调用该方法传一个文件路径,改变背景图function showimg(url){ var div = document.getElementById("yl"); div.style.backgroundImage = "url("+url+")"; document.getElementById("tp").value = url;} </script> </html>
php文件<?php if($_FILES["file"]["error"]){ echo $_FILES["file"]["error"];}else{ if(($_FILES["file"]["type"]=="image/jpeg" || $_FILES["file"]["type"]=="image/png")&& $_FILES["file"]["size"]<1024000) { $fname = "./images/".date("YmdHis").$_FILES["file"]["name"]; $filename = iconv("UTF-8","gb2312",$fname); if(file_exists($filename)) { echo "<script>alert('该文件已存在!');</script>"; } else { move_uploaded_file($_FILES["file"]["tmp_name"],$filename); $delurl = iconv("UTF-8","gb2312",$_POST["tp"]); unlink($delurl); //删除文件 echo "<script>parent.showimg('{$fname}');</script>"; } }}

⑼ php如何实现word在线预览

php 在线预览 word 文档,有多种方法,本质上来说,大多是调用客户端电脑系统安装的 Word 软件。

可以用 php 语言的 com 支持功能函数来完成,比如:

$word = new COM("word.application") or die("Unable to instanciate Word");$word->Documents->Open($url.$wordname);

或者使用 word 文档的插件来完成,比如:swftools 等。

阅读全文

与php实现文档预览相关的资料

热点内容
单片机代码跳掉 浏览:447
程序员谈薪水压价 浏览:861
荣耀10青春版支持方舟编译啊 浏览:158
最优估计pdf 浏览:826
androiddrawtext字体 浏览:669
c语言源编辑源程序编译 浏览:821
手里捏东西真的可以解压吗 浏览:265
编译原理画状态表 浏览:28
用echo命令产生下列输出 浏览:358
在内网如何访问服务器 浏览:961
java导入oracle数据库 浏览:134
坚朗内开内倒铝条算法 浏览:259
华为阅读新建文件夹 浏览:770
幻塔如何选择服务器 浏览:221
解压先把文件压到系统盘 浏览:822
access压缩和修复数据库 浏览:791
光纤交换机命令 浏览:513
白色桌放什么文件夹 浏览:296
分治算法思想 浏览:151
s曲线加减速算法 浏览:403