Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > C# (.NET) > ASP.NET PDF > (C#) ASP.NET Pdf Insert Image



Clound SSD Virtual Server

(C#) ASP.NET Pdf Insert Image

(C#) ASP.NET Pdf Insert Image ตัวอย่างการเขียน ASP.NET สร้างเอกสาร PDF ทำการแทรกรูปภาพ (Insert Images) ลงในเอกสาร PDF

Language Code : VB.NET || C#

ASP.NET Add Reference

Framework : 1,2,3,4

Instance NameSpace

VB.NET
Imports PdfSharp

C#
Using PdfSharp;



AspNetPDFInsertImages.aspx

<%@ Import Namespace="PdfSharp"%>
<%@ Import Namespace="PdfSharp.Drawing"%>
<%@ Import Namespace="PdfSharp.Pdf"%>
<%@ Import Namespace="PdfSharp.Pdf.IO"%>

<%@ Page Language="C#" Debug="true" %>
<script runat="server">
    void Page_Load(Object sender, EventArgs e)				
	{				
		// Create a new PDF document
		PdfDocument DocPDF = new PdfDocument();

		// Create an empty page
		PdfPage objPage = DocPDF.AddPage();

		// Get an XGraphics object for drawing
		XGraphics gfx = XGraphics.FromPdfPage(objPage);

        // Create a font
        XFont font1 = new XFont("Verdana", 20, XFontStyle.Bold);
        XFont font2 = new XFont("Tahoma", 8, XFontStyle.Bold);

        // Draw the text
        gfx.DrawString(" Welcome To www.ThaiCreate.Com", font1, XBrushes.Black, 
        new XRect(0, 50, objPage.Width.Point, objPage.Height.Point), XStringFormats.TopCenter);
		
        String strString = "STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING";
        // Draw the text
        gfx.DrawString(strString, font2, XBrushes.Black, 65, 80, XStringFormats.TopLeft);
        // Draw the text
        gfx.DrawString(strString, font2, XBrushes.Black, 65, 90, XStringFormats.TopLeft);
        // Draw the text
        gfx.DrawString(strString, font2, XBrushes.Black, 65, 100, XStringFormats.TopLeft);
        // Draw the text
        gfx.DrawString(strString, font2, XBrushes.Black, 65, 110, XStringFormats.TopLeft);
        // Draw the text
        gfx.DrawString(strString, font2, XBrushes.Black, 65, 120, XStringFormats.TopLeft);
        // Draw the text
        gfx.DrawString(strString, font2, XBrushes.Black, 65, 130, XStringFormats.TopLeft);
        // Draw the text
        gfx.DrawString(strString, font2, XBrushes.Black, 65, 140, XStringFormats.TopLeft);
		
		gfx.DrawImage(XImage.FromFile(Server.MapPath("thaicreate.png")),260 , 160);

		int i;
		for(i = 250;i <= 500; i++)
		{
			gfx.DrawString(strString, font2, XBrushes.Black, 65, i + 10, XStringFormats.TopLeft);
			i = i + 10;
		}


		// Save the document...
		String FileName = "MyPDF/PdfDoc.pdf";
		DocPDF.Save(Server.MapPath(FileName));

		DocPDF.Close();
		DocPDF = null;

		this.lblText.Text = "PDF Created <a href=" + FileName + ">click here</a> to view";

	}

</script>
<html>
<head>
    <title>ThaiCreate.Com ASP.NET - Send Mail</title>
</head>
<body>
	<form id="form1" runat="server">
		<asp:Label id="lblText" runat="server"></asp:Label>
	</form>
</body>
</html>


Screenshot

ASP.NET Pdf






   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2008-12-17 22:28:24 / 2009-06-03 07:34:34
  Download : Download  (C#) ASP.NET Pdf Insert Image
 Sponsored Links / Related

 
(C#) ASP.NET & Pdf
Rating :

 
(C#) ASP.NET Pdf Write Rows
Rating :

 
(C#) ASP.NET Pdf Insert Image
Rating :

 
(C#) ASP.NET Pdf Multiple Page
Rating :

 
(C#) ASP.NET Export/Report Database to Pdf
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่