Your company's Logo

    Home Contact us Download Site map About us

i-Logic Products
Utilities
PDFActiveX

PDFActiveX: An ActiveX component for drawing and saving Adobe PDF files. This can be used by any programming language that can use ActiveX controls. Commands consist of text and line drawing. Can load jpg and png images. 

The process consists of drawing the text at X and Y coordinates on the page, and then saving the page to a file.

Commands:

  • NewDoc - The start of a new PDF document. Returns Doc.
  • AddPage - Adds a new page to the document
  • InsertPage( Page) - Inserts and returns a new page before Page and returns the new Page.
  • SaveToFile( Filename) - Saves the created document to a file that can be opened in Adobe Acrobat.
  • GetFont( FontName, CodePage) - Gets one of the built-in PDF fonts for using in the document. Returns a font you would need to use as the font parameter in AddTextArea. Use the string of the name of one of the font constants below. CodePage is string constant of one of the available code pages listed below. Can be empty string for default.
  • GetTextHeight( Font) - Returns the line height for this Font.
  • SetYOrigin( Value) - Value = 1 means the Y coordinate is 0 at the top of the page and increases as you go down. Value = 0 means Y coordinate 0 is at the bottom of the page and increases as you go up. Default value=1. The left side of the page is always X0.
  • GetCurrentTextX( Page) - Returns the X point of the end of the last text that was drawn on the page.
  • GetCurrentTextY( Page) - Returns the Y point of the end of the last text that was drawn on the page.
  • GetCurrentX( Page) - Returns the X point of the last graphic drawing position.
  • GetCurrentY( Page) - Returns the Y point of the last graphic drawing position.
  • SaveToBuff - Returns the data for the PDF file. This can be used to send the data out from an ASP web page and display it in the browser.
  • FreeDoc - Call this after all done with creating PDF file.
  • SetPassword( OwnerPassword, UserPassword) - You can set the PDF file to use passwords. If the password is set, contents in the document are encrypted.
  • SetPermission( Integer) - Sets the permissions for the document. If you don't use this function, the document is by default set to the highest permission.
    1 user can read the document.
    2 user can print the document.
    3 user can edit the contents of the document other than annotations, form fields.
    4 user can copy the text and the graphics of the document.
    5 user can add or modify the annotations and form fields of the document.

     

  • SetPageSize( Page, Size, Direction) - Sets the Page size and orientation. Integer value.
    Size Description Dimensions
    1 LETTER 8½ x 11 (Inches)
    2 LEGAL 8½ x 14 (Inches)
    3 A3 297 × 420 (mm)
    4 A4 210 × 297 (mm)
    5 A5 148 × 210 (mm)
    6 B4 250 × 353 (mm)
    7 B5 176 × 250 (mm)
    8 EXECUTIVE 7½ x 10½ (Inches)
    9 US4x6 4 x 6 (Inches)
    10 US4x8 4 x 8 (Inches)
    11 US5x7 5 x 7 (Inches)
    12 COMM10 4.125 x 9.5 (Inches)
    Direction Type Description
    1 PORTRAIT Set the longer value to horizontal.
    2 LANDSCAPE Set the longer value to vertical.
     
  • GetPageByIndex( Index) - In a multi-page document this returns the Page variable for this particular page.

Font Functions:

  • GetFont( FontName, CodePage) - Loads a built-in PDF font. FontName is one of the font name string constants listed below (not a filename). CodePage is one of the code page string constants for language encoding.

    Built-in PDF Font Names:

    • Courier
    • Courier-Bold
    • Courier-Oblique
    • Courier-BoldOblique
    • Helvetica
    • Helvetica-Bold
    • Helvetica-Oblique
    • Helvetica-BoldOblique
    • Times-Roman
    • Times-Bold
    • Times-Italic
    • Times-BoldItalic
    • Symbol
    • ZapfDingbats
       
  • SetFontAndSize( Page, Font, Size) - Sets the current font to use. You don't need to call this unless you are switching between fonts for AddText.
  • LoadTrueTypeFont( Filename, CodePage, Embed) - Filename is the filename of the font file, like "C:\Windows\fonts\arial.ttf". CodePage is one of the CodePage string constants or empty string. Embed is 0 or 1. If Embed is 1 the needed characters from the font will be embedded into the PDF file so the end viewer will not need them installed on their machine. If Embed is 0 then the end viewer will need those fonts installed on their machine to see the text.
  • LoadFromTTC( Filename, CodePage, Index, Embed) - Same as LoadTrueTypeFont except gets the font from a font collection file. These are font files that have the ".ttc" extension. Index is the index of the font, starting with 0.
  • SetDocAttr( Attribute, Value) - Sets the document attribute to value. Available attributes to set are:
    • 0: CREATION_DATE,
    • 1: MOD_DATE,
    • 2: AUTHOR,
    • 3: CREATOR,
    • 4: PRODUCER,
    • 5: TITLE,
    • 6: SUBJECT,
    • 7: KEYWORDS,
    • 8: EOF

     

