如何将整个网页或HTML内容与Highcharts不仅仅是图表出口?(How to export t

2019-06-23 23:33发布

大家好我的图表与highcharts精细出口即时得到我的PHP项目图表

但问题是

我要找导入的HTML内容或整个页面与图表不只是沿着图

是有可能这样做?

谁能帮我

或显示这里是一个样本小提琴http://jsfiddle.net/YBXdq/

我需要将文本导出下面的图表具有良好的

Answer 1:

有这么多的直接和间接的方式来实现这一目标

  • 使用HTML画布: http://html2canvas.hertzen.com/

  • 使用wkhtmltoimage

  exec('wkhtmltoimage --quality 50 http://www.bbc.com bbc.jpg');
  • 使用wkhtmltopdf + ImageMagic

    -转换的网页, pdf使用wkhtmltopdf

    -转换pdfjpg使用ImageMagic

exec("convert a.pdf a.jpg");
  • 用PHP 图像严重的窗口和形象严重屏

$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://localhost");

/* Still working? */
while ($browser->Busy) {
    com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();

header("Content-Type: image/png");
imagepng($im);
imagedestroy($im);

推进例子

-请参见获取网站截图使用PHP

对于可能出现的问题: 获得imagegrabscreen工作

  • 使用Webshort并使用从PHP调用它exec ,如果你已经安装了Python

exec("python webshot.py https://example.com/webshot/php example.png");
  • 下载并使用网址缩略发电机

webthumb.php?url=http://www.google.com&x=150&y=150
  • 使用博克卡特

exec('boxcutter -f image.png');
  • 捕捉屏幕截图PHP中GrabzIt

$grabzIt = new GrabzItClient("APPLICATION KEY", "APPLICATION SECRET");
$id = $grabzIt->TakePicture("http://www.google.com", "http://www.example.com/GrabzItHandler.php");
  • 使用wimg.ca

例如这个当前页面

  http://wimg.ca/https://stackoverflow.com/questions/10328457/how-to-export-the-whole-page-or-html-content-with-highcharts-not-just-the-chart/10330701#10330701
  • TimThumb - PHP图像调整

 timthumb.php?src=http://www.google.com/&webshot=1

我想给足够多的例子更



Answer 2:

你可以尝试打印的页面,或者使用PHP文件的功能,以获得所需的HTML内容制作的PDF文件。

或者你可以尝试通过巴巴告知获得的图像的方法:)



Answer 3:

我发现了一个简单的解决方法导出图表(打印)

我没有使用任何插件,只是有点老式CSS和JavaScript的一些

这在我的情况是

我想打印图表与页面的某些特定HTML内容

或在我的情况我想去除页眉,页脚和左边的菜单

我想凭着显示按钮或不必要的内容

并且只显示网页内容,说明表格和图表

所以这里是我我如何实现它。

> CSS: -


<style type="text/css">
@media print{
@page
        {
            size: auto;   /* auto is the initial value */
            margin: 0mm;  /* this affects the margin in the printer settings */
        }
  body{ background-color:#FFFFFF; background-image:none; color:#000000 }
  .navimainbg{ display:none;}
  .printhide{ display:none;}
  .usercontent-footer{ display:none;}
  .linkBTN{ display:none;}
  .userheader{ display:none;}
  .user-profile-left{ display:none;}
  #userbgcontent{ width:100%;}
}
</style>

我们在这里集中在打印的CSS我们暗示打印页面时

接取的div或者你不想在网页的部分OT通过自己的class和id根据您的使用情况被打印

例如

我没有想要显示的按钮

 .linkBTN{ display:none;}

它可以通过JavaScript简称。

使用Javascript: - >


<script type="text/javascript">


function printpage()
{

window.print()
}

<script type="text/javascript">

我们可以调用打印功能在我的情况“的PrintPage”呼叫功能打印我们不希望通过点击按钮与页面打印页减去的元素,你可以看到这个按钮也不会同时为printhide类显示打印显示设置为none而priting

<input title="Print a Printer Friendly Page" class ="printhide" type="button" value="Print this page" onclick="printpage()">

心不是为它打印图表比highcharts印刷等,如果你要打印更多的简单方法

只有con是,有时图像将滑下时要显示它与一些conetent一起由于缺乏规模的渲染图像。 它会转移到下一个页面。 比其测试工作等。



文章来源: How to export the whole page or html content with Highcharts not just the chart?