Tuesday 10 September 2013

PDF creator in ASP

Create PDF in ASP
---------------------------------------------------------------------------------------------------------------
Starting with the classic example:

<!--#include file="fpdf.asp"-->
<%
Set pdf=CreateJsObject("FPDF")
pdf.CreatePDF
pdf.SetPath("fpdf/")
pdf.SetFont "Arial","B",16
pdf.Open()
pdf.AddPage()
pdf.Cell 40,10,"Hello, world!"
pdf.Close()
pdf.Output
%>
pdf.Output server.mappath("folder-pdf/"&pdfid&".pdf"),"T"

Adding an image:

pdf.Image "logo.jpg",10,10,40


Setting the font, text color and a link:

pdf.SetFont "Times","U",18
pdf.SetTextColor 65,105,225
pdf.Write 9,"This is a link","http://www.google.com"


Setting the title, author, subject, keywords and creator:

pdf.SetTitle "The title"
pdf.SetAuthor "The name of the author"
pdf.SetSubject "The subject"
pdf.SetKeywords "The list of keywords"
pdf.SetCreator "The name of the creator"


Another Examples:

pdf.Ln(5)
pdf.SetFillColor 230,230,230
pdf.SetFont "Arial","",8
pdf.Cell 130,4, "Sql Injection Truths:", 0, 0, "L", 1
pdf.SetTextColor 255,255,255
pdf.MultiCell 190,3,"1. Scope of our agreement: These are the conditions of the contract between you, the client.", 0,"L", 1
pdf.SetXY 50,272

Source:

https://sites.google.com/site/aspfpdf/downloads

http://fpdf.org/