Text Output Functions:

  • CalcTextHeight( Page, Text, Left, Top, Width, Align, Font, Size, Length)  - Same as AddTextArea (without the height param) but doesn't draw anything. Returns the height of the text area that it would draw. A necessary function for finding out if a text area is going to be too big and run off the end of the page, so you can start a new page instead.
  • AddTextArea( Page, Text, Left, Top, Width, Height, Align, Font, Size, Length) - Draws text within a rectangular area. The text is word wrapped to fit into the area, and is clipped where it doesn't fit. For single paragraph. If you have string of text that is broken up with line feeds, use AddHTMLArea instead.

    Alignments:

    •  Align_Left=0
    • Align_Right=1
    • Align_center=2
    • Align_Justify=3
       
  • AddHTMLArea( Page, Text, Y, ) -
    Understands a few simple HTML codes. Like:
    <li>
    <align="center">
    <strong>
    <h1>,<h2>,<h3>
    <img height="285" width="343"  src="orgchart2.png" />

    No settings for width, just draws the set margins of the page. Useful if you have some text data that is formatted with HTML codes. Uses Helvetica font.
    Check should be 0. If Check=1 then will not draw, but only return the end Y position if it did draw.
  • AddText( Page, X, Y, Text) - Draws text at coordinates. It uses the current (last used) font.
  • SetCharSpace( Page, Value) - You can use this Value if you need to adjust the character spacing.

Graphics Functions:

  • AddLine( Page, X1, Y1, X2, Y2) - Draws a line between the two points.
  • AddRectangle( Page, X, Y, Width, Height) - Draws a rectangle on the page at the coordinates.
  • AddImage( Page, Filename, X, Y, Width, Height) - Places a JPG or PNG image file onto the page at X,Y. The image is stretched to fit the width and height parameters. If either width or height parameter is 0 then it checks the proportion of the image file and fills in the 0 parameter with proportional dimension. That way, if you know you want the image displayed 200 wide but you don't know how high because you don't know the height of the original image, it will calculate it for you.
  • LoadJPEG( Filename) - Loads a JPEG image file and returns an image value that can be used in DrawImage.
  • LoadPNG( Filename) - Loads a PNG image file and returns an image value that can be used in DrawImage.
  • DrawImage( Page, Image, X, Y, Width, Height) - Draws the Image parameter onto the page. Image is stretched to fit width and height.
  • GetImageWidth( Image) - Returns width of a loaded image.
  • GetImageHeight( Image) - Returns height of a loaded image.
  • AddCircle( Page,X,Y,R) - Draws a circle at X,Y and radius with current color.
  • SetLineColor( Page,Color) - Sets current line color to integer.
  • SetFillColor( Page,Color) - Sets current fill color to integer. Also for color of text.
  • AddFilledCircle( Page,X,Y,R) - Draws a circle at X,Y and radius. Draws with current line color and current fill color.
  • AddEllipse( Page,X,Y,XR, YR) - Draws an ellipse circle at X,Y and radius. Draws with current line color.
  • SetDash( Page, Pattern) - Pattern is one of the integer constants that represents a dash dot pattern. Choices are: 0-4. 0 is a solid line.
  • AddArc( Page,X,Y,R, Angle1, Angle2) - Draws an arc at X,Y and radius and angles. Draws with current line color.

 

Language Functions: See Language Page

Properties:

  • TextLeading( Page) - Set or Get the current line spacing distance.
  • LeftMargin - Get or Set the width of the left margin. This amount is always added onto any drawing you do on the page.
  • TopMargin - Get or Set the width of the top margin. This moves Y0 down or up.
  • PageWidth( Page) - Set or Get the width of page. (the piece of paper shown in adobe reader)
  • PageHeight( Page) - Set or Get the height of page.
  • LineWidth( Page) - Set or Get the current drawing line width.
  • TextVerticalShift( Page, Value) - ?.
  • RightMargin - Set or Get the right margin value.
  • FilePath( String) - Only used in AddHTMLArea to add on to the front of src="/filename".
  •  Page, Font: integer


 

 

Use in ASP web pages.

 Install PDFActiveX component on web server machine. This is how you would use PDFActiveX in Active Server Pages.

<%
Option Explicit

const Align_Left=0

dim ax,page
dim Font_Helvetica
dim buffer,x1,y1

'Create Document object and set properties
Set ax = Server.CreateObject("PDFActiveX.PDFActiveXLib")
ax.newdoc
Page = ax.AddPage

' Get a font we can use
Font_Helvetica=ax.getfont("Helvetica","")

' draw a line
ax.AddLine page,100,100,200,200
' draw a rectangle
ax.addrectangle page,100,100,50,50
' add a bitmap file image
ax.AddImage Page,server.mappath("peerprsr.jpg"), 200,50, 300, 200

' add text
ax.AddTextArea Page,"Donec adipiscing. Fusce sed arcu nec diam viverra faucibus. Suspendisse eget ligula id nisl commodo fermentum. Vivamus vel magna eget arcu venenatis posuere.",200, 250,100, 500,Align_Left, Font_Helvetica, 10, 0

' get the last place that the text was drawn
x1=ax.getcurrenttextx(page)
y1=ax.getcurrenttexty(page)
' add a rectangle at that point
ax.addrectangle page,x1,y1,20,20

'Output the Document to the Browser
Response.ContentType = "application/pdf"
buffer=ax.savetobuff
Response.BinaryWrite buffer

ax.freedoc
set ax=nothing

%>

 


Download installation of PDFActiveX here:

Fully functional, no limitations. Freeware.

ver. 0.7.0  (1.8mb)
 

Setup files and DLL have been digitally signed by i-Logic Software


Example Delphi project files here.


This software includes Haru Free PDF Library 2.0.0  Copyright (c) 1999-2006 Takeshi Kanno

Back Next

Language PDFActiveX functions

 

      
      
 

Copyright ©2011 i-Logic Software. email: support@i-logic.com
Last Modified 08/23/2007