当前位置: 首页>>代码示例>>C#>>正文


C# PdfDocument.SaveToHttpResponse方法代码示例

本文整理汇总了C#中PdfDocument.SaveToHttpResponse方法的典型用法代码示例。如果您正苦于以下问题:C# PdfDocument.SaveToHttpResponse方法的具体用法?C# PdfDocument.SaveToHttpResponse怎么用?C# PdfDocument.SaveToHttpResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PdfDocument的用法示例。


在下文中一共展示了PdfDocument.SaveToHttpResponse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Button1_Click

        protected void Button1_Click(object sender, System.EventArgs e)
        {
            //Create a pdf document.
            PdfDocument doc = new PdfDocument();

            // Create one page
            PdfPageBase page = doc.Pages.Add();

            DrawSpiro(page);
            DrawPath(page);

            //Save to browser
            doc.SaveToHttpResponse("Shape.pdf", Response, HttpReadType.Save);
            doc.Close();
        }
开发者ID:e-iceblue,项目名称:Spire.Office-for-.NET,代码行数:15,代码来源:Default.aspx.cs

示例2: PDFQuote


//.........这里部分代码省略.........
                    y += size.Height + 2;
                y += (buildPdfLines(page, quote.linesInst, "Installation", y)).Bounds.Height + 2;
            }

            if (quote.linesRec.Count > 0)
            {
                page.Canvas.DrawString("Recurring", helv16, black, pageWidth / 2, y, centered);
                size = helv16.MeasureString("Recurring");
                y += size.Height + 2;
                y += (buildPdfLines(page, quote.linesRec, "Recurring", y)).Bounds.Height + 2;
            }

            bool FreightExists = false; if (quote.Freight > 0) FreightExists = true;
            bool SalesTaxExists = false; if (quote.SalesTax > 0) SalesTaxExists = true;
            double GrandTotal = quote.GetGrandTotal();

            //NOTES
            if (quote.ExternalNotes.Length > 0)
            {
                string notes = quote.ExternalNotes;
                PdfStringLayouter layouter = new PdfStringLayouter();
                PdfStringFormat format = new PdfStringFormat();
                format.LineSpacing = helv11.Size * 1.5f;

                PdfStringLayoutResult result = layouter.Layout(notes, helv11, format, new SizeF(pageWidth, y));

                page.Canvas.DrawString("Notes", helv14, black, pageWidth / 2, y, centered);
                size = helv14.MeasureString("LULZ");
                y += size.Height + 2;

                foreach (LineInfo line in result.Lines)
                {
                    page.Canvas.DrawString(line.Text, helv11, black, 0, y, format);
                    y = y + result.LineHeight;
                }

            }

            y += 5;
            page.Canvas.DrawLine(new PdfPen(PdfBrushes.Black, .5f), new PointF(0, y), new PointF(pageWidth, y));
            y += 5;

            //TOTALS
            if(FreightExists || SalesTaxExists)
            {
                page.Canvas.DrawString("Subtotal: $" + GrandTotal.ToString(), helv12, black, 0, y);
            }
            if(FreightExists)
            {
                page.Canvas.DrawString("Freight: $" + quote.Freight.ToString(), helv12, black, pageWidth/4, y);
                GrandTotal += quote.Freight;
            }
            if (SalesTaxExists)
            {
                page.Canvas.DrawString("Sales Tax: $" + quote.SalesTax.ToString(), helv12, black, pageWidth / 2, y);
                GrandTotal += quote.SalesTax;
            }

            page.Canvas.DrawString("Total: $" + GrandTotal.ToString(), helv12Bold, black, pageWidth, y, rightAlign);
                size = helv12Bold.MeasureString("999999");

            y += size.Height + 5;
            page.Canvas.DrawLine(new PdfPen(PdfBrushes.Black, .5f), new PointF(0, y), new PointF(pageWidth, y));
            y += 5;

            //FINE PRINT
            page.Canvas.DrawString("Quote is good for: " + quote.QuoteLength + " days", helv8, black, 0, y);
            page.Canvas.DrawString("F.O.B. College Station, TX", helv8, black, pageWidth / 2, y, centered);
            page.Canvas.DrawString("Payment Terms: " + quote.PaymentTerms, helv8, black, pageWidth, y, rightAlign);
                size = helv8.MeasureString("THESE WORDS DON'T MATTER");
                y += size.Height + 1;

            page.Canvas.DrawString("This is not an invoice and may not include freight and/or sales tax. An invoice will be sent upon receipt of the signed quote.", helv9Ital, black, pageWidth/2, y, centered);
                size = helv9Ital.MeasureString("ONLY DEVS WILL SEE THIS");
                y += size.Height + 10;

            page.Canvas.DrawString("Please sign to accept this quotation: ", helv8, black, 0, y);
                size = helv8.MeasureString("I CAN SAY WHATEVER I WANT");
                page.Canvas.DrawLine(new PdfPen(PdfBrushes.Black, .5f), new PointF(150, y+size.Height), new PointF(350, y+size.Height));
                y += size.Height + 1;

            page.Canvas.DrawString("By signing I agree that I have read, understand and agree to be bound by the Texas Digital Standard Terms and Conditions Applicable to", helv8, black, 0, y);
                size = helv8.MeasureString("PAY UP GUY");
                y += size.Height + 1;

            page.Canvas.DrawString("Quotes and Purchase Orders accessible at: ", helv8, black, 0, y);
                size = helv8.MeasureString("Quotes and Purchase Orders accessible at: ");
                page.Canvas.DrawString("http://www.ncr.com/wp-content/uploads/TXDigital_Terms_and_Conditions.pdf", helv8, PdfBrushes.DarkGreen, size.Width, y);
                y += size.Height + 1;

            page.Canvas.DrawString("After signing please fax to (979) 764-8650", helv8, black, 0, y);
            page.Canvas.DrawString("Delivery ARO: 45-60 days", helv8, black, pageWidth, y, rightAlign);
                size = helv8.MeasureString("THIS ISNT THE END LOL");
                y += size.Height + 1;

            //pdf.SaveToFile(filename);
            pdf.SaveToHttpResponse(filename, Response, HttpReadType.Save);
            pdf.Close();
            System.Diagnostics.Process.Start(filename);
        }
开发者ID:jocrawork,项目名称:QuoteForm,代码行数:101,代码来源:Default.aspx.cs


注:本文中的PdfDocument.SaveToHttpResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。