devexpress asp.net pdf viewer : Copy pages from pdf to new pdf Library application component asp.net windows azure mvc AppleShellScripting-201418-part650

GeneratingEscapeSequencesusingtheterminfoDatabase
Generatingescapesequenceswiththeterminfodatabaseisrelativelystraightforwardonceyouknowwhat
terminalcapabilitiestorequest.Youcanfindseveraltablescontainingcapabilityinformation,alongwiththe
standardANSI/VT220valuesforeachcapability,inANSIEscapeSequenceTables (page 183).(Notethatnotall
ANSIescapesequenceshaveequivalentterminfocapabilities,andviceversa.)
Onceyouknowwhatcapabilitytorequest(alongwithanyadditionalargumentsthatyoumustspecify),you
canusethe
tput
commandtooutputtheescapesequence(orcapturetheoutputof
tput
intoavariableso
youcanuseitlater).Forexample,youcanclearthescreenwiththefollowingcommand:
tput cl
Someterminfodatabaseentriescontainplaceholdersfornumericvalues,suchasrowandcolumninformation.
Theeasiestwaytousetheseistospecifythosenumericvaluesonthecommandlinewhencalling
tput
.
However,forperformance,itmaybefastertosubstitutethevaluesyourself.Forexample,thecapability
cup
setsthecursorpositiontoarowandcolumnvalue.Thefollowingcommandsetsthepositiontorow3,column
7:
tput cup 3 7
Youcan,however,obtaintheunsubstitutedstringbyrequestingthecapabilitywithoutspecifyingrowand
columnparameters.Forexample:
tput cup | less
Bypipingthedatato
less
,youcanseepreciselywhatthe
tput
toolisproviding,andyoucanlookupthe
parametersinthemanualpagefor
terminfo
.Thisparticularexampleprintsthefollowingstring:
^[[%i%p1%d;%p2%dH
The
%i
notationmeansthatthefirsttwo(andonlythefirsttwo)valuesareonegreaterthanyoumightotherwise
expect.(ForANSIterminals,columnsandrowsnumberfrom1ratherthanfrom0).The
%p1%d
meanstopush
parameter1ontothestackandthenprintitimmediately.Theparameter
%p2%d
istheequivalentforparameter
2.
Asyoucanseefromeventhisrelativelysimpleexample,thelanguageusedforterminfoisquitecomplex.
Thus,whileitmaybeacceptabletoperformthesubstitutionforsimpleterminalssuchasVT100yourself,you
maystillbetradingperformanceforportability.Ingeneral,itisbesttolet
tput
performthesubstitutionson
yourbehalf.
AdvancedTechniques
ShellTextFormatting
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
181
Copy pages from pdf to new pdf - Library application component:C# PDF Page Extract Library: copy, paste, cut PDF pages in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Easy to Use C# Code to Extract PDF Pages, Copy Pages from One PDF File and Paste into Others
www.rasteredge.com
Copy pages from pdf to new pdf - Library application component:VB.NET PDF Page Extract Library: copy, paste, cut PDF pages in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Detailed VB.NET Guide for Extracting Pages from Microsoft PDF Doc
www.rasteredge.com
GeneratingEscapeSequencesDirectly
TouseanANSIescapesequencewithoutusing
tput
,youmustfirstbeabletoprintanescapecharacterfrom
yourscript.Therearethreewaystodothis:
Use
printf
toprinttheescapesequence.Inastring,the
\e
switchprintsanescapecharacter.Thisis
theeasiestwaytoprintescapesequences.
Forexample,thefollowingsnippetshowshowtoprinttheresetsequence(
^[c
):
printf "\ec" # # resets the screen
Note:  InallversionsofOSX,
printf
isashellbuiltinfor
/bin/sh
.However,thisisnot
necessarilytrueforotherplatforms.Thus,ifcross-platformperformanceisanissue,youshould
avoidthisusage.
Embedtheescapecharacterinyourscript.Themethodofdoingthisvarieswidelyfromoneeditorto
another.Inmosttext-basededitorsandonthecommandlineitself,youdothisbypressingControl-V
followedbytheEsckey.Althoughthisisthefastestwaytoprintanescapesequence,ithasthedisadvantage
ofmakingyourscripthardertoedit.
Forexample,youmightwriteasnippetlikethisone:
echo "^[c" # Read d the note e below!!!
Note:  Youmustenterthisescapecharactermanually;copyingandpastingthetextinthis
examplewillnotwork.
Toentertheaboveescapesequence,type
echo
followedbyaspaceanddouble-quotemark.
ThenpressControl-VfollowedbytheEsckeytoaddtheescapecharacter.Next,typealowercase
c
.Finally,closethedouble-quotemarkandpressReturn.
Use
printf
tostoreanescapecharacterintoavariable.Thisistherecommendedtechniquebecause
itisnearlyasfastasembeddingtheescapecharacterbutdoesnotmakethecodehardtoreadandedit.
Forexample,thefollowingcodesendsaterminalresetcommand(
^[c
):
#!/bin/sh
AdvancedTechniques
ShellTextFormatting
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
182
Library application component:VB.NET PDF Page Insert Library: insert pages into PDF file in vb.
As String = Program.RootPath + "\\" Output.pdf" Dim doc1 Dim doc2 As PDFDocument = New PDFDocument(inputFilePath2 GetPage(2) Dim pages = New PDFPage() {page0
www.rasteredge.com
Library application component:VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.
to delete a range of pages from a PDF document. Dim filepath As String = "" Dim outPutFilePath As String = "" Dim doc As PDFDocument = New PDFDocument(filepath
www.rasteredge.com
ESC=`printf "\e"`
# store e an escape e character
# into the variable ESC
echo "$ESC""c"
# Echo a a terminal reset command.
Becausetheterminalresetcommandisoneofonlyahandfulofescapesequencesthatdonotstartwithaleft
squarebracket,itisworthpointingoutthetwosetsofdouble-quotemarksafterthevariableintheabove
example.Withoutthose,theshelltriestoprintthevalueofthevariable
ESCc
,whichdoesnotexist.
ANSIEscapeSequenceTables
Therearefourbasiccategoriesofescapecodes:
Cursormanipulationroutines(describedinTable11-1 (page 185))allowyoutomovethecursoraround
onthescreen,showorhidethecursor,andlimitscrollingtoonlyaportionofthescreen.
Attributemanipulationsequences(describedinAttributeandColorEscapeSequences (page 186))allow
youtosetorcleartextattributessuchasunderlining,boldfacedisplay,andinversedisplay.
Colormanipulationsequences(describedinAttributeandColorEscapeSequences (page 186))allowyou
tochangetheforegroundandbackgroundcoloroftext.
Otherescapecodes(describedinTable11-4 (page 190))supportclearingthescreen,clearingportionsof
thescreen,resettingtheterminal,andsettingtabstops.
CursorandScrollingManipulationEscapeSequences
Theterminalwindowisdividedintoaseriesofrowsandcolumns.Theupper-leftcornerisrow1,column1.
Thelower-rightcornervariesdependingonthesizeoftheterminalwindow.
Youcanobtainthecurrentnumberofrowsandcolumnsonthescreenbyexaminingthevaluesoftheshell
variables
LINES
and
COLUMNS
.Thus,thescreencoordinatesrangefrom
(1, 1)
to
($LINES, $COLUMNS)
.
InmostmodernBourneshells,thevaluesfor
LINES
and
COLUMNS
areautomaticallyupdatedwhenthewindow
sizechanges.ThisistrueforbothBASHandZSHshells.
AdvancedTechniques
ShellTextFormatting
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
183
Library application component:C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
RasterEdge XDoc.PDF allows you to easily move PDF document pages position Copying and Pasting Pages. You can use specific APIs to copy and get a specific page of
www.rasteredge.com
Library application component:C# PDF Page Rotate Library: rotate PDF page permanently in C#.net
Copy this demo code to your C# application to rotate the first page of One is used for rotating all PDF pages to 180 in clockwise and output a new PDF file
www.rasteredge.com
Compatibility Note:  InBASH,the
LINES
and
COLUMNS
variablesaresetonlyforinteractiveinstances
oftheshell.Thispresentsasmallproblemforshellscriptsthatcareaboutwindowsize.Asaresult,
inversionsofOSXwherethedefaultshellisBASH(OSXv10.3andnewer),thesevariablesarenot
definedinshellscriptsthatstartwith
#!/bin/sh
.
Ofcourse,youcouldrequestthatZSHinterpretthescriptbychangingthefirstlineofyourscriptto
#!/bin/zsh
,butdoingsoisnotparticularlyportable.Fortunately,withoutchangingshells,you
caneasilyobtainthecurrentrowandcolumncountwiththecodeinListing11-7.
Listing11-7 Obtainingterminalsizeusing
stty
or
tput
# If tput is available, , this is the easy way:
MYLINES=`tput lines` # # ROWS
MYCOLUMNS=`tput cols` # # COLUMNS
# If not, you can do it t the hard way.
This usually works.
MYLINES=`stty -a | | grep rows | sed 's/^.*;\(.*\)rows\(.*\);.*$/\1\2/' | | \
sed 's/;.*$//' ' | sed 's/[^0-9]//g'` ` # ROWS
MYCOLUMNS=`stty -a a | grep columns | | \
sed 's/^.*;\(.*\)columns\(.*\);.*$/\1\2/' ' | \
sed 's/;.*$//' ' | sed 's/[^0-9]//g'` ` # COLUMNS
Ifyouwanttobeparticularlyclever,youcanalsotrapthe
SIGWINCH
signalandupdateyourscript’snotionof
linesandcolumnswhenitoccurs.SeeTrappingSignals (page 173)formoreinformation.
Onceyouknowthenumberofrowsandcolumnsonyourscreen,youcanmovethecursoraroundwiththe
escapesequenceslistedinTable11-1.Forexample,tosetthecursorpositiontorow4,column5,youcould
issuethefollowingcommand:
printf "\e[4;5H"
Forother,fasterwaystoprintescapesequences,seeGeneratingEscapeSequencesDirectly (page 182).
AdvancedTechniques
ShellTextFormatting
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
184
Library application component:C# PDF Page Insert Library: insert pages into PDF file in C#.net
Apart from the ability to inserting a new PDF page into existing PDF to delete PDF page using C# .NET, how to reorganize PDF document pages and how to
www.rasteredge.com
Library application component:C# PDF Page Delete Library: remove PDF pages in C#.net, ASP.NET
How to delete a range of pages from a PDF document. String filepath = @""; String outPutFilePath = @""; PDFDocument doc = new PDFDocument(filepath); // Detele
www.rasteredge.com
Table11-1
Cursorandscrollingmanipulationescapesequences
Description
Escape
sequence
Terminfocapability
Hidesthecursor.
^[[?25l
tivis
Note:The
terminfo
entry
forTerminaldoesnot
supportthisoption.
Showsthecursor.
^[[?25h
tvvis
Note:The
terminfo
entry
forTerminaldoesnot
supportthisoption.
Setscursorpositiontorowr,columnc.
^[[
r
;
c
H
cup
r c
Reportscurrentcursorpositionasthoughtyped
fromthekeyboard(reportedas
^[[
r
;
c
R
).Note:
itisnotpracticaltocapturethisinformationina
shellscript.
^[[6n
(noequivalent)
Savescurrentcursorpositionandstyle.
^[7
sc
Restorespreviouslysavedcursorpositionand
style.
^[8
rc
Movescursoruprrows.
^[[
r
A
cuu
r
Movescursordownrrows.
^[[
r
B
cud
r
Movescursorrightccolumns.
^[[
c
C
cuf
c
Movescursorleftccolumns.
^[[
c
D
cub
c
Disablesautomaticlinewrappingwhenthecursor
reachestherightedgeofthescreen.
^[[7h
(noequivalent)
Enableslinewrapping(onbydefault).
^[[7l
(noequivalent)
Enableswhole-screenscrolling(onbydefault).
^[[r
(noequivalent)
Enablespartial-screenscrollingfromrowStorow
Eandmovesthecursortothetopofthisregion.
^[[
S
;
E
r
(noequivalent)
Movesthecursordownbyoneline.
^[D
do
AdvancedTechniques
ShellTextFormatting
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
185
Library application component:C# PDF Image Extract Library: Select, copy, paste PDF images in C#
Open a document. PDFDocument doc = new PDFDocument(inputFilePath); PDFPage page = (PDFPage)pdf.GetPage(0); // Extract all images on one pdf page.
www.rasteredge.com
Library application component:C# PDF Annotate Library: Draw, edit PDF annotation, markups in C#.
RootPath + "\\" 2.pdf"; String outputFilePath = Program.RootPath + "\\" Annot_6.pdf"; // open a PDF file PDFDocument doc = new PDFDocument(inputFilePath
www.rasteredge.com
Description
Escape
sequence
Terminfocapability
Movesthecursorupbyoneline.
^[M
up
AttributeandColorEscapeSequences
Attributeandcolorescapesequencesallowyoutochangetheattributesorcolorfortextthatyouhavenot
yetdrawn.Noescapesequence(scrollingnotwithstanding)changesanythingthathasalreadybeendrawn
onthescreen.Escapesequencesapplyonlytosubsequenttext.
Forexample,todrawared“W”character,firstsendtheescapesequencetosettheforegroundcolortored
(
^[[31m
),thenprinta“W”character,thensendanattributeresetsequence(
^[[m
),ifdesired.
Theattributeandcolorescapecodescanbecombinedwithotherattributeandcolorescapecodesintheform
^[[#;#;#;...#m
.Forexample,youcancombinetheescapesequences
^[[1m
(bold)and
^[[32m
green
text)intothesequence
^[[1;32m
.Listing11-8printsafamiliarphraseinmultiplecolors.
Listing11-8 UsingANSIcolor
#!/bin/sh
printf '\e[41mH\e[42me\e[43ml\e[44;32ml\e[45mo\e[m \e[46;33m'
printf 'W\e[47;30mo\e[40;37mr\e[49;39ml\e[41md\e[42m!\e[m\n'
Note:  Forconsistentformatting,youmayaddaleadingzerotoanysingle-digitattributeescape
sequences,ifdesired.Forexample,
^[[1m
isequivalentto
^[[01m
.
Table11-2containsalistofcapabilitiesandescapesequencesthatcontroltextstyle.
Table11-2
Attributeescapesequences
Description
Escape
sequence
Terminfocapability
Resettingattributes
Resetsallattributestotheirdefaultvalues.
^[[m
or
^[[0m
me
Settingattributes
AdvancedTechniques
ShellTextFormatting
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
186
Description
Escape
sequence
Terminfocapability
Enables“bold”display.Thiscodeandcode
#2(
dim
)aremutuallyexclusive.
^[[1m
bold
Enables“dim”display.Thiscodeandcode
#1(
bold
)aremutuallyexclusive.Not
supportedinTerminal.
^[[2m
dim
Enables“standout”display.Notsupported
inTerminal.
^[[3m
so
Note:Inthe
terminfo
database
entryforTerminal,thisattributeis
mappedtoinversebecausethe
VT100“standout”modeisnot
supported.
Enablesunderlineddisplay.
^[[4m
us
<blink>.
^[[5m
blink
Note:The
terminfo
entryfor
Terminaldoesnotsupportthis
option.
Fastblinkorstrike-through.(Notsupported
inTerminal;behaviorinconsistent
elsewhere.)
^[[6m
(Noequivalent.)
Enablesreversed(inverse)display.
^[[7m
mr
Enableshidden
(background-on-background)display.
^[[8m
invis
Note:The
terminfo
entryfor
Terminaldoesnotsupportthis
option.
Unused.
^[[9m
Fontselectioncodes.Unsupportedinmost
terminalapplications,includingTerminal.
Codes
10m
19m
Clearingattributes
“Fraktur”typeface.Unsupportedalmost
universally,andTerminalisnoexception.
^[[20m
(Noequivalent.)
Unused.
^[[21m
AdvancedTechniques
ShellTextFormatting
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
187
Description
Escape
sequence
Terminfocapability
Disables“bright”or“dim”display.This
disableseithercode
1m
or
2m
.
^[[22m
se
Note:Technically,thiscapability
issupposedtoendstandout
mode,butitisoverloadedto
disableboldbright/dimmodeas
well.
Disables“standout”display.Notsupported
inTerminal.
^[[23m
se
Disablesunderlineddisplay.
^[[24m
ue
</blink>.Alsodisablesslowblinkor
strike-through(
6m
)onterminalsthat
supportthatattribute.
^[[25m
(Noequivalent.Use
me
todisable
allattributesinstead.)
Unused.
^[[26m
Disablesreversed(inverse)display.
^[[27m
(Noequivalent.Use
me
todisable
allattributesinstead.)
Disableshidden
(background-on-background)display.
^[[28m
(Noequivalent.Use
me
todisable
allattributesinstead.)
Unused.
^[[29m
Table11-3containsalistofcapabilitiesandescapesequencesthatcontroltextandbackgroundcolors.
Table11-3
Colorescapesequences
Description
Escapesequence
Terminfocapability
Foregroundcolors
Setsforegroundcolortoblack.
^[[30m
setaf 0
Setsforegroundcolortored.
^[[31m
setaf 1
Setsforegroundcolortogreen.
^[[32m
setaf 2
Setsforegroundcolortoyellow.
^[[33m
setaf 3
Setsforegroundcolortoblue.
^[[34m
setaf 4
AdvancedTechniques
ShellTextFormatting
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
188
Description
Escapesequence
Terminfocapability
Setsforegroundcolortomagenta.
^[[35m
setaf 5
Setsforegroundcolortocyan.
^[[36m
setaf 6
Setsforegroundcolortowhite.
^[[37m
setaf 7
Unused.
^[[38m
Setsforegroundcolortothedefault.
^[[39m
setaf 9
Backgroundcolors
Setsbackgroundcolortoblack.
^[[40m
setab 0
Setsbackgroundcolortored.
^[[41m
setab 1
Setsbackgroundcolortogreen.
^[[42m
setab 2
Setsbackgroundcolortoyellow.
^[[43m
setab 3
Setsbackgroundcolortoblue.
^[[44m
setab 4
Setsbackgroundcolortomagenta.
^[[45m
setab 5
Setsbackgroundcolortocyan.
^[[46m
setab 6
Setsbackgroundcolortowhite.
^[[47m
setab 7
Unused.
^[[48m
Setsbackgroundcolortothedefault.
^[[49m
setab 9
OtherEscapeSequences
Inadditiontoprovidingtextformatting,ANSIescapesequencesprovidetheabilitytoresettheterminal,clear
thescreen(orportionsthereof),clearaline(orportionsthereof),andsetorcleartabstops.
Forexample,toclearallexistingtabstopsandsetasingletabstopatcolumn20,youcouldusethesnippet
showinListing11-9.
Listing11-9 Settingtabstops
#!/bin/sh
echo # Start t on a a new line
printf "\e[19C" # # move right 19 columns s to column 20
AdvancedTechniques
ShellTextFormatting
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
189
printf "\e[3g" # # clear all tab stops
printf "\e[W" " # set a a new tab stop
printf "\e[19D" # # move back to o the left
printf "Tab b test\tThis starts at column n 20."
Table11-4containsalistofcapabilitiesandescapesequencesthatperformothermiscellaneoustaskssuchas
cursorcontrol,tabstopmanipulation,andclearingthescreenorportionsthereof.
Table11-4
Otherescapecodes
Description
Escapesequence
Terminfocapability
Resettingtheterminal
Resetsthebackgroundandforegroundcolors
totheirdefaultvalues,clearsthescreen,and
movesthecursortothehomeposition.
^[c
reset
Note:Thisresetsmanymore
thingsthan
^[c
.Itisalso
technicallynotasingle
capabilitybutratherthe
concatenationof
rs1
,
rs2
,
and
rs3
.
Clearingthescreen
Clearstothebottomofthescreenusingthe
currentbackgroundcolor.
^[[J
or
^[[0J
cd
Clearstothetopofthescreenusingthecurrent
backgroundcolor.
^[[1J
(noequivalent)
Clearsthescreentothecurrentbackground
color.Onsometerminals,thecursorisresetto
thehomeposition.
^[[2J
cl
Clearingthecurrentline
Clearstotheendofthecurrentline.
^[[K
or
^[[0K
ce
Clearstothebeginningofthecurrentline.
^[[1K
cb
—Notsupportedin
terminfo
entryfor
Terminal.
Clearsthecurrentline.
^[[2K
(noequivalent)
Tabstops
AdvancedTechniques
ShellTextFormatting
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
190
Documents you may be interested
Documents you may be interested