Git Product home page Git Product logo

pdfdoc's Introduction

PDFDoc

"PDFDoc" PDF class (Classic ASP)

Include the class at the beginning of your code:

<!-- #include virtual="/PDFDoc.class.asp" -->

Initialise PDF document class:

Dim PDF
Set PDF = New PDFDoc

Set page size:

PDF.Format = "A4"

(Available sizes: A5, A4, A3, A2, LETTER, LEGAL.)

Set page orientation:

PDF.Orientation = "PORTRAIT"

(Available orientations: PORTRAIT, LANDSCAPE.)

Create document:

PDF.Open
PDF.Title = "Page title"
PDF.Creator = "Website or company name"
PDF.Author = "Name"

Set font, font size and colour:

PDF.SetFont "Arial","",8

Set draw colour (RGB):

PDF.SetDrawColour 150,150,150

Get page dimensions:

Dim x, y
x = PDF.Page.Width
y = PDF.Page.Height

Get width of a string of text:

Dim text, width
text = "Hello, world!"
width = PDF.Font.GetWidth(text)

Write text centered on page:

PDF.Text (PDF.Page.Width / 2) โ€“ (width / 2), PDF.Page.Height / 2, text

Example of drawing graphics:

Dim x1,y1,x2,y2
x1 = 10
y1 = 10
x2 = 50
y2 = 50
PDF.SetLineWidth(0.1)
PDF.Line x1, y1, x2, y2

Add a new page to document:

PDF.AddPage

Draw a barcode:

x = 50
y = 100
width = 50
text = "ABC12345"
Page.Code39 x, y, width, text

Close and publish the PDF document: (PDF will open in your browser to view.)

PDF.Close
PDF.Publish

Alternatively, an example of how to save the PDF to your server:

'// SAVE PDF'

dim FileWrite
FileWrite = Server.MapPath("/folder/Filename.pdf")

PDF.Output FileWrite

PDF.Close
set PDF = nothing

Other available functions within this class include:

PDF.Image file, x, y, width
PDF.StartTransform
PDF.Rotate angle, x, y
PDF.Skew angle, x, y
PDF.EndTransform
PDF.Box x, y, width, style
PDF.Line x, y, x2, y2
PDF.SetFont font, style, size
PDF.Bold true '// or false
PDF.SetFontSize n
PDF.SetTextColour r,g,b
PDF.SetDrawColour r,g,b
PDF.Orientation = "PORTRAIT" '// or LANDSCAPE
PDF.Format = "A4" '// or A3/A4/A5/LEGAL/LETTER/BARCODE
PDF.AddPage
PDF.Code39 x, y, width, text
n = PDF.Font.GetWidth(text)
PDF.Paragraph(text, width, line-height)
PDF.Centered = true '// or false

KNOWN ISSUE:
UTF8 PAGES CAUSE ISSUE WITH ISO-8897- IMAGE

pdfdoc's People

Contributors

onlinesimon avatar

Stargazers

 avatar  avatar Pieter Cooreman avatar

Watchers

 avatar

pdfdoc's Issues

Little bug

Hi Simon, the line in test.asp

PDF.SetFont = "Arial","",8

should be changed to:
PDF.SetFont "Arial","",8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.