Version: 1.0
Category: PDF Editing and Generation
Library: pdf-lib

neoPDF2 is a powerful plugin for VisualNEO Web that enables creation, loading, editing, and rendering of PDF documents directly from your web applications.
Built on top of the robust open-source pdf-lib JavaScript library, it allows you to programmatically manipulate PDF files—whether generating new documents or editing existing ones—entirely within the browser, with no need for external software or online services.

With neoPDF2, you can add and style text, draw shapes, embed images, insert or delete pages, and even apply custom fonts. PDFs can be displayed in an IFrame, opened in a new browser tab, downloaded, or exported as Base64 for server-side storage or transmission.

This plugin is ideal for creating dynamic reports, invoices, certificates, filled-in templates, or any kind of document that needs to be generated or modified from user data in real time.

Key Features

  • Create new or edit existing PDF files directly in the browser.
  • Full control over pages, including add, move, insert, copy, and delete.
  • Add text, links, images, shapes, and vector drawings with RGB colors.
  • Embed custom fonts (TTF/OTF) and adjust text size, color, and alignment.
  • Read and modify metadata (title, author, subject, keywords).
  • Render PDFs in-app (IFrame/embed), in a new tab, or trigger downloads.
  • Export and import PDFs as Base64 DataURIs for easy integration.
  • Retrieve document properties and page count for dynamic workflows.

Typical Use Cases

  • Generating invoices, receipts, or reports directly from form data.
  • Creating certificates, tickets, or personalized documents.
  • Building PDF-based editors or document annotation tools.
  • Automating document assembly workflows within VisualNEO Web apps.
  • Embedding PDFs dynamically into dashboards or learning tools.

 

neoPdf2Init

Purpose:

Create a new empty PDF document (pdf-lib).

Category:

neoPDF2

Syntax:

neoPdf2Init "pdfName" callback

 

pdfName

PDF name (letters only, no spaces)

callback

Callback subroutine (optional)

 

neoPdf2LoadFromBase64

Purpose:

Load an existing PDF (Base64 string) into a pdf-lib document.

Category:

neoPDF2

Syntax:

neoPdf2LoadFromBase64 "base64String" "pdfName" callback

 

base64String

Base64 encoded PDF (may include DataURI header)

pdfName

PDF name for reference

callback

Callback subroutine (optional)

 

neoPdf2GetProperties

Purpose:

Get basic properties of the PDF document (page count, first page size, metadata) as a JSON string in a variable.

Category:

neoPDF2

Syntax:

neoPdf2GetProperties "pdfName" resVar

 

pdfName

PDF name

resVar

Variable to store the result (JSON string)

 

neoPdf2SetProperties

Purpose:

Set the PDF document metadata: title, subject, author, and keywords.

Category:

neoPDF2

Syntax:

neoPdf2SetProperties "pdfName" "pdfTitle" "pdfSubject" "pdfAuthor" "pdfKeywords"

 

pdfName

PDF name

pdfTitle

Document title

pdfSubject

Document subject

pdfAuthor

Document author

pdfKeywords

Document keywords (comma separated)

 

neoPdf2SimpleText

Purpose:

Adds text to the selected page using the current style settings.

Category:

neoPDF2

Syntax:

neoPdf2SimpleText "pdfName" "textString" posX posY textAlign

 

pdfName

PDF name

textString

Text to write

posX

X coordinate (in millimeters)

posY

Y coordinate (in millimeters)

textAlign

Text alignment

 

neoPdf2Text

Purpose:

Adds text to page with full options (alignment, rotation, wrapping, rendering mode).

Category:

neoPDF2

Syntax:

neoPdf2Text "pdfName" "textString" posX posY textAlign textAngle maxWidth renderingMode

 

pdfName

PDF name

textString

Text to write

posX

X coordinate (in millimeters)

posY

Y coordinate (in millimeters)

textAlign

Text align

textAngle

Angle in degrees (counterclockwise)

maxWidth

Max width in mm (0=no wrap)

renderingMode

Rendering mode

 

neoPdf2TextLink

Purpose:

Add a clickable text link to an external URL.

Category:

neoPDF2

Syntax:

neoPdf2TextLink "pdfName" "textString" posX posY "url"

 

pdfName

PDF name

textString

Text to write

posX

X coordinate (mm)

posY

Y coordinate (mm)

