PDF internal programming objects can be accessed for direct calls to the methods of the API interface

pdf  = Adam('PDF  Return as=Object_PDF');
html = Adam('html Return as=Object_HTML');

html.parse(data); load html document
html.loadFromUrl(url) load html document from url
html.loadFromFile(filename) load html document from file
   
html.resize(width,height); size html document to given dimensions
html.writeToPdf(pdf);    write paganated html to pdf
html.writeToPdfFit(pdf);    expand a PDF page to the extents of the html document
html.writeToCanvas(canvas) output HTML document as an Image to an HTML5 Canvas
   
width = html.width(); document width (pixels)
height = html.height(); document height (pixels)
   
html.convertImageCommand = 'http://yoursite/cgi-bin/CollinsImage.cgi?input={href}&format=.jpg';
html.imagePath = "./Images/";

Saving the PDF File

contents = pdf.toString();
contents = pdf.toHex64();
window.location.href = pdf.toUrlData()  // hex64 encoded (CHROME)

pdf.writeToFile(filename)
pdf.sendToClient()
pdf.sendToServer(filename)
pdf.downloadToClient(filename)

Setting Margins and Page Size

pdf.setMargins(left,right,top,bottom)
pdf.setLandscape(landscape) true = lanscape, false = portrait
pdf.setPageSize(name)  name = "letter", "legal", "ledger", "executive", "A", "B", "C", "D", "E" or size in inches "width,height"

Font and Graphic Characteristics

pdf.setFont([color] [,size] [,bold] [,italic] [,underline] [,name] [,subscript] [,superscript] )
pdf.setFontRender(name)
pdf.setFontSkew(angle)
pdf.setFontScale(xscale,yscale)
pdf.setLetterSpacing(points)
pdf.setWordSpacing(points)

pdf.setGraphic([lineColor] [,lineWeight] [,fillColor])
pdf.setGraphicColor(color)
pdf.setGraphicLineWeight(weight)
pdf.setGraphicFillColor(color)
pdf.setGraphicGrayscale(value)  0.0 to 1.0
pdf.setGraphicLineStyle(style)  "solid", "dot", "dash", or a pdf pattern "[1,2] 3"

Lines and Page Breaks

pdf.lineBreak()
pdf.pageBreak()

Adding Text

pdf.addText(text [,url])
pdf.leftText(text [,url])
pdf.centerText(text [,url])
pdf.rightText(text [,url])
pdf.placeText(x,y,text [,url])
pdf.placeTextBox(x,y,height,width,text,just,vjust,shape,dropx,dropy)
pdf.addTextBox(height,width,text,just,vjust,shape,dropx,dropy)

Adding Graphic

pdf.drawLine(x1,y1,x2,y2)
pdf.drawLinestring(points)
pdf.drawRectangle(x1,y1,x2,y2)
pdf.drawArc(cx,cy,radius,start,sweep)
pdf.drawCone(cx,cy,radius,start,sweep)
pdf.drawPie(cx,cy,radius,start,slices)
pdf.drawNumberline(g)
pdf.drawCircle(cx,cy,radius)
pdf.drawMarker(x,y,name,size)
pdf.drawSymbol(x,y,char,angle)
pdf.drawGrid(x1,y1,x2,y2,rows,cols,absolute)

pdf.addGraphic(data,height,width,angle,lineColor,lineWeight,bgColor,grayscale,clip,range)

Adding Images (jpeg and u3d)

pdf.addImage(filename [,height] [,width] [,angle])
pdf.placeImage(x,y,filename [,height] [,width] [,angle])

pdf.hexEncodeImages = true  | false

Image file extensions: (use the supplied ImageConvert.exe utility)

  • .jpg  binary jpeg file
  • .jpgx  HEX encoded jpeg file 
  • .jpg8 ASCII 85 encoded jpeg file
  • .u3d binary 3D image
  • .u3dx hex encoded 3D image
  • .u3d8 ASCII 85 encoded 3D image

