小编mat*_*cha的帖子

使用iTextSharp生成PDF

我正在尝试将图像添加到现有PDF的每个页面的顶部.我尝试过使用PdfStamp,但出于某种原因,当我尝试从Chrome打印pdf时,我得到的是一个黑页.Adobe Reader也只显示原始文档.有没有人对如何使其工作有任何想法?这是代码.

public partial class MakePdf : System.Web.UI.Page
{
    public MemoryStream m = new MemoryStream();
    protected void Page_Load(object sender, EventArgs e)
    {
        Document document = new Document(PageSize.LETTER);

        Response.ContentType = "application/pdf";
        string RESULT = @"C:\Users\maitchison\Documents\Pdf\Service Report Search - 650-10-067 4114.pdf";
        PdfReader reader = new PdfReader(RESULT);
        PdfStamper stamp = new PdfStamper(reader, m);
        try
        {
            // Set ContentType and create an instance of the Writer.

            Response.ContentType = "application/pdf";
            PdfWriter writer = PdfWriter.GetInstance(document, m);
            writer.CloseStream = false;

            // Open Document

            document.Open();

            int n = …
Run Code Online (Sandbox Code Playgroud)

c# pdf asp.net barcode itext

11
推荐指数
1
解决办法
1万
查看次数

从Angular Promise获取数据

我试图得到MotorRestangular.all('Motors').getList()分配给变量的响应,a以便我以后可以使用它.问题是,如果我尝试访问a我的return函数内部,它是未定义的.我知道这不是完成我需要的正确方法,但我不知道如何以其他方式做到这一点.

myApp.factory('Configurations', function(Restangular, MotorRestangular) {
  var a;
  var Motors = function() {
    MotorRestangular.all('Motors').getList().then(function(Motors){
      a = Motors;
    }); 
  }



  return {
    config: function(){
      Motors();
      console.log(a);
      var g = _.groupBy(Motors, 'configuration');
      console.log(g);
      var mapped = _.map(g, function(m) {
        return {

            id: m[0].configuration,
            configuration: m[0].configuration,
            sizes: _.map(m, function(a) {return a.sizeMm})
      }});
    }
  }

});
Run Code Online (Sandbox Code Playgroud)

javascript promise angularjs restangular

3
推荐指数
1
解决办法
2446
查看次数

带有VS2010错误的Report Builder 3.0

我使用Report Builder 3.0构建了一个报告,我试图在VS 2010中使用报表查看器显示它.我一直收到此错误消息.

报告定义无效.详细信息:报表定义具有无效的目标命名空间"http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition",无法升级.

这是我正在使用的代码.

public partial class ViewReport : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
            PopulateReport(GetDataSet("24"), Server.MapPath("/IncidentReportOld.rdl"));
    }
    private DataSet GetDataSet(string id)
    {
        string sql = string.Empty;
        SqlDataAdapter ada;
        string conString = "Data Source=con-sqlc-02;Initial Catalog=Incident;Integrated Security=True";

        DataSet ds = new DataSet();

        sql = "select * from Rpt_Incident where incidentID = " + id;
        ada = new SqlDataAdapter(sql, conString);
        ada.Fill(ds, "Incidents");

        return ds;
    }

    private void PopulateReport(DataSet ds, string reportPath)
    {
        /* Put the stored …
Run Code Online (Sandbox Code Playgroud)

asp.net reportbuilder visual-studio-2010 c#-4.0

2
推荐指数
1
解决办法
5009
查看次数