【问题标题】:Embedding issuu嵌入问题
【发布时间】:2012-04-10 09:34:31
【问题描述】:

我需要在网站中嵌入一个issuu 文档。应该允许网站管理员决定在前端显示哪个文档。

这是一项简单的任务,使用发行页面上的嵌入链接。但我需要自定义一些选项——例如,禁用共享、设置尺寸等等。我不能指望管理员每次需要更改文档时都会执行此过程。

我可以根据自己的喜好轻松自定义 issuu 嵌入代码,而我只需要文档 ID。不幸的是,该 id 不包含在文档的发行页面中。例如,this random link 的 id 恰好是 110209071155-d0ed1d10ac0b40dda80dad24166a76ee,无论在 URL 中还是在页面中都找不到。您必须深入挖掘嵌入代码才能找到它。

我认为issuu API 可以让我根据其 URL 获取文档 ID,但我找不到类似的东西。最接近的匹配是搜索 API,但如果我 search for the exact name of the document 我只得到一个匹配不同文档!

是否有一些简单的方法可以嵌入只知道其 URL 的文档?还是非技术人员在页面中查找文档 ID 的简单方法?

【问题讨论】:

  • 您找到解决方案了吗?我需要启用打印..

标签: web-services api frontend issuu


【解决方案1】:

不幸的是,您定制的唯一方法是支付每月 39 美元的服务费用 =/。

您可以通过使用强制进入没有广告的全屏模式

<body style="margin:0px;padding:0px;overflow:hidden">        
    <iframe src="YOUR ISSU EMBED" frameborder="0" style="overflow:hidden;height:105%;width:105%;position:absolute;" height="100%" width="100%""></iframe>    
</body>

【讨论】:

    【解决方案2】:

    您当然可以嵌入课程堆栈,但这不会显示在 Issuu 网站上。这是代码(它的旧代码,但它有效):

    <iframe src="http://static.issuu.com/widgets/shelf/index.html?folderId=FOLDERIDamp;theme=theme1&amp;rows=1&amp;thumbSize=large&amp;roundedCorners=true&amp;showTitle=true&amp;showAuthor=false&amp;shadow=true&amp;effect3d=true" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="100%" height="200"></iframe>
    

    FOLDERID 是您在进入堆栈时在地址栏上获得的 36 个字符的数量(例如:https://issuu.com/username/stacks/FOLDERID)。当您在代码中替换它时,您必须以这种格式 8-4-4-4-12 粘贴 36 个字符,并在字符之间使用 - 。瞧它的工作原理。 您可以在代码中更改主题和其他内容。

    【讨论】:

    • 对 folderId 非常困惑。当您指出格式发生了变化时,它非常有意义。
    【解决方案3】:

    文档 ID 可以在每个文档的 HTML 源代码中找到。它位于 og:video 元属性中。

    <meta property="og:video" content="http://static.issuu.com/webembed/viewers/style1/v2/IssuuReader.swf?mode=mini&amp;documentId=XXXXXXXX-XXXXXXXXXXXXX&amp;pageNumber=0">
    

    您可以使用DomDocument 和DomXPath php 类轻松处理它。

    这里是使用 PHP 的方法:

    //  Your document URL
    $url = 'https://issuu.com/proyectotres/docs/proyecto_3_edicion_135';
    
    //  Turn off errors, loads the URL as an object and then turn errors on again
    libxml_use_internal_errors(true);   
    $dom = DomDocument::loadHTMLFile($url);
    libxml_use_internal_errors(false);
    
    //  DomXPath helps find the <meta property="og:video" content="http://hereyoucanfindthedocumentid?documentId=xxxxx-xxxxxxx"/> 
    $xpath = new DOMXPath($dom);
    $meta = $xpath->query("//html/head/meta[@property='og:video']");
    
    //  Get the content attribute of the <meta> node and parse its query
    $vars = [];
    parse_str(parse_url($meta[0]->getAttribute('content'))['query'], $vars);
    
    //  Ready. The document ID is here:
    $docID = $vars['documentId'];
    
    // You can print it:
    echo $docID;
    

    你可以用你自己Issu文档的URL试试。

    【讨论】:

      【解决方案4】:

      您可以使用文档的 Issuu URL 来完成此 iframe:

      <iframe width="100%" height="283" style="display: block; margin-left: auto; margin-right: auto;" src="https://e.issuu.com/issuu-reader3-embed-files/latest/twittercard.html?u=nantucketchamber&amp;d=program-update1&amp;p=1" frameborder="0" allowfullscreen="allowfullscreen" span="" id="CmCaReT"></iframe>
      

      您只需将“nantucketchamber”替换为用户名,将“program-update1”替换为 Issuu URL 中的文件名

      (对于这个例子,URL 是https://issuu.com/nantucketchamber/docs/program-update1)

      【讨论】:

        猜你喜欢
        • 2020-12-05
        • 2011-08-29
        • 2020-12-31
        • 1970-01-01
        • 1970-01-01
        • 2018-07-29
        • 2011-08-25
        • 2012-11-15
        • 1970-01-01
        相关资源
        最近更新 更多