精华内容
下载资源
问答
  • Atitit .h5文件上传 v3.pdf
  • 通过h5页面上传视频到Linux服务器.pdf
  • h5 pdf 预览

    2018-11-04 16:45:16
    h5预览pdf所需要的js和css样式,不知道可以去看我的博客
  • h5PDF查看

    2020-03-04 10:21:11
    下面的#smallshade为你要讲PDF展示的div var options = { height: "100%", pdfOpenParams: {view: 'FitV', page: '0' }, name:"mans", fallbackLink: "&l...
    下面的#smallshade为你要讲PDF展示的div
    var options = {
                    height: "100%",
                    pdfOpenParams: {view: 'FitV', page: '0' },
                    name:"mans",
                    fallbackLink: "<p>您的浏览器暂不支持此pdf,请下载最新的浏览器</p>"
                };
                PDFObject.embed(link, "#smallshade",options);

    显示为

    如果隐藏  上面的上传打印功能  

     var options = {
                    height: "100%",
                    pdfOpenParams: {view: 'FitV', page: '0' ,scrollbars: '0', toolbar: '0', statusbar: '0'},
                    name:"mans",
                    fallbackLink: "<p>您的浏览器暂不支持此pdf,请下载最新的浏览器</p>"
                };
                PDFObject.embed(link, "#smallshade",options);

    在pdfOpenParams属性中加入   ,scrollbars: '0', toolbar: '0', statusbar: '0'三个参数

     

    下面为 PDF.js

     

     

    /**
     * Created by super on 2016/12/8.
     */
    /*global ActiveXObject, window, console, define, module, jQuery */
    //jshint unused:false, strict: false
    
    /*
     PDFObject v2.0.201604172
     https://github.com/pipwerks/PDFObject
     Copyright (c) 2008-2016 Philip Hutchison
     MIT-style license: http://pipwerks.mit-license.org/
     UMD module pattern from https://github.com/umdjs/umd/blob/master/templates/returnExports.js
     */
    
    (function (root, factory) {
        if (typeof define === 'function' && define.amd) {
            // AMD. Register as an anonymous module.
            define([], factory);
        } else if (typeof module === 'object' && module.exports) {
            // Node. Does not work with strict CommonJS, but
            // only CommonJS-like environments that support module.exports,
            // like Node.
            module.exports = factory();
        } else {
            // Browser globals (root is window)
            root.PDFObject = factory();
        }
    }(this, function () {
    
        "use strict";
        //jshint unused:true
    
        //PDFObject is designed for client-side (browsers), not server-side (node)
        //Will choke on undefined navigator and window vars when run on server
        //Return boolean false and exit function when running server-side
    
        if(typeof window === "undefined" || typeof navigator === "undefined"){ return false; }
    
        var pdfobjectversion = "2.0.201604172",
            supportsPDFs,
    
            //declare functions
            createAXO,
            isIE,
            supportsPdfMimeType = (typeof navigator.mimeTypes['application/pdf'] !== "undefined"),
            supportsPdfActiveX,
            buildFragmentString,
            log,
            embedError,
            embed,
            getTargetElement,
            generatePDFJSiframe,
            isIOS = (function (){ return (/iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase())); })(),
            generateEmbedElement;
    
    
        /* ----------------------------------------------------
         Supporting functions
         ---------------------------------------------------- */
    
        createAXO = function (type){
            var ax;
            try {
                ax = new ActiveXObject(type);
            } catch (e) {
                ax = null; //ensure ax remains null
            }
            return ax;
        };
    
        //IE11 still uses ActiveX for Adobe Reader, but IE 11 doesn't expose
        //window.ActiveXObject the same way previous versions of IE did
        //window.ActiveXObject will evaluate to false in IE 11, but "ActiveXObject" in window evaluates to true
        //so check the first one for older IE, and the second for IE11
        //FWIW, MS Edge (replacing IE11) does not support ActiveX at all, both will evaluate false
        //Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
        isIE = function (){ return !!(window.ActiveXObject || "ActiveXObject" in window); };
    
        //If either ActiveX support for "AcroPDF.PDF" or "PDF.PdfCtrl" are found, return true
        //Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
        supportsPdfActiveX = function (){ return !!(createAXO("AcroPDF.PDF") || createAXO("PDF.PdfCtrl")); };
    
        //Determines whether PDF support is available
        supportsPDFs = (supportsPdfMimeType || (isIE() && supportsPdfActiveX()));
    
        //Create a fragment identifier for using PDF Open parameters when embedding PDF
        buildFragmentString = function(pdfParams){
    
            var string = "",
                prop;
    
            if(pdfParams){
    
                for (prop in pdfParams) {
                    if (pdfParams.hasOwnProperty(prop)) {
                        string += encodeURIComponent(prop) + "=" + encodeURIComponent(pdfParams[prop]) + "&";
                    }
                }
    
                //The string will be empty if no PDF Params found
                if(string){
    
                    string = "#" + string;
    
                    //Remove last ampersand
                    string = string.slice(0, string.length - 1);
    
                }
    
            }
    
            return string;
    
        };
    
        log = function (msg){
            if(typeof console !== "undefined" && console.log){
                console.log("[PDFObject] " + msg);
            }
        };
    
        embedError = function (msg){
            log(msg);
            return false;
        };
    
        getTargetElement = function (targetSelector){
    
            //Default to body for full-browser PDF
            var targetNode = document.body;
    
            //If a targetSelector is specified, check to see whether
            //it's passing a selector, jQuery object, or an HTML element
    
            if(typeof targetSelector === "string"){
    
                //Is CSS selector
                targetNode = document.querySelector(targetSelector);
    
            } else if (typeof jQuery !== "undefined" && targetSelector instanceof jQuery && targetSelector.length) {
    
                //Is jQuery element. Extract HTML node
                targetNode = targetSelector.get(0);
    
            } else if (typeof targetSelector.nodeType !== "undefined" && targetSelector.nodeType === 1){
    
                //Is HTML element
                targetNode = targetSelector;
    
            }
    
            return targetNode;
    
        };
    
        generatePDFJSiframe = function (targetNode, url, pdfOpenFragment, PDFJS_URL, id){
    
            var fullURL = PDFJS_URL + "?file=" + encodeURIComponent(url) + pdfOpenFragment;
            var scrollfix = (isIOS) ? "-webkit-overflow-scrolling: touch; overflow-y: scroll; " : "overflow: hidden; ";
            var iframe = "<div style='" + scrollfix + "position: absolute; top: 0; right: 0; bottom: 0; left: 0;'><iframe  " + id + " src='" + fullURL + "' style='border: none; width: 100%; height: 100%;' frameborder='0'></iframe></div>";
            targetNode.className += " pdfobject-container";
            targetNode.style.position = "relative";
            targetNode.style.overflow = "auto";
            targetNode.innerHTML = iframe;
            return targetNode.getElementsByTagName("iframe")[0];
    
        };
    
        generateEmbedElement = function (targetNode, targetSelector, url, pdfOpenFragment, width, height, id){
    
            var style = "";
    
            if(targetSelector && targetSelector !== document.body){
                style = "width: " + width + "; height: " + height + ";";
            } else {
                style = "position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;";
            }
    
            targetNode.className += " pdfobject-container";
            targetNode.innerHTML = "<embed " + id + " class='pdfobject' src='" + url + pdfOpenFragment + "' type='application/pdf' style='overflow: auto; " + style + "'/>";
    
            return targetNode.getElementsByTagName("embed")[0];
    
        };
    
        embed = function(url, targetSelector, options){
    
            //Ensure URL is available. If not, exit now.
            if(typeof url !== "string"){ return embedError("URL is not valid"); }
    
            //If targetSelector is not defined, convert to boolean
            targetSelector = (typeof targetSelector !== "undefined") ? targetSelector : false;
    
            //Ensure options object is not undefined -- enables easier error checking below
            options = (typeof options !== "undefined") ? options : {};
    
            //Get passed options, or set reasonable defaults
            var id = (options.id && typeof options.id === "string") ? "id='" + options.id + "'" : "",
                page = (options.page) ? options.page : false,
                pdfOpenParams = (options.pdfOpenParams) ? options.pdfOpenParams : {},
                fallbackLink = (typeof options.fallbackLink !== "undefined") ? options.fallbackLink : true,
                width = (options.width) ? options.width : "100%",
                height = (options.height) ? options.height : "100%",
                forcePDFJS = (typeof options.forcePDFJS === "boolean") ? options.forcePDFJS : false,
                PDFJS_URL = (options.PDFJS_URL) ? options.PDFJS_URL : false,
                targetNode = getTargetElement(targetSelector),
                fallbackHTML = "",
                pdfOpenFragment = "",
                fallbackHTML_default = "<p>This browser does not support inline PDFs. Please download the PDF to view it: <a href='[url]'>Download PDF</a></p>";
    
            //If target element is specified but is not valid, exit without doing anything
            if(!targetNode){ return embedError("Target element cannot be determined"); }
    
    
            //page option overrides pdfOpenParams, if found
            if(page){
                pdfOpenParams.page = page;
            }
    
            //Stringify optional Adobe params for opening document (as fragment identifier)
            pdfOpenFragment = buildFragmentString(pdfOpenParams);
    
            //Do the dance
            if(forcePDFJS && PDFJS_URL){
    
                return generatePDFJSiframe(targetNode, url, pdfOpenFragment, PDFJS_URL, id);
    
            } else if(supportsPDFs){
    
                return generateEmbedElement(targetNode, targetSelector, url, pdfOpenFragment, width, height, id);
    
            } else {
    
                if(PDFJS_URL){
    
                    return generatePDFJSiframe(targetNode, url, pdfOpenFragment, PDFJS_URL, id);
    
                } else if(fallbackLink){
    
                    fallbackHTML = (typeof fallbackLink === "string") ? fallbackLink : fallbackHTML_default;
                    targetNode.innerHTML = fallbackHTML.replace(/\[url\]/g, url);
    
                }
    
                return embedError("This browser does not support embedded PDFs");
    
            }
    
        };
    
        return {
            embed: function (a,b,c){ return embed(a,b,c); },
            pdfobjectversion: (function () { return pdfobjectversion; })(),
            supportsPDFs: (function (){ return supportsPDFs; })()
        };
    
    }));

     

     

    展开全文
  • h5获取pdf文件实现预览

    万次阅读 2016-03-30 12:47:16
    native嵌套 h5实现 pdf 预览目前实现嵌套预览pdf的有很多种方法各种插件:http://www.open-open.com/news/view/1fc3e18/,这里我就介绍我要实现的功能 我需要native嵌套h5,实现*.pdf预览,而我的pdf,并不是本地的...

    native嵌套 h5实现 pdf 预览

    目前实现嵌套预览pdf的有很多种方法各种插件:http://www.open-open.com/news/view/1fc3e18/

    这里我就介绍我要实现的功能:

       我需要native嵌套h5,实现*.pdf预览,而我的pdf,并不是本地的pdf文件,而是通过某服务器下发的http协议的pdf文件

       大致分为两种情况,你肯定会说 native为什么还要分为两种情况呢?
     
       就目前(2016-03-30)来说,IOS系统兼容性还可以,但是Android就不同了,Android手机是各色各样,我的实现如下:

    1、IOS版

    window.open(“服务器下发的文件”); //即可实现

    2、Android版

       Android就不同了,可通过服务器下发的*.pdf文件先下载到本地,只有这样方才可打开。
       H5如何下载文件到本地:http://blog.csdn.net/qq_16559905/article/details/51012763
       然后通过native自带的浏览器打开
    展开全文
  • H5 上传文件

    2018-08-31 15:49:50
    jsp:代码 &lt;input type="file" name="applyFile"...application/pdf,image/*" multiple="multiple" &gt;  &lt;img alt="" src="" id

    jsp:代码

    <input type="file" name="applyFile" id="applyFile" capture="camera" accept="application/pdf,image/*" multiple="multiple" >

      <img alt="" src="" id = "testImg" width="140" height="180">

    var filedata = new Array();

        $("#applyFile").change(function(){

        debugger

          var file = document.getElementById("applyFile").files[0];              

           if(file) {

               var reader = new FileReader();

               reader.readAsDataURL(file);

               reader.onload = function(){

                   var imgstr = this.result; //这就是base64字符串

                    var image = document.getElementById("testImg");

                   image.src = imgstr;

                   filedata[0] = imgstr;

                   alert(imgstr);

                  var imageName = '111.pdf';

                 //这里可换成ajax请求因为本框架不是springmvc没有使用ajax

                   PlatformContext.getJSONBean('registerJsBean',appId).uploadImage(imageName,imgstr)

                  .done(function(returnProduct){

                     alert("成功");

                      }).fail(function(err){

                        alert(err);

                      });

               };  

           }

        });

    java代码:

    public TransResult<Boolean> uploadImage(String imageName,String imageBase64){

        Map<String, String> imgMap = new HashMap<>();

         imageBase64=imageBase64.substring(imageBase64.indexOf(",")+1);

        imgMap.put(imageName, imageBase64);

        VisitService visitService = (VisitService) ApplicationContextUtil.getBean("visitServiceImpl");

        TransResult<String> resList = visitService.uploadFile(imgMap);

         return null;

    }

    @Override

       public TransResult<String> uploadFile(Map<String, String> imgMap) {

         // TODO Auto-generated method stub

         TransResult<String> result = new TransResult<>();

         OutputStream out = null;

         String imgTempPath = PropertiesUtil.getProperties("ftp.properties").getProperty(VisitConstant.VISIT_IMAGE_TEMP_PATH);

         try {

            for(String imgName : imgMap.keySet()){

              BASE64Decoder decoder = new BASE64Decoder();

              String imageBase64=imgMap.get(imgName);

              imageBase64=imageBase64.substring(imageBase64.indexOf(",")+1);

              byte[] bytes = decoder.decodeBuffer(imageBase64);

              for (int i = 0; i < bytes.length; ++i) {

                 if (bytes[i] < 0) {// 调整异常数据

                   bytes[i] += 256;

                 }

              }

              String path = imgTempPath+ imgName;

              // 生成jpeg图片

              out = new FileOutputStream(path);

              out.write(bytes);

              out.flush();

            }

            result.success();

            result.setObject(imgTempPath);

         } catch (Exception e) {

            result.failure("保存图片过程中异常");

            Logger.info("[回访服务][保存图片][异常]");

            Logger.printStackTrace(e);

         }finally {

            try {

              out.close();

            } catch (IOException e) {

              // TODO Auto-generated catch block

              e.printStackTrace();

            }

         }

         return result;

       }

    展开全文
  • 实现代码: <iframe :src="'//www.xdocin.com/xdoc?_func=to&_format=html&_cache=1&_xdoc='+pdfUrl" width="100%" height="100%" frameborder="0"> </iframe> 可以直接打开看

    实现代码:

    pdfUrl 写你的文件路径

    <iframe 
        :src="'//www.xdocin.com/xdoc?_func=to&_format=html&_cache=1&_xdoc='+pdfUrl"
    	width="100%"
    	height="100%"
    	frameborder="0">
    </iframe>

    可以直接打开看

    展开全文
  • preface 最近 需要实现一个上传 压缩包的需求: 支持 zip,rar 文件上传。 问题背景: xxxx业务设置 上传类型为压缩包的时候,预期前台 ios...当前问题: 遇到了 ios11.0.2 和 ios11.0.3下 不能识别 rar文件,在h5中不能
  • 小程序跳转到h5进行文件上传包,用于企业小程序端无法选择文件上传的问题
  • 可以直接设置input标签的accept属性来限制上传文件的类型<input type="file" accept="application/msword" ><br> accept属性列表 1.accept=”application/msexcel” 2.accept=”application/msword” 3....
  • 给移动端提供了一个h5链接,这个链接地址完成的是表单上传附件,很简单的一个功能,直接沿用的pc端的写法,代码如下: <div class="inputCon"> <input type="hidden" id="jlzm" name="jlzm" value="jlzm"/> ...
  • 插件描述:这是一款流畅的H5文件上传插件,覆盖几乎所有的使用场景,支持上传前预览,多(单)文件上传自定义,支持实时进度条等,你可以按照你想要的方式自定义更新时间:2021-05-3016:15:41更新说明:1. 新增loading...
  • 怎样将PDF转成Word?这是很多网友经常问到的问题,PDF转换成Word利用一些小技巧和工具,你会发现是很容易的,以下的PDF转Word的3种免费方法你一定要看一看。1、“复制/粘贴”大法在寻找如何将PDF转换成Word的“高级...
  • H5页面中我们常需要进行文件上传,那么怎么来实现这个功能呢??? 我主要谈如下两种方法。 (一)、传统的form表单方法 <form action="/Home/SaveFile1" method="post" enctype="multipart/form-data"> ...
  • uniapp 在线预览pdf文件流(h5)

    千次阅读 2021-04-27 11:35:40
    uniapp h5 实现在线预览pdf文件流
  • H5标签input标签上传文件(一)

    万次阅读 2018-01-31 21:00:21
    H5的input标签提供了type=file的文件上传功能,那么如何用这个标签实现前后端之间的文件上传呢。 百度了一下,一个能用的都没有,都有BUG,讲的也很复杂,好气喔,自己写吧! 先看一部分代码: html> ...
  • h5 input 实现 上传文件

    2021-01-27 10:28:56
    单个文件上传 html <input type="file" id="file1" oninput="fileChange()" > <img src="" alt="上传" id="upLoadImg"> js const file1 = document.getElementById('file1') const upLoadImg = ...
  • 今天聊下H5页面中,上传图片获取图片名称、大小、删除效果 <div class="fankui_img"> <div class="file_file"> <input type="file" multiple="multiple" name="fileLa" id="fileLa" value=...
  • H5 + ajax 实现文件上传

    2020-08-03 17:34:52
    利用H5的特效,file来实现文件上传 <input id="toSelectImage" type="file" accept="image/*"> 设置toSelectImage元素隐藏,点击上传按钮时,js触发该元素点击 $('#toSelectImage').click() 监听该元素...
  • 它支持直接在线查看PDF、TXT、PHP、sh。doc不能在线阅读,只可以下载。 1. 环境准备 h5ai是php开发的,需要挂在已经运行web服务的服务器(Apache/Nginx)上。我们的机器环境是php-5.6 + Apache-2.4。
  • 附带上传源码如下: 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>测试上传功能</title> 5 <meta charset='utf-8'/> 6 <style type="text/css"> 7 ....
  • h5在线预览dox、xls、ppt、pdf

    万次阅读 2018-11-07 23:26:59
    h5在线预览dox、xls、ppt、pdf    App中上传附件的服务器后,需要对附件进行预览; webApp可以通过两种方式实现, 1、将附件下载到本地,通过plus.runtime.openFile打开本地文件 2、在线预览dox、xls、ppt、...
  • H5移动端原生JS封装附件上传服务器

    千次阅读 2019-11-07 09:19:57
    本文主要通过原生的js封装附件上传upload.js。可成功内嵌钉钉,ios和安卓端可正常使用,支持单个、多个附件上传。 一、业务需求 封装原生JS附件上传,动态创建附件列表,可对附件列表进行删除和新增功能。 二、业务...
  • uni-app上传文件(h5

    千次阅读 热门讨论 2020-09-29 09:59:06
    需求为:h5页面中,能够上传文件,不仅仅是图片。整体框架用的是uni-app,导致限制很多,尝试了很多方法,最后终于实现了。动态创建input标签,使用xhr上传,代码如下: 1,需要上传的todo.vue页面中, <view ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,395
精华内容 558
关键字:

h5上传pdf