如何查看浏览器中使用HTML的PDF的特定网页? [英] How to view particular page of an pdf using HTML in browser?

查看:419
本文介绍了如何查看浏览器中使用HTML的PDF的特定网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打开一个PDF文件,并​​显示特定的页面时,I $上的按钮p $ PSS

I would like to open a pdf file and show particular page when I press on a button

我已经试过一个onclick监听器里面:

What I have tried inside an onclick listener is :

$("body").prepend("<object id='largePdf' data= '" + sourceFolder + "MyNews/2013/08/16/0/0/A/Content/1/A_ALL.pdf#page=1' type='application/pdf' width='1861' height='3061'>alt : <a href= '" + sourceFolder + "MyNews/2013/08/16/0/0/A/Content/1/A_ALL.pdf#page=1'>pg001.pdf</a></object>")

的问题是,似乎它不能REF并只显示第1页,也,PDF格式的大小没有放大预期。例如股利的具体规模,但内容不是。例如如果我具体尺寸=瓦特:1000中,h:2000,背景:瓦特:1000中,h:2000,但内容可以是瓦特:800中,h:1500。

The problem is , it seems it can not ref to and just show the page 1, also , the size of pdf is not zoom as expected. e.g. the div is the exact size but the content is not. e.g. If I specific size = w:1000, h:2000, the background : w:1000,h:2000 , but the content may be w:800,h:1500.

如何 我解决这个问题呢?谢谢

How can I fix the problems ? thanks

推荐答案

如果您知道的页码去,和你的PDF插件是一个附带的Adobe Acrobat Reader软件,你可以这样做:

If you know the page number to go to, and your PDF plugin is the one which comes with Adobe Acrobat Reader, you could do this:

largePdf.setCurrentPage(n);

该API描述这里。

下面是用的 OLEVIEW 上AcroPdf.dll(插件,C:\ Program Files文件(x86)的\ Common Files文件\的Adobe \ Acrobat中\的ActiveX \ AcroPDF.dll我的电脑)。它看起来不像是有办法找到的页面总数虽然。

Below is a short list of APIs obtained with OleView on AcroPdf.dll (the plugin, "C:\Program Files (x86)\Common Files\Adobe\Acrobat\ActiveX\AcroPDF.dll" on my PC). It doesn't look like there is a way to find the total number of pages though.

interface IAcroAXDocShim : IDispatch {
    [id(0x00000001), propget, helpstring("property src")]
    HRESULT src([out, retval] BSTR* pVal);
    [id(0x00000001), propput, helpstring("property src")]
    HRESULT src([in] BSTR pVal);
    [id(0x00000002), helpstring("method LoadFile")]
    HRESULT LoadFile(
                    [in] BSTR fileName, 
                    [out, retval] VARIANT_BOOL* ret);
    [id(0x00000003), helpstring("method setShowToolbar")]
    HRESULT setShowToolbar([in] VARIANT_BOOL On);
    [id(0x00000004), helpstring("method gotoFirstPage")]
    HRESULT gotoFirstPage();
    [id(0x00000005), helpstring("method gotoLastPage")]
    HRESULT gotoLastPage();
    [id(0x00000006), helpstring("method gotoNextPage")]
    HRESULT gotoNextPage();
    [id(0x00000007), helpstring("method gotoPreviousPage")]
    HRESULT gotoPreviousPage();
    [id(0x00000008), helpstring("method setCurrentPage")]
    HRESULT setCurrentPage([in] long n);
    [id(0x00000009), helpstring("method goForwardStack")]
    HRESULT goForwardStack();
    [id(0x0000000a), helpstring("method goBackwardStack")]
    HRESULT goBackwardStack();
    [id(0x0000000b), helpstring("method setPageMode")]
    HRESULT setPageMode([in] BSTR pageMode);
    [id(0x0000000c), helpstring("method setLayoutMode")]
    HRESULT setLayoutMode([in] BSTR layoutMode);
    [id(0x0000000d), helpstring("method setNamedDest")]
    HRESULT setNamedDest([in] BSTR namedDest);
    [id(0x0000000e), helpstring("method Print")]
    HRESULT Print();
    [id(0x0000000f), helpstring("method printWithDialog")]
    HRESULT printWithDialog();
    [id(0x00000010), helpstring("method setZoom")]
    HRESULT setZoom([in] single percent);
    [id(0x00000011), helpstring("method setZoomScroll")]
    HRESULT setZoomScroll(
                    [in] single percent, 
                    [in] single left, 
                    [in] single top);
    [id(0x00000012), helpstring("method setView")]
    HRESULT setView([in] BSTR viewMode);
    [id(0x00000013), helpstring("method setViewScroll")]
    HRESULT setViewScroll(
                    [in] BSTR viewMode, 
                    [in] single offset);
    [id(0x00000014), helpstring("method setViewRect")]
    HRESULT setViewRect(
                    [in] single left, 
                    [in] single top, 
                    [in] single width, 
                    [in] single height);
    [id(0x00000015), helpstring("method printPages")]
    HRESULT printPages(
                    [in] long from, 
                    [in] long to);
    [id(0x00000016), helpstring("method printPagesFit")]
    HRESULT printPagesFit(
                    [in] long from, 
                    [in] long to, 
                    [in] VARIANT_BOOL shrinkToFit);
    [id(0x00000017), helpstring("method printAll")]
    HRESULT printAll();
    [id(0x00000018), helpstring("method printAllFit")]
    HRESULT printAllFit([in] VARIANT_BOOL shrinkToFit);
    [id(0x00000019), helpstring("method setShowScrollbars")]
    HRESULT setShowScrollbars([in] VARIANT_BOOL On);
    [id(0x0000001a), helpstring("method GetVersions")]
    HRESULT GetVersions([out, retval] VARIANT* ret);
    [id(0x0000001b), helpstring("method setCurrentHightlight")]
    HRESULT setCurrentHightlight(
                    [in] long a, 
                    [in] long b, 
                    [in] long c, 
                    [in] long d);
    [id(0x0000001c), helpstring("method setCurrentHighlight")]
    HRESULT setCurrentHighlight(
                    [in] long a, 
                    [in] long b, 
                    [in] long c, 
                    [in] long d);
    [id(0x0000001d), helpstring("method postMesage")]
    HRESULT postMessage([in] VARIANT strArray);
    [id(0x0000001e), propget, helpstring("property messageHandler")]
    HRESULT messageHandler([out, retval] VARIANT* pVarOut);
    [id(0x0000001e), propput, helpstring("property messageHandler")]
    HRESULT messageHandler([in] VARIANT pVarOut);
    [id(0x0000001f), helpstring("method execCommand")]
    HRESULT execCommand([in] VARIANT strArray);
};

这篇关于如何查看浏览器中使用HTML的PDF的特定网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