125
©Nitro
LocateJavaScripts
Whetheryouwritescriptsinyourowndocuments,orbrowsefilesforscriptstoexamine,youfirstneedto
knowwheretolookforJavaScripts.InNitroPro9youcanfindJavaScriptsinthefollowinglocations:
Fieldscripts
JavaScriptscanbeusedwithallfieldtypes.InallfieldsyoucanaddscriptsintheSetActionsproperties.In
signaturefieldsyoucanaddJavaScriptsinboththeSetActionpropertiesandintheSignedproperties.By
farthemostopportunityyouhaveforaddingscriptsinfieldpropertiesiswithtextfields.Intextfieldsyou
canaddscriptsto:
l
Formatproperties.OpentheFormatpropertiesandselectCustomfromtheSelectformatcat-
egorydropdownmenu.JavaScriptsareaddedtocreateaCustomFormatScriptandCustomKey-
strokeScript.
l
Validate.OpentheValidatepropertiesandselectUsecustomvalidationscripttoadda
JavaScripttovalidatefielddata.
l
Calculate.TheCalculatepropertiesarelikelytobethemostfrequentareawhereJavaScriptsare
created.Youcanwritescriptsintwoareas.ClicktheSimplifiedfieldnotationbuttonandyoucan
writescriptsusingsyntaxsimilartospreadsheetformulas.ClicktheCustomcalculationscriptand
youcanwriteJavaScriptstocalculatefielddata.
l
AddAction.Liketheotherfields,textfieldssupporttheRunJavaScriptactiontype.
JavaScriptconsole
YoucanopentheJavaScriptConsoleandwriteascriptthatdoesn’tbelongtoanyfieldorelement.Scripts
writtenintheJavaScriptConsolecanbeusedtotestroutinesanddebugcode.
DocumentActions
Opening,savingandprintingPDFsarealldocumentactions.JavaScriptscanbewrittenwhenthese
actionsoccur.ToaddaDocumentAction,gototheFormsribbontab,intheJavaScriptgroup,click
DocumentActions.
DocumentlevelJavaScripts
AdocumentlevelJavaScriptcanbeafunctionthatotherscriptscallinsubroutines.Thesescriptsare
containedatthedocumentlevelandcanbeexecutedbyanotherscriptorwhenopeningafile.
FolderlevelJavaScripts
AfolderlevelJavaScriptislocatedoutsideofthePDFfile(ina.jsfile)andcanbeusedbymorethanone
PDF.WhenNitroPro9isopenedthescriptsarerun.
NitroPro9-UserGuide
Pdf split and merge - Split, seperate PDF into multiple files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Explain How to Split PDF Document in Visual C#.NET Application
pdf split and merge; c# print pdf to specific printer
Pdf split and merge - VB.NET PDF File Split Library: Split, seperate PDF into multiple files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Splitter Control to Disassemble PDF Document
break pdf into multiple files; break apart pdf
126
©Nitro
CopyandpasteJavaScripts
JavaScriptscanbecopiedandpastedfromonefieldorotherlocationinaPDFdocumentorbetweentwo
documents.IfyouexaminePDFfilesforlearningJavaScriptprogramming,youcanbrowsePDFfiles
containingscripts,copyascriptfromadocumentyoudownloadfromtheInternet,andpastethecode
intotheJavaScriptEditorinyourdocument.Withalittlecodemodification,youcanquicklyaddscriptsto
yourownfiles.
TocopycodebetweenPDFfilesjustopenthembothinNitroPro9.
NitroPro9-UserGuide
VB.NET PDF File Merge Library: Merge, append PDF files in vb.net
PDF ›› VB.NET PDF: Merge and Append PDF. VB.NET PDF - Merge PDF Document Using VB.NET. VB.NET Guide and Sample Codes to Merge PDF Documents in VB.NET Project.
break pdf into single pages; break a pdf
C# PDF File Merge Library: Merge, append PDF files in C#.net, ASP.
|. Home ›› XDoc.PDF ›› C# PDF: Merge and Append PDF. C#.NET PDF Library - Merge PDF Documents in C#.NET. Merge PDF with byte array, fields.
pdf file specification; acrobat split pdf bookmark
127
©Nitro
AddoreditfolderlevelJavaScript
FolderlevelJavaScriptsareJavaScriptfiles(.JS)thatarerunduringapplicationstartup.Thesecanbe
usefulforloadingreusableJavaScriptfunctionsintotheapplication,oraccessingmethods/properties
whosesecurityrestrictionsonlyallowthemtoberunintheapp/initevent.
Simpleexamplesincludeloadingtheuser'sWindowsloginintoaglobalJavaScriptvariableatstartup,or
loadingalistofemployeenamesfromyourcompanyintoaJSarrayatstartupwhichcanbeusedbythe
formsthatareopenedinNitroPro9.
ToaddoreditafolderlevelJavaScript
1. OpenNitroPro9
2. OntheFormsribbontab,intheJavaScriptgroup,clickFolderLevel
3. AddJSfilestothefolderoreditexistingones
NitroPro9-UserGuide
C# PDF: C#.NET PDF Document Merging & Splitting Control SDK
C# PDF - Merge or Split PDF File in C#.NET. C#.NET Code Demos to Combine or Divide Source PDF Document File. Visual C#. VB.NET. Home
break a pdf file; break pdf documents
VB.NET PDF: Use VB.NET Code to Merge and Split PDF Documents
VB.NET PDF - How to Merge and Split PDF. How to Merge and Split PDF Documents by Using VB.NET Code. Visual C#. VB.NET. Home > .NET Imaging
pdf no pages selected to print; break pdf password
128
©Nitro
DocumentlevelJavaScript
YoucanuseJavaScripttoaddanalmostinfinitenumberofinteractivefeatures,createcomplexcalculation
formulas,andaddmoredynamicfunctionalitytoyourPDFs.
Documentlevelscriptsareusedtoaddfunctionsfromwhichotherscriptscanreuseroutinesthroughout
aPDFfile.YoucanalsousedocumentlevelJavaScriptstoinvokeactionswhenafileopens.
TowriteadocumentlevelJavaScript
1. OpenthePDFinNitroPro9
2. OntheFormsribbontab,intheSetupgroup,clickthearrowbeneaththeJavaScriptbuttonand
thenclickDocumentLevel
3. ClickNew,andtypeanamefortheJavaScript
4. IntheJavaScriptEditordialog,enteryourcode.Intheexamplebelow,asimpleroutineiscreated
thatopensanalertdialogboxeachtimethefileopensThecodeusedis:
var msg = “Created in Nitro Pro”;
app.alert(msg);
5. ClickOK.Ifyourscriptwaswrittenproperly,adialogboxshoulddisplayeachtimethefileisopened
NitroPro9-UserGuide
VB.NET TIFF: Merge and Split TIFF Documents with RasterEdge .NET
Merge certain pages from different TIFF documents and create a &ltsummary> ''' Split a TIFF provide powerful & profession imaging controls, PDF document, tiff
can print pdf no pages selected; c# split pdf
VB.NET PDF Library SDK to view, edit, convert, process PDF file
Tell VB.NET users how to: create a new PDF file and load PDF from other file formats; merge, append, and split PDF files; insert, delete, move, rotate, copy
break pdf into separate pages; pdf separate pages
129
©Nitro
AddoreditcustomcalculationJavaScript
Anyformyoucreatethatrequirescalculationsislikelytorequirecustomcalculationscripts.Theoptions
youhaveavailablewithpresetcalculationformulasarelimitedtosimplemultiplicationandaddition.
Otherkindofcalculationyouneedrequireswritingascript.
Towriteacalculationscript
1. OpenthePDFinNitroPro9
2. OntheFormsribbontab,intheFieldsgroup,clickTextField
3. Selectthetextfieldtoedit
4. Right-clickandselectProperties
5. ClicktheCalculatetab
6. ClicktheCustomcalculationscriptoption,andthenclicktheEditbutton
7. Typethecodeforyourscript.Intheexamplebelow,asimpleroutineiscreatedtocalculatesales
taxata7.25%rate.Thecodeusedis:
var f = this.getField(“subtotal”);
event.value = Math.round(f.value 7.25)/100;
8. ClickOK
NitroPro9-UserGuide
C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
functions. Able to create, load, merge, and split PDF document using C#.NET code, without depending on any product from Adobe. Compatible
pdf format specification; break a pdf apart
C# PDF Page Insert Library: insert pages into PDF file in C#.net
for each of those page processing functions, such as how to merge PDF document files NET, how to reorganize PDF document pages and how to split PDF document in
break up pdf into individual pages; break apart a pdf in reader
130
©Nitro
Addasimplifiedfieldnotation
SimplifiedfieldnotationiswrittenmorelikeformulasyouaddinspreadsheetapplicationslikeMicrosoft
Excel.Writinganotationisoftenaneasiersolutionwhenaddingcalculationscripts.
ToaddaSimplifiedfieldnotation
1. OpenthePDFinNitroPro9
2. OntheFormsribbontab,intheFieldsgroup,clickTextField
3. Selectthetextfieldtoedit
4. Right-clickandselectProperties
5. ClicktheCalculatetab
6. ClicktheSimplifiedfieldnotationoption,andthenclicktheEditbutton
7. Typethecodeforyourscript.Inthisexample,thesamecalculationforcreatingsalestaxisadded.
ThecodeintheJavaScriptEditoriswrittenasfollows:
subtotal .0725;
8. ClickOK
NitroPro9-UserGuide
131
©Nitro
UsetheJavaScriptconsole
YoucanopentheJavaScriptConsoleandwriteascriptthatdoesn’tbelongtoanyfieldorelement.Scripts
writtenintheJavaScriptConsolecanbeusedtotestroutinesanddebugcode.
TousetheJavaScriptconsole:
l
OntheFormsribbontab,intheSetupgroup,clickthearrowbeneaththeJavaScriptbuttonand
thenclickConsole
NitroPro9-UserGuide
132
©Nitro
ViewoutputandJavaScripterrors
TheOutputPaneallowsyoutoviewanyerrorsrelatedtoJavaScriptordocumentprocesses,andwillopen
automaticallytoalertyouofanyimportantoutputmessages.
ToopentheOutputpane:
l
Onthesidebar,clicktheOutputtab
NitroPro9-UserGuide
133
©Nitro
SupportedJavaScriptObjects
l
App
object
l
Color
object
l
Console
object
l
Event
object
l
Field
object
l
Global
object
l
Identity
object
l
Link
object
l
This
object
l
Util
object
l
OCG
object
NitroPro9-UserGuide
134
©Nitro
Appobject
AstaticobjectthatrepresentsthePDFviewerapplication.
Containsmethodsandpropertiesforinterfacingwiththeapplicationaswellassomeforworkingwith
activedocuments.
Example:Getsthenumberofdocumentsopenanddisplaysitinanalertmessage.
var nDocs = app.activeDocs.length;
app.alert("You have " + nDocs + " documents open.");
Properties
activeDocs
formsVersion
platform
viewerType
viewerVersion
Methods
alert
browseForDoc
goBack
goForward
launchURL
mailMsg
newDoc
openDoc
response
NitroPro9-UserGuide
Documents you may be interested
Documents you may be interested