国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Spire.PDF for .NET【文檔操作】演示:動態(tài)創(chuàng)建 PDF 并將其發(fā)送到客戶端瀏覽器

這篇具有很好參考價值的文章主要介紹了Spire.PDF for .NET【文檔操作】演示:動態(tài)創(chuàng)建 PDF 并將其發(fā)送到客戶端瀏覽器。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

可移植文檔格式 (PDF) 是 Adobe 制定的獨立規(guī)范的固定版式文檔。它封裝了完整的描述,包括文本字體、圖形和顯示它所需的其他信息。

Spire.PDF for .NET?是一款獨立 PDF 控件,用于 .NET 程序中創(chuàng)建、編輯和操作 PDF 文檔。使用 Spire.PDF 類庫,開發(fā)人員可以新建一個 PDF 文檔或者對現(xiàn)有的 PDF 文檔進(jìn)行處理,且無需安裝 Adobe Acrobat。

E-iceblue?功能類庫Spire 系列文檔處理組件均由中國本土團(tuán)隊研發(fā),不依賴第三方軟件,不受其他國家的技術(shù)或法律法規(guī)限制,同時適配國產(chǎn)操作系統(tǒng)如中科方德、中標(biāo)麒麟等,兼容國產(chǎn)文檔處理軟件 WPS(如 .wps/.et/.dps 等格式

Spire.PDF for.net下載? ?Spire.PDF for java下載

動態(tài)創(chuàng)建PDF并將其發(fā)送到客戶端瀏覽器

要動態(tài)生成 PDF 文件然后將其發(fā)送到客戶端瀏覽器,您可以使用Spire.PDF for .NET來完成此任務(wù)。此外,Spire.PDF還支持加載現(xiàn)有的PDF文件并將其發(fā)送到客戶端瀏覽器。在這篇技術(shù)文章中,我們將結(jié)合這兩個功能來完整描述 Spire.PDF 的工作原理。下面是兩個任務(wù):

  • 任務(wù)1 動態(tài)創(chuàng)建PDF并將其發(fā)送到客戶端瀏覽器。
  • 任務(wù)2 加載現(xiàn)有的PDF文件并將其發(fā)送到客戶端瀏覽器(這是Spire.PDF for .NET的附加功能)

首先創(chuàng)建一個Asp.net應(yīng)用程序并添加Spire.PDF.dll程序集。您可以在VS中的Aspx頁面上添加兩個按鈕。指定其中一名負(fù)責(zé)任務(wù) 1,另一名負(fù)責(zé)任務(wù) 2。

spire.pdf for .net百度云,Spire.PDF for .Net 教程,pdf,.net,python,spire.pdf,pdf開發(fā)

對于任務(wù)1,首先需要啟動一個Spire.PdfDocument對象

[C#]

PdfDocument doc = new PdfDocument();

并在這個新的 PDF 文檔中添加一個新頁面

[C#]

PdfPageBase page = newDoc.Pages.Add();

注意在該pdf頁面上繪制字符串時需要相關(guān)的輔助對象。

[C#]

string message = "Hello world!";
PdfFont font = new PdfFont(PdfFontFamily.Helvetica, 13f);
PdfBrush brush = PdfBrushes.Red;
PointF location = new PointF(20, 20);

然后你可以在pdf頁面中繪制一個字符串,如下所示:

[C#]

page.Canvas.DrawString(message, font, brush, location);

最后您可以在客戶端瀏覽器中打開這個新生成的PDF文檔:

[C#]

newDoc.SaveToHttpResponse("sample.pdf",HttpContext.Current.Response, HttpReadType.Open);

對于任務(wù)2,3行代碼就可以直接解決。

啟動 Spire.PdfDocument 對象

[C#]

pdfDocument doc = new PdfDocument();

加載 pdf 文件

[C#]

doc.LoadFromFile(this.Server.MapPath("/sample.pdf"));

加載pdf文檔,然后將其作為附件發(fā)送到客戶端瀏覽器。

[C#]

doc.SaveToHttpResponse("sample.pdf", this.Response, HttpReadType.Save);

綜上所述,以下是這兩個任務(wù)所需的完整代碼片段:

[C#]

using System;

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Spire.Pdf;
using Spire.Pdf.Graphics;

namespace SendPdfToWebBrowser
{
public partial class WebForm_SendPdf : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
// load a pdf document ,after that ,send it to client browser as an attachment
protected void btnClientSavePdf_Click(object sender,EventArgs e)
{

// initiated an object of Spire.PdfDocument
PdfDocument doc = new PdfDocument();
// Load a pdf file

doc.LoadFromFile(this.Server.MapPath("/sample.pdf"));
// send the pdf document to client browser as an attachment
doc.SaveToHttpResponse("sample.pdf",this.Response, HttpReadType.Save);
}

// Create an pdf document ,then open it in the client browser
protected void btnClientOpenPdf_Click(object sender, EventArgs e)
{
// Initiate an object of Spire.PdfDocument
PdfDocument newDoc = new PdfDocument();
// Add a new page in this newly created pdf file
PdfPageBase page = newDoc.Pages.Add();
string message = "Hello world!” ;

PdfFont font = new PdfFont(PdfFontFamily.Helvetica,13f);
PdfBrush brush = PdfBrushes.Red;
PointF location = new PointF(20, 20);
// Draw a string with designated brush, a font, position in pdf page
page.Canvas.DrawString(message, font, brush, location);
//To open this pdf document in client browser.
newDoc.SaveToHttpResponse("sample.pdf",HttpContext.Current.Response, HttpReadType.Open);
}
}
}

最后,你可以運行它,并得到如下結(jié)果:

spire.pdf for .net百度云,Spire.PDF for .Net 教程,pdf,.net,python,spire.pdf,pdf開發(fā)

動態(tài)創(chuàng)建 PDF 并將其發(fā)送到客戶端瀏覽器的屏幕截圖

spire.pdf for .net百度云,Spire.PDF for .Net 教程,pdf,.net,python,spire.pdf,pdf開發(fā)

加載現(xiàn)有 PDF 文件并將其發(fā)送到客戶端瀏覽器的屏幕截圖

spire.pdf for .net百度云,Spire.PDF for .Net 教程,pdf,.net,python,spire.pdf,pdf開發(fā)

以上便是如何態(tài)創(chuàng)建 PDF 并將其發(fā)送到客戶端瀏覽器,如果您有其他問題也可以繼續(xù)瀏覽本系列文章,獲取相關(guān)教程~文章來源地址http://www.zghlxwxcb.cn/news/detail-858047.html

到了這里,關(guān)于Spire.PDF for .NET【文檔操作】演示:動態(tài)創(chuàng)建 PDF 并將其發(fā)送到客戶端瀏覽器的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • PDF控件Spire.PDF for .NET【安全】演示:在 PDF 中添加或刪除數(shù)字簽名

    PDF控件Spire.PDF for .NET【安全】演示:在 PDF 中添加或刪除數(shù)字簽名

    隨著 PDF 文檔在商業(yè)中越來越流行,確保其真實性已成為一個關(guān)鍵問題。使用基于證書的簽名對 PDF 進(jìn)行簽名可以保護(hù)內(nèi)容,還可以讓其他人知道誰簽署或批準(zhǔn)了該文檔。在本文中,您將了解如何使用不可見或可見簽名對 PDF 進(jìn)行數(shù)字簽名,以及如何使用Spire.PDF for .NET從 PDF 中

    2024年02月03日
    瀏覽(23)
  • PDF控件Spire.PDF for .NET【安全】演示:使用文本或/和圖像對 PDF 進(jìn)行數(shù)字簽名

    PDF控件Spire.PDF for .NET【安全】演示:使用文本或/和圖像對 PDF 進(jìn)行數(shù)字簽名

    數(shù)字簽名確保簽名的文檔不能被除其作者之外的任何人更改。添加簽名是確保文檔內(nèi)容真實性的最常見方法。PDF 文檔中的可視數(shù)字簽名可以顯示文本或圖像(例如手寫簽名)。本文從以下三個方面介紹如何使用Spire.PDF for .NET對PDF 進(jìn)行數(shù)字簽名。 Spire.PDF for .NET?是一款獨立

    2024年01月23日
    瀏覽(21)
  • PDF控件Spire.PDF for .NET【安全】演示:使用時間戳服務(wù)器對 PDF 進(jìn)行數(shù)字簽名

    PDF控件Spire.PDF for .NET【安全】演示:使用時間戳服務(wù)器對 PDF 進(jìn)行數(shù)字簽名

    Spire.PDF for .NET?是一款獨立 PDF 控件,用于 .NET 程序中創(chuàng)建、編輯和操作 PDF 文檔。使用 Spire.PDF 類庫,開發(fā)人員可以新建一個 PDF 文檔或者對現(xiàn)有的 PDF 文檔進(jìn)行處理,且無需安裝 Adobe Acrobat。 E-iceblue?功能類庫Spire 系列文檔處理組件均由中國本土團(tuán)隊研發(fā),不依賴第三方軟件

    2024年04月10日
    瀏覽(24)
  • Spire.PDF for .NET 9.8.5 Crack

    Spire.PDF for .NET 9.8.5 Crack

    Spire.PDF for .NET is a professional PDF API applied to creating, writing, editing, handling and reading PDF files without any external dependencies within .NET ( C#, VB.NET, ASP.NET, .NET Core, .NET 5.0, .NET 6.0, .NET 7.0, MonoAndroid and Xamarin.iOS ) application. Using this .NET PDF library, you can implement rich capabilities to create PDF files from sc

    2024年02月10日
    瀏覽(70)
  • Spire.Barcode for Java 5.1.0 + Spire.Barcode for .NET 7.2.0

    Spire.Barcode for Java 5.1.0 + Spire.Barcode for .NET 7.2.0

    Spire.Barcode for Java is a professional barcode component specially designed for developers to generate, read and scan 1D 2D barcodes on Java applications (J2SE and J2EE). Developers and programmers can use Spire.Barcode to add Enterprise-Level barcode formats to their Java applications quickly and easily. Spire.Barcode for Java provides a very easy way to

    2024年02月16日
    瀏覽(47)
  • 【itext7】itext7操作PDF文檔之創(chuàng)建PDF文檔、加載PDF文檔、添加空白頁、操作PDF頁面、itext中的常見類及其方法

    這篇文章,主要介紹itext7操作PDF文檔之創(chuàng)建PDF文檔、加載PDF文檔、添加空白頁、操作PDF頁面、itext中的常見類及其方法。 目錄 一、itext7操作PDF 1.1、itext7介紹 1.2、引入itext-core依賴 1.3、創(chuàng)建PDF文檔 1.4、加載PDF文檔 1.5、操作PDF頁面 1.6、添加空白頁面 二、itext常見類和方法 2.1、

    2024年02月16日
    瀏覽(20)
  • Spire.Office for.NET Crack

    Spire.Office for.NET Crack

    Spire.Office for.NET是E-iceblue提供的企業(yè)級Office.NET API的組合。它包括Spire.Doc、Spire.XLS、Spire.Seadsheet、Spire.Presentation、Spire_PDF、Spire.DataExport、SpireOfficeViewer、Spire-PDFViewer、Spire.DocViewer、Spire.Barcode和Spire.Email.Spire.Office包含上述.NET API的最新版本。 使用Spire.Officefor.NET,開發(fā)人員可以創(chuàng)

    2024年02月15日
    瀏覽(25)
  • 利用Spire.Pdf實現(xiàn)PDF添加印章的操作

    利用Spire.Pdf實現(xiàn)PDF添加印章的操作

    在一些文檔處理中,我們需要對PDF蓋上公司的印章操作,本篇隨筆介紹利用Spire.Pdf實現(xiàn)PDF添加印章的操作,如全章和騎縫章的處理。 有時候,需要在特定的位置蓋章,以及各個頁面蓋上騎縫章,如下界面效果所示。 全章的位置定位好后,繪制一個圖片即可,騎縫章則是根據(jù)

    2024年02月16日
    瀏覽(26)
  • Spire.Office for .NET 8.4.1 FIX

    Spire.Office for .NET 8.4.1 FIX

    Spire.Office for .NET is a combination of Enterprise-Level Office .NET API offered by E-iceblue. It includes Spire.Doc, Spire.XLS, Spire.Spreadsheet, Spire.Presentation, Spire.PDF, Spire.DataExport, Spire.OfficeViewer, Spire.PDFViewer, Spire.DocViewer, Spire.Barcode and Spire.Email. Spire.Office contains the most up-to-date versions of the above .NET API. ?

    2024年02月02日
    瀏覽(30)
  • Spire.Office 8.5.3 for .NET 哪里值得更新?

    Spire.Office 8.5.3 for .NET 哪里值得更新?

    Spire.Office for .NET is a combination of Enterprise-Level Office .NET API offered by E-iceblue. It includes Spire.Doc, Spire.XLS, Spire.Spreadsheet, Spire.Presentation, Spire.PDF, Spire.DataExport, Spire.OfficeViewer, Spire.PDFViewer, Spire.DocViewer, Spire.Barcode and Spire.Email. Spire.Office contains the most up-to-date versions of the above .NET API. Wi

    2024年02月06日
    瀏覽(21)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包