PDFDoc Scout SDK Archives - ByteScout

PDFDoc Scout SDK

  • Home
  • /
  • PDFDoc Scout SDK
Quick Guide: How to create PDF document from JavaScript "Hello, World!"exampleYou 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) [...]
Sample: using javascript code in PDF documents made with PDFDoc Scout libraryDownload example source code: pdfdocscout_example_java_script_action.zip (55,6 KB)Screenshot (view produced pdf): ' create PDFDoc object  Set PDFDoc = CreateObject("PDFDocScout.PDFDocument")  ' initialize library  PDFDoc.InitLibrary "demo", "demo"    ' set output filename for PDF document  PDFDoc.OutputFileName = "pdfdocscout_example_java_script_action.pdf"  ' automatically open generated PDF document in default PDF viewer application  PDFDoc.AutoOpenGeneratedPDF = true  ' starts PDF document generation  PDFDoc.BeginDocument  'Add new Java Script Action  Set JavaScriptAction = PDFDoc.AddJavaScriptAction("app.alert('demo Java Script Action')")    ' Add button  Set btnTest = PDFDoc.Page.AddButton("btnDemo", 100, 150, 200, 110)  btnTest.Caption = "Run Java Script Action"  ' Set button action  btnTest.OnMouseDown = JavaScriptAction  ' close pdf document generation  PDFDoc.EndDocument  ' disconnect from library  Set PDFDoc = NothingDownload example source code: pdfdocscout_example_java_script_action.zip (55,6 KB)
How to rotate image added to the PDF generated with PDFDoc ScoutDownload example source code: pdfdocscout_example_image_rotation.zip (361 KB)Screenshot (view produced pdf): ' create PDFDoc object  Set PDFDoc = CreateObject("PDFDocScout.PDFDocument")  ' initialize library  PDFDoc.InitLibrary "demo", "demo"    ' set output filename for PDF document  PDFDoc.OutputFileName = "pdfdocscout_example_image_rotation.pdf"  ' automatically open generated PDF document in default PDF viewer application  PDFDoc.AutoOpenGeneratedPDF = true  ' starts PDF document generation  PDFDoc.BeginDocument  ' add new image to pdf document  image = PDFDoc.AddImageFromFileName("E:My DocumentsVisual Studio 2005ProjectsbytescoutPDFDocScoutDemoDemoimagesexamplespdfdocscout_example_thumbnail.jpg", itcJpeg)  ' show image in page and rotate to 15  PDFDoc.Page.PlaceImageEx image, 100, 100, 1, 1, 15  ' close pdf document generation  PDFDoc.EndDocument  ' disconnect from library  Set PDFDoc = Nothing Download example source code: pdfdocscout_example_image_rotation.zip (361 KB)
How to add and use GoTo Page action in PDF generated with PDFDoc Scout library to implement page change on button click in documentDownload example source code: pdfdocscout_example_goto_page_action.zip (55,8 KB)Screenshot (view produced pdf):  Set PDFDoc = CreateObject("PDFDocScout.PDFDocument") ' create PDFDoc object  PDFDoc.InitLibrary "demo", "demo" ' initialize library     PDFDoc.OutputFileName = "pdfdocscout_example_goto_page_action.pdf" ' set output filename for PDF document  PDFDoc.AutoOpenGeneratedPDF = true ' automatically open generated PDF document in default PDF viewer application     PDFDoc.BeginDocument ' starts PDF document generation     ' add text to current page - draw text at (100,100) and rotate at 15 degrees   PDFDoc.Page.AddText "Hello, World!", 100, 100, 15   'Add new GoTo Page Action  Set GoToPageAction = PDFDoc.AddGoToPageAction(0, 500)  ' Add button  Set btnTest = PDFDoc.Page.AddButton ("btnDemo", 100, 150, 200, 110)  btnTest.Caption = "Run GoToPageAction"  ' Set button action  btnTest.OnMouseDown = GoToPageAction     PDFDoc.EndDocument ' close pdf document generation     ' disconnect from library  Set PDFDoc = NothingDownload example source code: pdfdocscout_example_goto_page_action.zip (55,8 KB)
How to convert EMF (metafiles) to PDF document using PDFDoc Scout library: You can download the source code of this example here: pdfdocscout_emf2pdf.zip This example shows how to convert EMF metafile into PDF document with PDFDoc Scout libraryGenerated PDF file consists of EMF converted into PDF using PDFDoc Scout:Code to convert EMF file to PDF:' this example uses PDFDoc Scout to convert vector based EMF metafile image into PDF formatSet PDFDoc = CreateObject("PDFDocScout.PDFDocument")PDFDoc.InitLibrary "demo", "demo" PDFDoc.OutputFileName = [...]
How to draw tables to PDF document using HTML text format and PDFDoc Scout library: You can download the source code of this example here: pdfdocscout_drawing_table_using_html_formatting.zipThis example describes how to draw tables in generated PDF document with easy using built-in HTML text formatting support in PDFDoc Scout libraryScreenshot of generated PDF document with HTML coded table:Code to compose HTML code for table and draw this table in PDF:PDFDoc.InitLibrary "demo", "demo" PDFDoc.OutputFilename = "draw_table.pdf" PDFDoc.AutoOpenGeneratedPDF = truePDFDoc.BeginDocument' [...]
How to define document properties like Producer, Author, Keywords, Subject for PDF documents generated using PDFDoc Scout library: Download example source code: pdfdocscout_example_document_info.zip (10,7 KB)Screenshot (view produced pdf): ' IMPORTANT: In registered full version .Producer field is available only for registered users having additional "Application License" ' create PDFDoc object  Set PDFDoc = CreateObject("PDFDocScout.PDFDocument")  ' initialize library  PDFDoc.InitLibrary "demo", "demo"    ' set output filename for PDF document  PDFDoc.OutputFileName = "pdfdocscout_example_document_info.pdf"  ' automatically open generated PDF document in default PDF viewer application  PDFDoc.AutoOpenGeneratedPDF = true  PDFDoc.DocumentInfo.Author = "Demo Author"  PDFDoc.DocumentInfo.CreationDate = "1/1/2008"  PDFDoc.DocumentInfo.Creator = "Demo Creator"  PDFDoc.DocumentInfo.KeyWords = "Demo KeyWords"  PDFDoc.DocumentInfo.Producer = "Demo Producer"  PDFDoc.DocumentInfo.Subject = "Demo Subject"  PDFDoc.DocumentInfo.Title = "Demo Title"  ' starts PDF document generation  PDFDoc.BeginDocument  ' add text to current page - draw text at (100,100) and rotate at 15 degrees   PDFDoc.Page.AddText "Hello, World!", 100, 100, 15   ' close pdf document generation  PDFDoc.EndDocument  ' disconnect from library  Set PDFDoc = Nothing Download example source code: pdfdocscout_example_document_info.zip (10,7 KB)
Download example source code: pdfdocscout_example_curves_bezier.zip (10,6 KB)This example demonstrates how to draw Bezier curves in generated PDF documents with PDFDoc Scout library Screenshot (view produced pdf):  ' create PDFDoc object  Set PDFDoc = CreateObject("PDFDocScout.PDFDocument")  ' initialize library  PDFDoc.InitLibrary "demo", "demo"    ' set output filename for PDF document  PDFDoc.OutputFileName = "pdfdocscout_example_curves_beizer.pdf"  ' automatically open generated PDF document in default PDF viewer application  PDFDoc.AutoOpenGeneratedPDF = true  ' starts PDF document generation  PDFDoc.BeginDocument  PDFDoc.Page.MoveTo 100, 100  ' draw Curves Beizer  PDFDoc.Page.CurveTo 150, 100, 200, 100, 250, 200  ' to make drawn objects visible you should call .Stroke method  PDFDoc.Page.Stroke  ' close pdf document generation  PDFDoc.EndDocument  ' disconnect from library  Set PDFDoc = NothingDownload example source code: pdfdocscout_example_curves_bezier.zip (10,6 KB)
Download the source code of this example (VBScript) here: pdfdocscout_outlines.zip  Download the source code of this example (VB.NET) here: pdfdocscout_outlines_vb_net.zip  This example demonstrates how to generate bookmarks tree in PDF document using PDFDoc Scout libraryGenerated PDF document (screenshot):or view generated PDF document online: pdfdocscout_Outlines.pdfSource code:Set PDFDoc = CreateObject("PDFDocScout.PDFDocument") ' create PDFDoc object PDFDoc.InitLibrary "demo", "demo" ' initialize libraryPDFDoc.OutputFileName = "Outlines.pdf" ' set output filename for PDF document PDFDoc.AutoOpenGeneratedPDF = true ' automatically open generated PDF [...]
How to add combobox control on the page in PDF document generated with PDFDoc Scout library: Download example source code: pdfdocscout_example_combo_boxes.zip (55,3 KB)Screenshot (view produced pdf):  ' create PDFDoc object  Set PDFDoc = CreateObject("PDFDocScout.PDFDocument")  ' initialize library  PDFDoc.InitLibrary "demo", "demo"    ' set output filename for PDF document  PDFDoc.OutputFileName = "pdfdocscout_example_combo_boxes.pdf"  ' automatically open generated PDF document in default PDF viewer application  PDFDoc.AutoOpenGeneratedPDF = true  ' starts PDF document generation  PDFDoc.BeginDocument  ' add Combobox  Set DemoCombobox = PDFDoc.Page.AddCombobox("DemoCombobox", 100, 100, 150, 115)  ' Add Items  DemoCombobox.AddItem "Item 1"  DemoCombobox.AddItem "Item 2"  DemoCombobox.AddItem "Item 3"  DemoCombobox.AddItem "Item 4"    ' close pdf document generation  PDFDoc.EndDocument  ' disconnect from library  Set PDFDoc = NothingDownload example source code: pdfdocscout_example_combo_boxes.zip (55,3 KB)