Encoded file's filename format::  any-name_WnnnHnnnSnnn.jpgx or .jpg8

  • Wnnn = File's Image Width in Pixels
  • Hnnn = File's Image Height in Pixels
  • Snnn = Encoded File Size in Bytes

example:

  • North_Arrow.jpg (size 234 bytes)
  • North_Arrow_w32h64s323.jpg8
  • North_Arrow_w32h64s469.jpgx

Bookmarks

          pdf.addOutline(parent,title,ypos)

Report Generation

pdf.reportCreateGroup(headerLines,footerLines,onGroupHeader,onGroupFooter,onBeforePagebreak,onAfterPagebreak,
                                    keepTogether,skipIfBlank,pagebreakBefore,pageBreakAfter)

pdf.reportAddHeader(values-list [,url-list])
pdf.reportAddDetail(values-list [,group-key-list] [,url-list])
pdf.reportAddText(tabbed-text)
pdf.reportColumns(columns-spec [,left-margin-inches] [,border-width-pixels])

columns-spec: "column1,column2,...columnn"

column: alignment size overflow
    alignment: L = left (default), C = center, R = right
    size: width of column in inches
    overflow: T = truncate (default), W = wrap, D = Truncate with dots...

example: pdf.reportColumns("3W,2",1);
1 inch left margin 2 columns, first 3 inch column wraps text, second 2 inch column truncates text

Using Report Columns to return lines to determine if a page-break will occur, (i.e. lines.length = max number of lines in the report detail)

lines = pdf.reportSplit(text)

 PDF Form Components

field = pdf.addFormButton(caption,onclick,height,width)
field = pdf.addFormImage(caption,src,height,width)
field = pdf.addFormRadio(name,group,caption,checked,onclick)
field = pdf.addFormCheckbox(name,caption,checked,onclick)
field = pdf.addFormSubmit(caption,url,height,width)
field = pdf.addFormReset(caption,height,width)
field = pdf.addFormText(name,value,onchange,height,width)
field = pdf.addFormPassword(name,value,onchange,height,width)
field = pdf.addFormFile(name,value,onchange,height,width)
field = pdf.addFormSelect(name,options,selected,onchange,height,width)
field = pdf.addFormListbox(name,options,selected,onchange,height,width)

field = pdf.placeFormButton(x,y,caption,onclick,height,width)
field = pdf.placeFormImage(x,y,caption,src,height,width)
field = pdf.placeFormRadio(x,y,name,group,caption,checked,onclick)
field = pdf.placeFormCheckbox(x,y,name,caption,checked,onclick)
field = pdf.placeFormSubmit(x,y,caption,url,height,width)
field = pdf.placeFormReset(x,y,caption,height,width)
field = pdf.placeFormText(x,y,name,value,onchange,height,width)
field = pdf.placeFormPassword(x,y,name,value,onchange,height,width)
field = pdf.placeFormFile(x,y,name,value,onchange,height,width)
field = pdf.placeFormSelect(x,y,name,options,selected,onchange,height,width)
field = pdf.placeFormListbox(x,y,name,options,selected,onchange,height,width)

field = pdf.addFormHidden(name,value)

field.readonly  = false
field.required  = false
field.noExport = false

field.onKeyDown = "script..."
field.onKeyUp = "script..."
field.onEnter = "script..."
field.onExit = "script..."
field.onMouseUp = "script..."
field.onMouseDown = "script..."
field.onFocus = "script..."
field.onBlur = "script..."

PDF Events to execute JavaScript

pdf.onPageOpen(javascript)
pdf.onPageClose(javascript)

pdf.onDocumentOpen(javascript)

pdf.onWillClose(javascript)
pdf.onWillSave(javascript)
pdf.onDidSave(javascript)
pdf.onWillPrint(javascript)
pdf.onDidPrint(javascript)