ApowerfultemplateenginethatconvertsdataintoiTextqualityPDFsWhitePaperV1.
2www.
itextpdf.
com2IntroductionManyorganizationsstrivetomaketemplatingmoreuser-friendly,withoutconstantlypesteringthedevelopmentteamwithadhocrequests.
Whatifyoucouldhaveaneasywaytoconfigureanddesigndata-drivenPDFoutputtemplatesorinputforms,andconnectthesetotheappropriateback-endlogicanddata,ensuringcorrectbusinessresultsandprofessionaloutputThat'swhatiTextDITOisallabout.
WhatisiTextDITOiTextDITOsimplifiestheprocessofcreatingmultipleoutputtemplatesorinputforms.
AnintuitiveWYSIWYG(WhatYouSeeIsWhatYouGet)front-endgivesyoutheabilitytocreateyourowndata-drivenoutputtemplatesorinputforms,tiedtoapowerfulback-end.
iTextDITOhandleseverythingfromHTML5inputformcreationanddataprocessingwithJSON,tothegenerationofPDFs–allwithoutrequiringdeveloperstowriteanycode.
Thisprovidesawaytogetresultswhilereducingworkloadfordevelopersandsavingyoutimeandresources.
iTextDITOisanenterprise-gradetemplateenginebuiltonproventechnology;usingiText7CorewithitspdfHTMLandpdfCalligraphadd-onstoenableseamlessintegrationofHTML5,CSS3,PDF2.
0andgloballanguage/ligaturesupportintoyourdocumentworkflows.
Inthiswhitepaper,wediscussthehowandwhyofiTextDITO.
Startingwithabroadoverviewexplainingthefeaturesoftheframework,wethenlookatwhatiTextDITOcando,andhowitcanhelpyou.
Thisdocumentisaimedatdeveloperswhowillhavetoimplementandmaintainthissolution.
Therefore,we'llgointoextensivetechnicaldetail,explainingadvancedfeatures,configurationoptionsandworkflowimplementation.
WhyuseiTextDITOThereisaclearneedinthemarketforasolutionthatoffersusersthepowerofdynamicdata-drivenformcreation,allowingthemtoquicklydesignPDFoutputtemplatesorinputforms.
iTextDITOisapowerfultemplateenginethatconvertsdataintoiTextqualityPDFs.
Thissolutionallowsuserswithouttechnicalexpertisetodesignanoutputtemplateorinputformandlinkittoadesiredoutputdocument,usingasystemsetupbydevelopersfordataprocessing.
Atitscore,iTextDITObridgesthegapbetweenaninputdocumentandthedesiredoutputformat,usingthedatathathasbeengathered.
Thismeansyou'renotlimitedtoforms;theenginecanacceptanydatathatcanbeconvertedtoJSONandoutputtoeitherPDF,orstructureddatathatcanbewrittentootherdatabases.
Allthisenablesyoutohaveatrulydata-drivendocumentworkflowleadingtosignificantsavingsforyourbusiness.
HowiTextDITOWorks:AhighleveloverviewiTextDITOisatemplateenginewithtwomaincomponents:auser-friendlybrowser-basedapplicationandaJavaSDK.
TheJavaSDKcanbeconfiguredbydeveloperstodotheheavylifting,whilethebrowser-basedapplicationgivesusersaneasytousetooltoleveragethepoweroftheJavaSDK.
Theapplicationitselfcanbeconfiguredtofittheneedsofthebusiness,andtheworkflowcanbeintegratedintoanexistingITenvironment.
Usingthebrowser-basedapplicationuserscanquicklycreateHTML5inputformsandoutputtemplateswhichcanbeutilizedinanumberofways,suchasinputformstocaptureandsubmitdataenteredbyusers(forexampleanapplicationform).
Alternatively,youmightwanttopopulateanoutputtemplateusingexistingdatafromadatabase,togeneratePDFinvoicesorotherdocuments.
Youcanalsolinkinputformstooutputtemplates,tobealteredorcombinedwithotherdatabeforebeingoutputtoaspecificstyleandsavedasaPDF.
Thetemplatesarebuiltusingeasytoaddelementssuchasrichtext,textfields,sub-formsandtables.
StylingcanbeaddedtothoseelementsintheiTextDITObrowser-basedapplication,however,ifyourequirefurtherstylingthenyoucansimplyaddyourownCSStotemplates.
Forexample,companyformattingandbrandingcanbeappliedtothetemplatescreatediniTextDITO.
3Allinputfieldscanbelinkedtoavariableidentifyingtheinputfield.
Thisenablestheusertocombinefieldsintocalculations(e.
g.
Total=PricexQuantity),butalsoallowsoutputdocumentstobecreatedeasily.
Someinputdatawillberelevantasoutput,somemightberelevantasasourceforcalculations,andsomemightevenonlybeusedforauthenticationandservenofurtherpurpose.
Databindingmakesiteasytoincludeinputfromnon-humansourcessuchasdatabasesorRESTfulAPIcalls.
iTextDITOusesdataconvertedintoJSONformatturningitintomuchmorethanaformcreationtool;itcanalsobeusedtostructuredatafromdifferentsourcesintooutputdocuments.
Youcanofcoursealsocombineuserinputwithadditionaldatafromothersources.
Whentheuserissatisfiedwithboththeinputformandoutputtemplate,theycanexporttheresulttoaniTextDITOtemplatepackage.
Thisisessentiallyanarchivefilecontainingallthenecessaryinformationtobuildtheforms,includingallrelevantresourcessuchasfontsandimages.
Tousetheinputformoroutputtemplate,youneedtheiTextDITOSDKwhichisavailableeitherasaDockercontainerforusewithnon-Javaenvironments,orasanativeJavalibraryifyouprefer.
TheSDKistheenginepoweringiTextDITOandisresponsibleforbothpublishingandexecutingthelogictomovefrominputdatatostructuredoutputdata.
TheoutputusuallytakestheformofaPDF,butthankstothedatabindingit'salsopossibletoexporttheinput,forexampletostoreitinadatabase.
TheSDKrunsusingtheiTextDITOtemplatepackageandasetofotherparameters.
Itcanbewrappedintoastandaloneapplication(whichmightberunfromthecommandline),butusuallythefunctionalityoftheSDKwillbeintegratedintoexistingsoftware.
Thismighttranslatetoaneasy-to-usebuttonthatuserscanclickwithouttheneedforanyassistancefromdevelopers,apartfromtheinitialintegrationandimplementation.
iTextDITOenablesapowerfulend-to-endworkflowwhereanyusercaneasilycreateoutputtemplatesorinputformsusingdatafromusers,databasesorboth.
Theycanthenapplythenecessarylogictogetendresultsthatsuittheirneeds.
ThiscanbeaPDFsuchasaninvoiceoralegalrecord,orevennewentriesinadatabase.
YouonlyneedtointegrateiTextDITOandupgradetheimplementationasnecessary(forexamplewithnewCSSstyles).
Bothdevelopersanduserscanworkfarmoreefficiently,requiringfarlessofeachother'stime.
4AdvancedfunctionalitydeepdiveTheeditorThepowerofiTextDITOcomesinpartfromthewebapplication.
Theeasy-to-useyetpowerfulWYSIWYGinterfaceallowsevennon-technicaluserstocreateformsthatoperateexactlyasneeded.
Itisthelogicalconnectionbetweeninputandoutput,andthecomprehensivewayinwhichtocreatethatlogic,thatreallymakestheproductunique.
TheeditorisusedtomakeproprietaryiTextDITOtemplatepackages.
Theycontainallthenecessaryresourcestoproducetheneededoutput,inPDForwrittentoanexistingdatabase.
Theapplicationenablesanyonetocreateuniquetemplates.
Itcanrunlocally,butthewebappisusuallyaccessedthroughalocalserver.
Theeditorconsistsofacentralworkspace;ontherightaresubform-toolssuchastable,imageanddatabindingcontrols,andontheleftisacolumnforadditionalfinetuningofthetemplates,withtemplatestylesheetsandelementsalsodisplayed.
RTFAnyuserfamiliarwithtexteditorsoftwarewillimmediatelyfeelathomeinthecentralworkspacearea.
Richtextoptionsallowthemtoeasilyadjustthestyling,font,colorandoutlineoftext.
Textcanbebothstaticanddynamic.
It'spossibletoinsertdynamicintrusionstakenfromdatatocustomizeeachoutputform.
Obviousexamplesareinvoicenumbers,ornamesofrecipientstakenfromanexistingdatabase.
5SubformsCentraltothefunctionalityofanyformarethesubforms.
Asubformisagroupcontainingdifferentelements.
Byeditingthesubform,allelementswithinitareaffected.
Itispossibletodirectlyaffectthevisualstyleofaformthroughsubforms.
Whencreatinganinvoiceform,forexample,theusercangrouptheitemname,number,quantityandpriceinasubformandcreateaborderaroundalltheseelements.
Visually,thismakesiteasierforanyonefillingtheformtokeepanoverview.
Furthermore,thesubformsallowforsomepowerfuldynamicfeatures,aswe'lldiscussfurtherinthisdocument.
TablesiTextDITOalsosupportstables.
Thisfeatureisespeciallyusefulwhencombinedwithdatabindingofthetablefields.
ItallowsiTextDITOtogetinputdatafromexistingdatabases,oroutputdatagatheredthroughtheformstootherdatabases.
Iftherearemultipleinputvaluesavailableforatablerow,itcanberepeatedasoftenasnecessary.
Auserfillingouttheformcanmanuallyaddnewrows,butiTextDITOcanalsoautomaticallyaddnewitemsasneededwhengettinginputfromaJSONfile.
Intheexampleoftheinvoiceform,youcanimagineatablecontaininganitemname,apriceandaquantityineachrow.
IfyouwanttouseiTextDITOtocreatePDFinvoicesfromadatabase,you'llbeconfrontedwithdifferentcustomersorderingdifferentamountsofitems.
Ifacustomerordersalaptopatacostof500dollars,andakeyboardatacostof10dollars,thetablecanautomaticallycreateasecondrowcontainingtheseconditem.
TextAtextfieldisaverystraightforwardadditiontoanyform.
Itallowstheusertotypewhatevertheywant.
Firstandlastnamesarestraightforwardexamples.
Ausercancreateplaceholdertextthatwillappearinanunfilledtextformbox,toclarifywhatisexpected.
Theycanalsoattachstylesorspecifydatabindings.
ImagesAsaformshouldusuallyreflectthecompanystyle,addingimagesisanessentialfeature.
Youcanaddimagesfromtheinternetoruploadyourown.
UploadedimageswillbearchivedintheiTextDITOtemplatepackageaftercreationofthetemplate.
Themostpopularusecaseforaddingimagesistheinclusionofacompanylogo.
6CheckboxTheadditionofcheckboxesisratherstraightforward.
Ofcourse,it'spossibletospecifythelabelandthestyleaccompanyingthecheckbox.
SubmitbuttonThesubmitbuttonisonlyavailableforinputtemplatesandcan'tcorrespondwithanelementontheoutputtemplate.
Asthenamesuggests,thebuttontriggersthecollectionofthedatafromtheform.
Whenthebuttonisclicked,thedataissenttoapreviouslyselectedURI.
ThedatacannowbeusedtoproduceaPDFoutputtemplate,butitcanalsobestoredinadatabase.
Youcaneasilycustomizetheappearanceofbuttonstofitthetemplatestyle.
InputversusoutputTheworkflowforcreatingtheoutputformisalmostidenticaltothecreationoftheinputform.
It'spossibletoomitcertaininputorperformcalculationsoninputfieldsinordertogenerateoutputfields.
Byadjustingthestyle,theoutputformquicklybecomesaformaldocumentthatstandsonitsownanddoesn'tjustlooklikeacheapreplicaoftheinputform.
Howdifferenttheinputandoutputformslookdependsentirelyonyourbusinessneeds.
FormattingandlogicThebrainofiTextDITOistheSDKwhichusesmanycomponentsoftheiText7code,althoughitisavailableasaseparateproduct.
ThesoftwareisbuiltontheOpenWebPlatformstack,butmorespecifically,HTML,CSSandJavaScriptarethefoundationsofiTextDITO.
ThispowerfulSDKparsesiTextDITOtemplatescreatedwiththeeditorandhasalotofadvancedfunctionswhichmakeitidealfordataprocessing.
Inthissegment,we'lldiscussinsomedetailthewayiTextDITOhandlesdataandlogic,andhowyoucanadddynamicformatting.
Someofthefeaturesbelowarequiteadvancedandareintendedforimplementationbytechnicalusers.
Weprovidethefollowingdocumentationforthebenefitofdevelopers.
DatabindingDatabindingconnectsdatawithtemplateelements.
Bindsmakeitpossibletousedatadynamically;tocreateoutputformsusingdatafrominputforms,tostoredataindatabases,andtoautomaticallyinputdatafromnon-humansources.
Supposeyouwanttocreatecustomticketsforanevent,andyoualreadyhaveallthenecessaryinformationoftheinviteesstoredinadatabase.
Youwanttocreateaninputformtogathertherelevantdatafromthedatabase,andanoutputformthatlookslikethefinalinvitationyou'dbesending.
ThisoutputformisaPDF,builtfromthedatainthedatabase.
Thefirstthingyouneedtoaddisafirstname.
YouneedtocreateJSONdatadefiningthedatabindproperty,followedbythefieldvalue.
TheJSON-datacouldlooklikethis:{"first_name":"John"}first_nameisthevalueofthedatabindpropertyofafield,whilethefieldvaluetakenfromthedatasourceisJohn.
Ifyouspecifyafieldcontainingtextinputandbindthatinputtofirst_name,thefieldwillautomaticallyresolvetoJohn.
7DatabindpropertiesWhenwebindvaluesfromdatatoatemplateitgoesthroughthefollowingtransformation:datavalue->rawvalue->displayvalueTherawvalueistheinternalformatthatiTextDITOuses.
Thedisplayformatcoversthesecondtransformationwhilethebindformatisresponsibleforthefirstone.
Thesamesyntaxisusedforboth.
Bindformatshouldbespecifiedwhendataisexpectedinaformatthatisdifferentfromtheinternalformat.
Intheexampleabove,iTextDITOreadsthedate-timefromdatastoredinBrusselstimezoneformatanddisplaysthetimeinUTC.
ResolvinglogiciTextDITOresolvesinputfollowingasetofrules.
Itisimportanttoknowtheserulesinordertogettheresultsyouwant,whenusingJSONinputdatawithaformtemplate.
ResolvingorderThedataisautomaticallyresolvedagainstthedataboundtothenearestelementinaparentchain,ortotherootdataifnoparentsinthechainareboundtodata.
Supposeyou'vecreatedafieldwithabinding(first_name),nestedwithinasubformwithoutbinding,nestedinturnwithinaparentsubformwithabinding(person).
subform("person"binding)|---subform(nobinding)|---field("first_name"binding)NowimaginetheJSONdataforinputlooksasfollows:{"person":{"first_name":"John"},"first_name":"JaneInthisexample,thefieldwillresolvetoJohn,asthealgorithmlooksforthenearestboundparent,inthiscasethesubformperson.
Youcanchangethisbehaviorbyaddingthe$signinfrontofadatabindvalue.
Theparametertellsthealgorithmtolookforthebindingrelativetothedataroot.
So,theformstructurewouldlooklikethis:8subform("person"binding)|---subform(nobinding)|---field("$.
first_name"binding)Thefieldwouldresolvewiththefirst_namebindingclosesttotherootoftheJSONdataexample,whichisJane.
ResolvingmultipledataentriesResolvingdatatodataboundfieldsiseasywhenthereisexactlyoneentrythatcorrespondswithonefield.
Moreoftenthannot,thenumberofdataentriesisvariable.
Youmighthaveonecustomerwhoorderedtwodifferentitems,andanotherwhoorderedten.
Ifyouwanttoautomaticallycreateinvoicesfromanexistingdatasetcontainingtheorders,yourformneedstocopewiththisvariableinput.
Specifically,youwouldneedtherelevantsubformtoautomaticallymultiplyasmanytimesasneeded.
Thatway,youonlyhavetoaddasinglesubformwithentryfieldsforitem,quantityandprice.
Ifacustomerordersmorethanoneitem,anewlineisadded,asmanytimesasneeded.
Byaddingthe[*]parametertothedatabindvalueofafieldinthewebeditor,thealgorithmknowsitneedstomultiplyasubformasmanytimesastheinputdatarequires.
Apartfromtheparameter,thestructureremainsthesame.
subform("people[*]"binding)|---field("first_name"binding)---field("last_name"binding)Nowthesubformwillmultiplyforeachdataentry.
Iftheinputdataspecifiesthreefirst_nameandlast_namebindslikeintheexamplebelow,theabovesubformwillbeaddedtotheformthreetimes.
{"people":[{"first_name":"John","last_name":"Doe"},{"first_name":"Jane","last_name":"Diluca"},{"first_name":"Han","last_name":"Pak"}]}The[*]parametermeansyouneverhavetoaddthesamesubformmultipletimesmanually,whilealsogivingyourtemplatetheflexibilitytohandleanunknownamountofdataentries.
Ifyouwanttopublishaformformanualfilling,youcancheckacheckboxinthewebeditortoadd+and-buttonsnexttoasubform.
CalculationsandlogicWe'vealreadytalkedaboutperformingcalculationsiniTextDITO.
Sometimes,itmightbeimpossibletoshowthenecessaryinformationontheoutputformusingonlydatabinding.
Youmightforexamplewanttoshowatotalattheendofaninvoice,containingthesumofallitemsorderedintheirrespectivequantities,multipliedbytheVAT.
Inordertosimplifyprocessingofthedatawithouttheneedforpre-processing,iTextDITOcanhandlemanystraightforwardcalculations.
Calculationsallowyoutoassignvaluestocertainfieldsdependingonthevaluesofotherfields.
It'spossibletocalculateafieldusingotherfieldswhicharetheresultsofcalculationsthemselves.
Inasense,youcantreatiTextDITOlikeasimplespreadsheet.
9Inordertoperformcalculationsonthevariablesinafield,youmustnamethefields.
Thefieldnamesactasvariablesthatyoucanuseinmathematicalexpressions.
Ifyouhaveafieldnamedpriceandanotheronenamedquantity,youcancreateafieldshowingthetotalofanorderbydefiningitasprice*quantity.
The[*]parametercanbeusedinthiscontextaswell.
Theparameterallowsyoutoperformacalculationusingavariablenumberoffields.
If,forexample,youwanttocalculateagrandtotalbasedontheorderofanunknownnumberofdifferentitems,you'dneedthesumofthepricefieldofallthoseitems.
Youcandothisbyusingthefollowingnotation:sum(price[*])iTextDITOsupportsthefollowingfunctions:-sum-product-concatAndthefollowingoperators:DataMappingModeTheeditorhasanadditionalviewmodetoseeandconfiguredatabinding.
Youcanswitchtothedatamappingmodebyclickingthefollowingbuttonintheeditor:Thiswillgiveyouaviewlikethis:10VisualstylesandformattingWealreadytalkedaboutsomeeasy-to-usevisualoptionswithinthewebeditor,butiTextDITOhasfarmoreupitssleeve.
YoucandefineveryspecificpersonalstylesusingCSScode,andyoucanevenmakeasingleformlocallyresponsivebasedontheregioninwhichyouwanttouseit.
ValueformattingValueformattingfunctionsarepowerfultoolsthatenableyoutodisplayvaluesinspecificwaysintheoutputform.
Youcanusethefunctionstospecifythedesiredformat.
Currently,iTextDITOsupportsnumberandcurrencyformatting.
Numberformattingisrepresentedasastring,precededbythenumoperator.
Aformattingstringmightlooklikethis:num('$#,##0.
00','de-de')Intheaboveexample,therearetwoarguments.
Thefirstonespecifiesthepattern;thesecondargumentaddsalocale.
Alocale-parameterisoptional,butveryhandywhenyouwanttodeployasingleforminmultiplegeographicalregions.
Itaffectsgrouping,decimalseparatorsandcurrencysymbols.
Forexample,aformatof#,###.
00andatextof4500.
20willlookasfollowswithalocaleof"de":4.
500,20Andasfollowswithalocaleof"us":4,500.
20Therearesixspecialcharactersyoucanusetodefineformatting.
Allothercharactersinaformattingstringwillbeleftintact.
-0(Digit)-#(Digit,zeroshowsasabsence)-.
(Decimalseparator)--(Negativesign)-,(Groupingseparator)-%(Percent,multipliesnumberby100)Time/dateformattingFortime/dateformatting,aswithnumberformattingtherearetwoargumentsthatspecifythepattern,andthe(optional)timezoneID.
IfnotimezoneIDisspecified,thenthelocalonewillbeused.
AnexampleshowingthelocaltimeanddateinPariswouldbeformattedasfollows:date('YYYY-MM-DDHH:mm:ssZZ','Europe/Paris')TheZZinthisexampledisplaystheUTC(CoordinatedUniversalTime)offsetfromtheselectedtimezone.
Thepatternconsistsofspecialcharactersaswellasanyothercharacters,specialcharacterscanbeescapedwith[]brackets.
11Specialcharacters:Month:M-12.
.
.
1112Mo-1st2nd.
.
.
11th12thMM-0102.
.
.
1112MMM-JanFeb.
.
.
NovDecMMMM-JanuaryFebruary.
.
.
NovemberDecemberQuarter:Q-1234Qo-1st2nd3rd4thDayofMonth:D-12.
.
.
3031Do-1st2nd.
.
.
30th31stDD-0102.
.
.
3031DayofYear:DDD-12.
.
.
364365DDDo-1st2nd.
.
.
364th365thDDDD-001002.
.
.
364365DayofWeek:d-01.
.
.
56do-0th1st.
.
.
5th6thdd-SuMo.
.
.
FrSaddd-SunMon.
.
.
FriSatdddd-SundayMonday.
.
.
FridaySaturdayDayofWeek(ISO):E-12.
.
.
67WeekofYear:w-12.
.
.
5253wo-1st2nd.
.
.
52nd53rdww-0102.
.
.
5253WeekofYear(ISO):W-12.
.
.
5253Wo-1st2nd.
.
.
52nd53rdWW-0102.
.
.
5253Year:YY-7071.
.
.
2930YYYY-19701971.
.
.
20292030Y-19701971.
.
.
9999+10000+10001WeekYear:gg-7071.
.
.
2930gggg-19701971.
.
.
20292030WeekYear(ISO):GG-7071.
.
.
2930GGGG-19701971.
.
.
20292030AM/PM:A-AMPMa-ampmHour:H-01.
.
.
2223HH-0001.
.
.
2223h-12.
.
.
1112hh-0102.
.
.
1112k-12.
.
.
2324kk-0102.
.
.
2324Minute:m-01.
.
.
5859mm-0001.
.
.
5859Second:s-01.
.
.
5859ss-0001.
.
.
5859FractionalSecond:S-01.
.
.
89SS-0001.
.
.
9899SSS-000001.
.
.
998999SSSS.
.
.
SSSSSSSSS-0000.
.
0010.
.
.
.
.
9980.
.
9990.
.
TimeZone:z/zz-ESTCST.
.
.
MSTPSTZ--07:00-06:00.
.
.
+06:00+07:00ZZ--0700-0600.
.
.
+0600+0700UnixTimestamp:X-1360013296UnixMillisecondTimestamp:x-136001329612312Notesontime/dateformatting:Formonthformatting,usingtheMMMMpatternwillnotresultinfour-lettermonths,butwillinsteadreturnfullmonthnames.
Ifanincompatibletimeisparsed(onewithtwoconflictinghoursdeclarationsforexample)thenanexceptionwillbethrownIfthepatterndoesn'tcontainmorespecificinformation(e.
g.
itcontainsayearbutdoesn'tcontainamonth)thenformorespecificinformationtheinitialvaluewillbeused(firstmonth,firstdayetc.
)Ifthepatterndoesn'tcontainmorebroadinformation(e.
g.
itcontainsamonthanddaybutdoesn'tcontainayear)thentheclosestpossiblelocalinformationwillbeused(e.
g.
2019fortheyearetc.
)IfthepatternhasaUTC(CoordinatedUniversalTime)offsetthenitwillbeused,andthetimezonewillbeignored.
DuetoDST(daylightsavingtime),thereisapossibilitythatatimeeitherdoesnotexist,orithaspreviouslyexisted.
Ifyoutrytoparseatimethatneverexisted,itwillskipforwardbytheamountoftheDSTgap(usually1hour).
Ifyoutrytoparseaduplicatedtime,thentheearlierinstancewillbetaken.
StylesheetsandclassesiTextDITOtemplatesmakeuseoftheOpenWebPlatform.
ThetemplatesarethereforetoagreatextentcompatiblewithCSSstylesheets.
AdvanceduserscancustomizealmostallvisualpropertiesofatemplatewithCSS.
However,sincetheiTextDITOwebeditorismeanttobeusedbynon-technicalusers,CSSknowledgeisnotrequired.
Anyonecanmodifythevisualstylingwiththedesignertool,butCSSofcourseoffersmoreflexibility.
YoucanalsoembedpersonalizedstylesheetswhileintegratingiTextDITOintothecompanyinfrastructure.
Youcanaddtherelevantstylesonce,allowingtheusertoselectthestyleneedingtounderstandCSS.
Youcanaddanewembeddedstylesheetoruseanexternalone.
Thestylesheetscanbelinkedwithelementsthroughelementclasses.
It'salsopossibletospecifystyleswithoutexplicitlylinkingtothem.
Forexample:*[data-dito-element="rich-text"]{color:red;Inthisexample,allthetextinrichtextelementswoulddefaulttored,unlesstheuserexplicitlyoverridesthetextcolorbychangingthelay-out.
InstallationandintegrationiTextDITOisnotanout-of-the-boxapplication.
TheframeworkneedstobeintegratedwithanexistingITinfrastructure.
Whileanyonecanusetheframeworktocreatetemplatesandforms,theintegrationneedstobedonebyanexperienceddeveloper.
ThedevelopercandefineoptimalworkflowsbyintegratingwiththeexistingITinfrastructure.
iTextDITOisonlyavailableforJavaandrequiresJava8torunthewebeditorapplication.
FormsarepublishedanddataisprocessedwiththeJavaSDK.
TheSDKalsoproducesthePDFoutput.
iTextguaranteessoftwarecompatibilitywithboththeOracleJREandOpenJRE.
Youneedversion8withupdate152.
iTextDITOmightnotworkproperlyonolderversions.
WebeditorinstallationYoucandownloadtheJARfilefromtheiTextArtifactory.
Inordertorunthewebeditorapplication,you'llneedaconfigurationfilesuchasthisone:13server:applicationConnectors:-type:httpport:8080adminConnectors:-type:httpport:8081logging:level:INFOworkDirectory:path:D:/DITOWorkAsyoucansee,theeditorusestwoports.
Thefirstone(8080intheaboveexample),isusedtoaccessthewebeditoritself.
Usersoftheapplicationwillconnectthroughthisport.
Thesecondport(8081)isusedforaccesstoadministrativefeatures.
Youcanofcourseconfiguretheportsmanually,aslongastheeditorandtheadministratorconnectoruseadifferentone.
Youshouldmakesuretheadminportisn'taccessiblefromoutsidethelocaltrustednetwork.
TheworkDirectoryparameterspecifiesthedirectorythatwillbeusedfortemporarystorage.
Thisparameterisrequiredforthewebeditorapplicationtoworkcorrectly,makesurethepathisvalid.
iTextDITOusestheDropwizardwebserverintheback-end.
Ifyouneeddocumentationdetailinghowtosetupthehttpsconnectionandhowtoaddhttpscertificates,youcanrefertotheDropwizardconfigurationmanual,availableonline.
Inordertoruntheeditorapplication,youneedthefollowingcommand:java-jardito-server.
jar{server,check}config.
ymlTheservercommandstartsthewebapplication.
Assoonasit'sstarted,itshouldbeavailablethroughthespecifiedport.
Thecheckcommandmakessuretheconfigurationfileoffersvalidconfigurationdata.
Ifsomethingisnotworkingproperly,you'llseetheerrorsprinted.
Asanadministrator,youcanaccessthehealthcheckfeature.
Healthcheckshelpyouidentifythecauseofproblemswiththeapplication.
Thefeatureisavailablethroughtheadministratorport:http://localhost:8081/healthcheckTheresultofahealthcheckisreturnedinJSONformat.
{"deadlocks":{"healthy":true},"workDirectory":{"healthy":true}}Assumingeverythingworkswell,you'llsee{"healthy":true}forallchecks.
Ifthereisaproblem,theJSONdatawillcontainamessagedescribingtheproblem.
Forexample:"workDirectory":{"healthy":false,"message":"Workdirectorydoesnotexist"}JavaSDKTheJavaSDKistheheartandbrainsoftheiTextDITOframework.
TheSDKdeploystheinputform,producesoutputPDFsfromoutputtemplates,processescalculationsandformatting,andprocessesinputandoutputfromandtoexternaldatabases.
14InstallingwithMavenTheJavaSDKisavailableasaMavenmodule.
Inordertoinstallit,youneedthenecessarydependencyfromtheiTextArtifactory.
First,youneedtoaddtherepositorytotheMavenPOMfileasfollows:ditoDITORepositoryhttps://repo.
itextsupport.
com/ditoSubsequentdeploymentiseasy.
JustaddthedependencytoyourPOMfilelikethis:com.
itextpdf.
ditosdk-java${dito.
sdk.
version}Thedito.
sdk.
versionstatementisavariablespecifyingyourcurrentversionoftheframework.
Thevaluecanforexamplebe1.
0.
0.
InstallingwithGradleToreferencetheJavaSDKfromGradle,youneedthenecessarydependencyfromtheiTextArtifactory.
First,youneedtoaddtherepositorytotheGradlebuildfileasfollows:repositories{mavenCentral()maven{url"https://repo.
itextsupport.
com/dito"}maven{url"https://repo.
itextsupport.
com/releases"}}Referencingthedependencyisnoweasy.
Justaddthecorrespondingentrytothedependenciessection:dependencies{compilegroup:'com.
itextpdf.
dito',name:'sdk-java',version:ditoSdkVersion}TheditoSdkVersionstatementisavariablespecifyingyourcurrentversionoftheframework.
Thevaluecanforexamplebe1.
0.
0.
WorkflowintegrationEveryiTextDITOworkflowstartswiththecreationofaformtemplate,exportedtoaniTextDITOtemplatepackage.
Thisfilewillbeatthecenteroftherestoftheworkflow.
You'llprobablywanttodeployinputforms,acceptdatasubmissionsforthoseforms,andfinallycreateoutputPDFsusingtheinputdata,followingtheoutputtemplate.
LoadingthelicensekeyBeforeyoucanusetheJavaSDK,youneedtoinstallthelicensekey.
Thisiseasilymanagedbyusingthefollowingcommands:FilelicenseKeyFile=".
.
.
";DitoLicense.
loadLicenseFile(licenseKeyFile);15ForvolumelicensecustomersWeadvisequeryingyourremainingvolumefrequentlyandsendingawarningmessagetoyourownapplication/systembeforethelimitisreachedandstopsworking.
ForcustomersusingthenativeiTextDITOJavaSDKyoucancallgetRemainingProducePagesEventsusingtheAPIandthisfunctionwillreturnthenumberofpagesremainingonyourvolumelicensekey.
Ifyouhaveaperpetuallicense,thiscallwillreturnnull.
ForiTextDITOSDKforDockerusersitisevensimpler.
Simplycall/api/licensetodisplaytheexpirationDateofyourlicensekeyaswellastheremainingvolume.
InputformdeploymentAssoonasauserhascreatedatemplatepackageusingtheeditor,thepackagecanbedeployedinyourwebserverenvironment.
TheJavaSDKwillprocessthepackageintoaninputform.
YouneedtheInputTemplateDeployerclassfromthecom.
itextpdf.
dito.
sdk.
inputpackage.
Fourparametersarerelevant.
Youneedtospecifythepathtothetemplatepackageyouwanttouse,thenameoftheinputtemplateinsidethepackage,analiasfortheinputformandanoutputfolder.
Thedeployedformwillbestoredinthislocation.
FileprojectFile=newFile("templatePackage.
dito");StringtemplateName="input";FiledeployFolder=newFile("deployed");InputTemplateDeployer.
deployTemplateFromPackage(projectFile,templateName,deployFolder);Insidethefolderspecifiedfordeployment,youcanfindaninputfile.
Thisfilecontainstheactualformyou'vecreated.
Thefilenamewillbeidenticaltothetemplatename,asspecifiedintheTemplateNameargument.
Astheformisnowcreated,you'refreetorenameitintoanythingyoulike.
Thefolderwillalsocontainasubfoldernamedjs.
Inside,theJavaSDKhasputthefilesnecessarytosupportinteractivefeaturesoftheform.
Ifapplicableforthetemplateyou'veused,you'llalsofindaresourcesfolderhere.
Youcanhostallfilesdirectlyfromthedeploymentfolder.
iTextDITOallowsforflexiblepublicationoftheform.
Youcan,forinstance,createadedicatedwebpageanddirectusersthere,oryoucanembeditinsideanexistingwebpageusingan.
AcceptingdatafromformsWhendesigningthetemplate,youcanspecifyaURI.
Datacollectedbytheform,willbesentthereusingPOSTorPUT,asspecifiedduringthedesignofthetemplate.
Thetypeofthedatapayloadisapplication/x-dito-data-submission,butyoucaneasilyconvertthedatatoatypethat'seasiertoworkwith.
Fornow,onlyJSONissupported.
DatasubmissionsarehandledbytheDataSubmissionclassfromthecom.
itextpdf.
dito.
sdk.
submissionpackage.
TheexamplebelowillustrateshowtogetsubmissiondatainJSONformatfromtheInputStream,whichrepresentsthepayload:Stringjson=DataSubmission.
fromInputStream(is).
asJsonString();16PDFcreationOneoftheprimaryfunctionsofiTextDITOistheautomaticcreationofstylishandusefulPDFsbasedondatagatheredbytheinputform.
Ifthetemplatepackagecontainsanoutputtemplate,allyouneedisthePdfProducerclassfromthecom.
itextpdf.
dito.
sdk.
outputpackage.
CreatingaPDFusinganoutputtemplateandJSONdatamightlooklikethis:FiletemplatePackageFile=newFile(templatePackagePath);StringtemplateName="output";FileOutputStreamfos=newFileOutputStream(newFile(outFilePath))StringjsonPdfProducer.
convertTemplateFromPackage(templatePackageFile,templateName,fos,newJsonData(json));YoucanalsocombineacceptingdatasubmissionsandcreatingPDFs.
Thatway,aPDFwillbecreatedforeachfilledoutform.
Theexamplebelowshowshowyoucanautomatetheworkflow:Stringjson=DataSubmission.
fromInputStream(is).
asJsonString();FiletemplatePackageFile=newFile(templatePackagePath);StringtemplateName="output";FileOutputStreamfos=newFileOutputStream(newFile(outFilePath))StringjsonPdfProducer.
convertTemplateFromPackage(templatePackageFile,templateName,fos,newJsonData(json));UsingiTextDITOWehavenowcoveredtheiTextDITOframeworkquiteextensively.
We'vealsodiscussedtheneedforadata-drivensolutionlikeiTextDITO,thepossibilitiesoftheframework,andwe'vetouchedonthemostimportanttechnicalaspects.
Below,you'lldiscoverasimpleexampleofaworkflowusingiTextDITO,usingasanexamplethecreationofaninvoicetemplate.
AusecaseexampleAninvoicetemplateisastraightforwardexampleofaniTextDITOusecase.
Youcaneasilyimagineasalesrepresentativeinthefieldusingatablettoinputordersforacustomer.
Thesalesrepwouldneedaneasytoolattheirfingertips,whilethecustomerrequiresaprofessionallookingandeasilyunderstandableinvoiceforpayment.
Inthisscenario,theheadofsalescanuseiTextDITOtodevelopaformforusebythesalesrep.
Thedynamicformallowsthemtoaddproductstoanorder,specifyhowmanyproductsareordered,andexpandtheorderwithmultipleproductsasnecessary.
Bycompletingtheinputform,thesalesrepcanthenplacetheorder.
Ofcourse,itwouldn'tdotosendthecustomerascreenshotoftheform.
Eventhoughitlookscleanandeasytouse,it'snowheregoodenoughtoserveasaninvoice.
Furthermore,arealinvoiceneedstohavespecificinformationincluded,suchasanaccountnumberoraddresses.
Lastly,thecustomerexpectstheirinvoicetoarriveviaemailinPDFformat,asPDFoffersawidelycompatibleyetunchangeabledigitalfilethatcarrieswithitasenseofauthority.
WithiTextDITO,theordermadebythesalesrepresentativeisautomaticallyconvertedtoaPDFfilethat'sreadytobeemailedtothecustomer.
What'smore,iTextDITOhandlesthedatagatheredthroughtheinputforminsuchawaythatitcanbesharedwithotherpartsofthecompany'sITinfrastructure.
Imaginetheordergoingstraighttotheorderpickersinthewarehouse,forfastdelivery.
WheniTextDITOhasbeenimplementedcorrectly,theheadofsaleswouldnotneedthehelpofadevelopertocreateboththeformandthePDFoutput.
Theycouldeasilybuildatemplateforboth,followingthecompanystyleandformatting.
17ComprehensivewalkthroughNow,let'shavealookathowtheaboveusecasewouldtranslateintoapracticalworkflow.
Thetemplatewearecreatingmightbeusedbyasalesperson.
Theycanfillouttheformwithordersfortheircustomer.
Aftersubmittingtheorder,iTextDITOwillautomaticallycreateaprofessionallookinginvoiceinPDF.
We'llusesampledatatotryoutourform:{"invoice_no":"12345","company_name":"ABC,Inc.
","address":"12Weststreet,NY,USA","items":[{"name":"Bluepen","price":"20.
1","quantity":10},{"name":"Blackpencil","price":"0.
1","quantity":1},{"name":"Redpen","price":"20","quantity":78},{"name":"Bluepencil","price":"0.
15","quantity":13}]}Thecreationofthetemplatestartsinthewebeditor.
Westartournewprojectbyuploadingthecompanylogo.
Ontheleftoftheeditor,youcanfindtheresourcespanel.
Here,youcaneitheraddanimagefromtheweboruploadyourown.
Assoonastheimageisadded,youcandragittotheeditingarea.
Theeditorwillautomaticallycreateanewelementcontainingtheimage.
Next,wealigntheimagetotherightofourform.
Inordertodoso,wemustfirstwrapitintoasubform.
Clickthesubformiconinthetoolboxanddragtheimageintothesubform.
Nowwecanapplytherighttextalignmentfromtheparagraphstyleproperties.
Theresultlooksasfollows:18Theinvoicewearecreatingwillhaveauniquenumber,shownatthetopoftheform.
Inordertoaddthisheader,weneedanewstatictextelement.
Youcaneasilyadditandusethestylecontrolstoeditthevisualappearanceofthetext.
Ourformmusttaketheinvoicenumberfromtheinputdata.
Inordertodoso,weinsertadatabindingintrusionwiththevalueinvoice_no.
Clicktheunderlinedbuttonontherightofthetoolbartoaddthebinding.
Youcanaddstatictextelementscontainingthecompanynameandaddressinasimilarway.
Wealignthecontactinformationtotheright,soitsitsneatlyunderneaththelogo.
Sincewealreadyhavesomedatabindinggoingon,it'sagoodideatodoapreview.
Atthetopoftheeditorwindow,youcanfindthepreviewbutton.
iTextDITOneedssampledataforthepreviewSowecanusethedataprovidedatthebeginningofthissegment.
TheJSONdatacontains"invoice_no":"12345"asthefirstentry.
Thevalue12345correspondswiththeinvoice_novariable,whichweusedasadatabindinourform.
Thepreviewshowstheexpectedresult:Ineditingmode,it'stimetoaddthebulkofourinputform.
Weneedatablecontainingthenameoftheitembeingbought,theunitprice,thequantityoftheorder,andthetotalforthatitem.
Underneath,weaddafieldwiththegrandtotalfortheentireorder.
Thetableaboverequiressomeconfiguration.
Weneedtodefinetherelationshipbetweentheindividualfieldsandtheinputdata,butalsobetweenthefieldsthemselves.
Wenotonlyneedtoapplydatabindingtothefields,butwemustalsonamethem.
Thatway,wecaninvokethevalueofthefieldsasvariablesforfurthercalculations.
Theitemname,itempriceanditemquantityfieldsallneedadatabindandaname.
Youcanusename,priceandquantityforboth.
Theexamplebelowshowshowthepropertiesoftheitemnamefieldneedtobefilled.
Theitemtotalfieldwillbefilledusingdataprovidedbytheitempriceanditemquantityfields.
Therefore,itdoesnotneedadatabind.
Thefielddoesneedanamethough,aswearegoingtoperformcalculationsonintheGrandtotalfield.
Wecallititem_total.
UnderCalculation,weselectproduct.
Inordertocalculatethetotalamountowed,thefieldmustcontaintheproductofpriceandquantity.
19BeforewecanmoveontotheGrandtotalfield,weneedtotellourformthateachitemfromtheinputdataneedstohaveitsownrowinthetable.
Inotherwords:thetableneedstoextenditselfwithadditionalrowsasmanytimesasthereareitemdataentriesintheJSONdata.
Thismakestheformflexible;itwillbeabletohandleorderscontainingonlyoneitemaswellasorderscontainingmultipleitems.
Selectthesecondtablerow(theonecontainingthefields)fromtheelementstreeontheleft,andspecifythemultiplieditems[*]binding.
Anotherpreviewwillillustratetheresultofthisbinding.
AstherearefourentriesunderItems,theformwillautomaticallyaddfourrowsinthetable.
TheItemtotalwillalsobefilledasaproductofquantityandpriceforeachitem.
Thisworksperfectly,assumingallinputcomesfrompreviouslygathereddata.
Ofcourse,oursalesrepresentativeshouldbeabletousetheformmanuallytoputinaclient'sorder.
Ifwewantthemtobeabletoaddmultipleitemstooneinvoice,weneedtoaddinteractivecontrols.
Thesecontrolswillappearnexttoarowinthetable.
Byclicking'+',therepresentativewillbeabletoaddanewrowmanually.
Withthe'-'button,theycanremovearow.
SelectthesecondrowofthetableagainandlookfortheAddinteractiverepeatablecontrolsoption.
Clickthecheckboxtoenablethefeature.
Lastly,weneedasubmissionbutton.
Byclickingthisbutton,datawillbesenttothedestinationofourchoice.
Addthebutton,andtrypreviewingtheformwithoutanyinputdata,soyoucanseethevanillaformthatwillbepresentedtothesalesrep.
20Theformstilllooksrathercrude,butalltherequiredfunctionalityisthere.
Nowyoucantryandpolishtheform,oryoucanapplycustomCSSstylestoreallywrapitinthecompanystyle.
Nowyoucancopytheinputtemplatetotheoutputtemplate.
Youmustgetridofthebuttonstomanuallyaddorremoverows,andthesubmitbuttonisalsouselesshere.
TheoutputformwillbeconvertedtoPDFandserveasanofficialinvoice,soitshouldlookaccordingly.
Youcanpreviewtheoutputwiththesampledatatoseehoweverythingwilllook.
Whenyou'resatisfied,youcanexportthetemplatetoaniTextDITOtemplatepackagereadyforusebytheJavaSDK.
Conclusion:TakingactionwithiTextDITOiTextDITOisapowerfultoolthatempowersbusinessuserswhiledecreasingthetimedevelopersmustspendperformingnonessentialtasks.
Inbusinessestoday,userswanttousetechnologytoachieveagoal.
Theyknowwhattheyneedbutmaylackthetechnicalknowledgeandbackgroundtotranslatetheirvisionintoreality.
Developershavethisknowledgebutaren'talwaysfamiliarwiththespecificneedsoftheenduser.
Bothofthemtryingtoworkoutasolutiontoaproblemisn'tveryefficient.
ThemaingoalofiTextDITOistoprovideuserswiththetoolstoturntheirowndata-drivenformsvisionintoreality,withoutneedingtoinvolveadeveloper.
Valuabletimegetssaved,whilethepaceofinnovationisincreased.
TherestillisanimportantroleforthedeveloperintheearlystagesoftheimplementationofiTextDITO.
TheymustdotheactuallegworkofintegratingtheframeworkintheexistingITinfrastructureandconfiguringittobeused.
Butafterthisinitialconfiguration,thetoolisreadytogo.
iTextDITOistheonlyframeworkavailabletodaythatempowersenduserstocreateadvancedandfunctionalformscombinedwithPDFoutput.
WithiTextDITOinstalled,userscancreateavarietyofformsinthelookandfeeloftheirchoice.
Theinputoftheformsiseasilystructured,canbeoutputtoadatabase,andofcourseconvertedtoPDFtobeeitherusedorarchived.
SoundinterestingContactustolearnmoreat:https://itextpdf.
com/en/products/itext-dito.
AboutiTextiTextistheworld'sforemostplatformtocreatePDFfilesandintegratethemincorporateapplications.
Originallyreleasedin2000,iTextisavailableasanopensourceproductwithcommunitysupport,aswellasacommercialproduct,worldwidesupportedbytheiTextGroupNV(withofficesinEurope,NorthAmericaandAsia).
In2016,thepopulariText5versionwassucceededbythefullyre-writtenandre-architecturediText7platform,withadvancedadd-onoptions.
iTextrepresentsauniquecapabilityoffacilitatingtheuseofdynamicandcomplexPDFdocumentsincorporatedocumentworkflows,throughoutthewholedocumentlifecycle.
前几天看到网友反馈到PacificRack商家关于处理问题的工单速度慢,于是也有后台提交个工单问问,没有得到答复导致工单自动停止,不清楚商家最近在调整什么。而且看到有网友反馈到,PacificRack 商家的之前年付低价套餐全部下架,而且如果到期续费的话账单中的产品价格会涨价不少。所以,如果我们有需要续费产品的话,谨慎选择。1、特价产品下架我们看到他们的所有原来发布的特价方案均已下架。如果我们已有...
棉花云官网棉花云隶属于江西乐网科技有限公司,前身是2014年就运营的2014IDC,专注海外线路已有7年有余,是国内较早从事海外专线的互联网基础服务提供商。公司专注为用户提供低价高性能云计算产品,致力于云计算应用的易用性开发,并引导云计算在国内普及。目前公司研发以及运营云服务基础设施服务平台(IaaS),面向全球客户提供基于云计算的IT解决方案与客户服务(SaaS),拥有丰富的国内BGP、双线高防...
关于HostYun主机商在之前也有几次分享,这个前身是我们可能熟悉的小众的HostShare商家,主要就是提供廉价主机,那时候官方还声称选择这个品牌的机器不要用于正式生产项目,如今这个品牌重新转变成Hostyun。目前提供的VPS主机包括KVM和XEN架构,数据中心可选日本、韩国、香港和美国的多个地区机房,电信双程CN2 GIA线路,香港和日本机房,均为国内直连线路,访问质量不错。今天和大家分享下...
999ddd.com为你推荐
公司网络被攻击最近企业受到网络攻击的事件特别多,怎么才能有效地保护企业的网络安全呢?甲骨文不满赔偿如果合同期不满被单位辞退,用人单位是否需要赔偿同ip域名不同域名解析到同一个IP是否有影响5xoy.com求个如月群真汉化版下载地址百度指数词为什么百度指数里有写词没有指数,还要购买www.03ggg.comwww.tvb33.com这里好像有中国性戏观看吧??lcoc.top日本Ni-TOP是什么意思?partnersonlinecashfiesta 该怎么使用啊~~www.45gtv.com登录农行网银首页www.abchina.com,pp43.com登录www.bdnpxzl.com怎么进入网站后台啊
个人域名注册 新世界机房 美元争夺战 128m内存 ca4249 免空 帽子云 91vps 美国独立日 联通网站 空间登陆首页 监控服务器 中国电信测速网站 贵阳电信测速 atom处理器 免费蓝钻 双十二促销 机柜尺寸 cpu使用率过高怎么办 ping值 更多