url

URL to link (e.g., https://google.com)

 

neoPdf2TextLinkToPage

Purpose:

Add a clickable text link to another page in the PDF.

Category:

neoPDF2

Syntax:

neoPdf2TextLinkToPage "pdfName" "textString" posX posY pageNumber

 

pdfName

PDF name

textString

Text to write

posX

X coordinate (mm)

posY

Y coordinate (mm)

pageNumber

Page number to link (1-based)

 

neoPdf2AddCustomFont

Purpose:

Embed a custom font (TTF/OTF as base64) in the PDF document and assign it a reference name for later use.

Category:

neoPDF2

Syntax:

neoPdf2AddCustomFont "pdfName" "fontVarName" fontBase64 callback

 

pdfName

PDF name

fontVarName

Reference name for the font

fontBase64

TTF or OTF font file as base64 string

callback

Callback subroutine (optional)

 

neoPdf2Render

Purpose:

Render the PDF document into the specified IFrame or embed object.

Category:

neoPDF2

Syntax:

neoPdf2Render "pdfName" "objId"

 

pdfName

PDF name

objId

IFrame or embed object ID to render the PDF

 

neoPdf2RenderInNewTab

Purpose:

Render the PDF document by opening it in a new browser tab.

Category:

neoPDF2

Syntax:

neoPdf2RenderInNewTab "pdfName"

 

pdfName

PDF name

 

neoPdf2SaveToBase64

Purpose:

Save the document as a Base64 DataURI and store it in a variable (async ~0.5s).

Category:

neoPDF2

Syntax:

neoPdf2SaveToBase64 "pdfName" resVar

 

pdfName

PDF name

resVar

Variable to store result

 

neoPdf2Download

Purpose:

Download the PDF document.

Category:

neoPDF2

Syntax:

neoPdf2Download "pdfName" "fileName"

 

pdfName

PDF name

fileName

File name without extension (optional)

 

neoPdf2Image

Purpose:

Add an image from an IMG element in the document.

Category:

neoPDF2

Syntax:

neoPdf2Image "pdfName" "imgObjId" imgFormat posX posY imgWidth imgHeight

 

pdfName

PDF name

imgObjId

Image object ID

imgFormat

Image format

posX

X coordinate (mm)

posY

Y coordinate (mm)

imgWidth

Image width (mm)

imgHeight

Image height (mm)

 

neoPdf2ImageBase64

Purpose:

Add an image from a Base64 encoded string.

Category:

neoPDF2

Syntax:

neoPdf2ImageBase64 "pdfName" base64Data imgFormat posX posY imgWidth imgHeight

 

pdfName

PDF name

base64Data

Base64 image data

imgFormat

Image format

posX

X coordinate (mm)

posY

Y coordinate (mm)

imgWidth

Image width (mm)

imgHeight

Image height (mm)

 

neoPdf2DrawColor

Purpose:

Set the stroke color for shapes (RGB).

Category:

neoPDF2

Syntax:

neoPdf2DrawColor "pdfName" r g b

 

pdfName

PDF name

r

Red (0-255)

g

Green (0-255)

b

Blue (0-255)

 

neoPdf2FillColor

Purpose:

Set the fill color for shapes (RGB).

Category:

neoPDF2

Syntax:

neoPdf2FillColor "pdfName" r g b

 

pdfName

PDF name

r

Red (0-255)

g

Green (0-255)

b

Blue (0-255)

 

neoPdf2LineWidth

Purpose:

Set the line width (in points) for shapes.

Category:

neoPDF2

Syntax:

neoPdf2LineWidth "pdfName" lineWidth

 

pdfName

PDF name

lineWidth

Line width (pt)

 

neoPdf2Line

Purpose:

Draw a line using the current stroke color and line width.

Category:

neoPDF2

Syntax:

neoPdf2Line "pdfName" x1 y1 x2 y2

 

pdfName

PDF name

x1

Start X (mm)

y1

Start Y (mm)

x2

End X (mm)

y2

End Y (mm)

 

neoPdf2Rect

Purpose:

Draw a rectangle with the current fill and/or stroke color.

Category:

neoPDF2

Syntax:

neoPdf2Rect "pdfName" x y width height style

 

pdfName

PDF name

x

Top-left X (mm)

y

Top-left Y (mm)

width

Width (mm)

height

Height (mm)

style

Rectangle style

 

neoPdf2Circle

Purpose:

Draw a circle with the current fill and/or stroke color.

Category:

neoPDF2

Syntax:

neoPdf2Circle "pdfName" x y radius style

 

pdfName

PDF name

x

Center X (mm)

y

Center Y (mm)

radius

Radius (mm)

style

Circle style

 

neoPdf2Ellipse

Purpose:

Draw an ellipse with the current fill and/or stroke color.

Category:

neoPDF2

Syntax:

neoPdf2Ellipse "pdfName" x y rx ry style

 

pdfName

PDF name

x

Center X (mm)

y

Center Y (mm)

rx

X radius (mm)

ry

Y radius (mm)

style

Ellipse style

 

neoPdf2Triangle

Purpose:

Draw a triangle with the current fill and/or stroke color.

Category:

neoPDF2

Syntax:

neoPdf2Triangle "pdfName" x1 y1 x2 y2 x3 y3 style

 

pdfName

PDF name

x1

First X (mm)

y1

First Y (mm)

x2

Second X (mm)

y2

Second Y (mm)

x3

Third X (mm)

y3

Third Y (mm)

style

Triangle style

 

neoPdf2Font

Purpose:

Set the font family (Helvetica, TimesRoman, Courier, etc.).

Category:

neoPDF2

Syntax:

neoPdf2Font "pdfName" fontName

 

pdfName

PDF name

fontName

Font family

 

neoPdf2FontStyle

Purpose:

Set the font style (Normal, Bold, Italic, BoldItalic).

Category:

neoPDF2

Syntax:

neoPdf2FontStyle "pdfName" fontStyle

 

pdfName

PDF name

fontStyle

Font style

 

neoPdf2FontSize

Purpose:

Set the font size (in points).

Category:

neoPDF2

Syntax:

neoPdf2FontSize "pdfName" fontSize

 

pdfName

PDF name

fontSize

Font size (pt)

 

neoPdf2TextColor

Purpose:

Set the text color (RGB).

Category:

neoPDF2

Syntax:

neoPdf2TextColor "pdfName" r g b

 

pdfName

PDF name

r

Red (0-255)

g

Green (0-255)

b

Blue (0-255)

 

neoPdf2SetPage

Purpose:

Select the current page for subsequent operations (1 = first page).

Category:

neoPDF2

Syntax:

neoPdf2SetPage "pdfName" pageNumber

 

pdfName

PDF name

pageNumber

Page number (1 = first)

 

neoPdf2AddPage

Purpose:

Add a new page to the PDF document. If orientation and paperSize are omitted, uses the last page size or A4 portrait.

Category:

neoPDF2

Syntax:

neoPdf2AddPage "pdfName" orientation paperSize

 

pdfName

PDF name

orientation

Orientation of the page (optional)

paperSize

Paper size (optional)

 

neoPdf2MovePage

Purpose:

Move a page to a new position within the document.

Category:

neoPDF2

Syntax:

neoPdf2MovePage "pdfName" fromPage toPage

 

pdfName

PDF name

fromPage

Page to move (1=first)

toPage

New position (1=first)

 

neoPdf2InsertPage

Purpose:

Insert a blank page before the specified page number.

Category:

neoPDF2

Syntax:

neoPdf2InsertPage "pdfName" pageNumber

 

pdfName

PDF name

pageNumber

Insert before this page (1=first)

 

neoPdf2DeletePage

Purpose:

Delete the specified page

Category:

neoPDF2

Syntax:

neoPdf2DeletePage "pdfName" pageNumber

 

pdfName

PDF name

pageNumber

Page to delete (1=first)

 

neoPdf2CopyPage

Purpose:

Duplicate the specified page and insert it at the end of the document.

Category:

neoPDF2

Syntax:

neoPdf2CopyPage "pdfName" pageNumber

 

pdfName

PDF name

pageNumber

Page to copy (1=first)

 

neoPdf2GetPageCount

Purpose:

Get the current number of pages in the PDF and store it in a variable.

Category:

neoPDF2

Syntax:

neoPdf2GetPageCount "pdfName" resVar

 

pdfName

PDF name

resVar

Variable to store the result

Created with the Personal Edition of HelpNDoc: Converting Word Documents to eBooks: A Step-by-Step Guide with HelpNDoc