Home

PDFDoc Scout

PDFDoc Scout screenshot (click to enlarge)



PDFDoc Scout library - Sample

Download Free Trial See Licensing Options More Information

Quick Guide: How to create PDF document from JavaScript

"Hello, World!"example

You can download the source code of this example here: pdfdocscout_javascript.zip

PDFDoc Scout library can be used in scripting languages that support ActiveX/COM objects: Javascript, VBScript, ASP and ASP.NET scripted language. This page will show how create PDF document using Javascript and PDFDoc Scout library.

Windows 98/2000/ME/XP have built-in JavaScript support and all files with ".js" are recognized as JavaScript files and can be executed by system.
 
1) Install PDFDoc Scout library on your computer
 
2) Run Notepad
 
3) To create PDF animation document in JavaScript we have to write a very simple script:

var PDFDoc = WScript.CreateObject('PDFDocScout.PDFDocument');

PDFDoc.InitLibrary('demo', 'demo'); // init library
PDFDoc.OutputFileName = 'HelloWorld.pdf'; // set PDF output filename
PDFDoc.AutoOpenGeneratedPDF = true; // automatically open generated PDF document in default PDF viewer application
PDFDoc.BeginDocument(); // starts PDF document generation
// add text to current page
PDFDoc.Page.AddText('Hello, World!', 100, 100, 15);

PDFDoc.EndDocument(); // end document

Feel free to copy the code from this page, paste into the notepad and save  as a "HelloWorld.js":

4) Double-click "HelloWorld.js" file from Explorer or from another file manager and the script will be executed.
 
You can view the generated PDF file (.PDF) using Adobe Reader or another PDF viewer application.
 
Generated PDF document

You can download the source code of this example here: pdfdocscout_javascript.zip
 
Download Free Trial See Licensing Options More Information


See also: Bytescout.PDF - native .NET library to write/read/sign/
modify/merge/split PDF documents (but no HTML2PDF support)



On-line documentation (HTML format)


"Hello, World!" quick start step-by-step tutorials:

Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement