【发布时间】:2014-03-29 15:50:34
【问题描述】:
请参考下面带有角度js代码的简单html
<!doctype html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script>
</head>
<body>
<div ng-controller="MyCtrl">
Hello, {{name}}!
</div>
<script type="text/javascript">
var myApp = angular.module('myApp',[]);
//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});
function MyCtrl($scope) {
$scope.name = 'Superhero';
}
</script>
</body>
</html>
当我在浏览器中打开这个 html 时它会正常工作。但我想将此 html 内容导出为 pdf。
读取 html 的所有内容并将内容写入 pdf 文件,但 angular js 代码未在 pdf 中解析。
//reading the html content
string contents = File.ReadAllText(path);
//writing the html content to pdf
File.WriteAllText(path, contents);
但是pdf格式的输出像
Hello, {{name}}!
这意味着它没有在 pdf 中解析。如何解决这个问题。
注意:我不想使用一些外部插件来为 Angular js 代码生成 pdf。我需要在 C# 中进行简单的读写操作。
【问题讨论】:
标签: javascript html angularjs pdf