c# open pdf file in adobe reader : Delete pages pdf document Library SDK component .net wpf winforms mvc tlgc2extra15-part1455

22.4 PostScriptpage-manipulationtools
1
Simulation of Energy LossStraggling
MariaPhysicist
May28, 2006
Contents
1 Introduction
1
2 Landau u theory
2
2.1 Restrictions s . . . .. . . . . .. . . . . . .. . . . . .. . . . . ..
3
3 Vavilov v theory
4
4 Gaussian n Theory
5
5 Urbanmodel
5
5.1 Fast t simulationfor n16 6 .. . . . . . .. . . . . .. . . . . ..
7
5.2 Specialsamplingfor r lowerpartofthespectrum . . .. . . . . ..
9
1
Introduction
Duetothestatistical natureof ionisationenergy loss, large uctuations can
occur intheamount of energydepositedby y aparticletraversinganabsorber
element. Continuous processes suchas multiplescatteringandenergyloss play
a relevant t roleinthelongitudinal and d lateral development t of electromagnetic
andhadronicshowers, andinthecaseofsampling calorimeters themeasured
resolutioncanbesignicantlyaectedbysuch uctuations intheir activelayers.
The descriptionof f ionisation uctuations is characterisedbythesignicance
parameter , whichis proportional totheratioof mean n energy loss s to o the
maximumallowedenergytransfer inasinglecollision n withanatomicelectron
=
Emax
Emax is themaximum transferableenergyinasinglecollisionwith h anatomic
electron.
Emax =
2me2 2
1+2 me=m+(me=mx)2
;
where = E=mx, E is energyandmthemass oftheincident particle, =
1 1= andmis s theelectronmass. comes fromtheRutherfordscattering
crosssectionandis denedas:
=
2z2e4NAvZx
mec2A
= 153:4
z2
2
Z
A
x keV;
1
2
where
z
chargeof theincident particle
NAv Avogadro’s number
Z
atomicnumber of thematerial
A
atomicweight of thematerial
density
x
thickness of thematerial
measures thecontribution n ofthecollisions s withenergytransfer closeto
Emax. For agivenabsorber,tendstowards largevalues if xis largeand/or if
is small.Likewise,tends towards zeroif xissmalland/orif  approaches
1.
Thevalueof distinguishestworegimes whichoccur inthedescriptionof
ionisation uctuations:
1.A largenumber ofcollisionsinvolvingthelossofallor mostoftheincident
particleenergyduringthetraversal ofanabsorber.
As thetotal energytransfer is composedof amultitudeof smallenergy
losses,wecanapplythecentrallimit theorem anddescribethe uctuations
byaGaussiandistribution. This s caseis applicableto o non-relativistic
particles andis describedbytheinequality  >10(i.e. whenthemean
energyloss intheabsorber is greater thanthemaximumenergytransfer
inasinglecollision).
2.Particles traversingthincountersandincident electrons underanycondi-
tions.
The relevant t inequalities anddistributions are0:01< < 10,Vavilov
distribution,and <0:01, Landaudistribution.
Anadditionalregimeis denedbythecontributionofthecollisionswithlow
energytransfer whichcanbeestimatedwiththerelation n =I0, whereIis s the
meanionisationpotentialof theatom. Landautheoryassumesthatthenumber
of thesecollisions is high, and consequently,it has arestriction =I1.
InGEANT(seeURLhttp://wwwinfo.cern.ch/asdoc/geant/geantall.html),
thelimitofLandautheoryhasbeenset at =I
0
= 50. Below thislimit special
modelstakingintoaccounttheatomicstructureof thematerialareused.This
is important inthinlayers andgaseous materials. Figure1shows thebehaviour
of=Ias afunctionof thelayerthickness for anelectronof100keVand1GeV
ofkineticenergyinArgon,SiliconandUranium.
Inthe followingsections,thedierent t theories andmodels for theenergy
loss  uctuation n aredescribed. First, the Landau theoryandits s limitations
arediscussed,andthen,theVavilovandGaussianstragglingfunctions andthe
methods inthethinlayers andgaseous materials arepresented.
2 Landautheory
For aparticleofmass mtraversingathickness ofmaterial x,theLandauprob-
abilitydistributionmaybewritteninterms of theuniversal Landau u function
() as[1]:
f(;x) =
1
()
2
3
10 -2
10 -1
1
10
10 2
0 .01
0 .1
1
10
1 00
x/I
0
< 50
Argon
Silicon
Uranium
1 GeV
100 keV
1 GeV
100 keV
Ste p , [c m]
x /I
0
Figure1: Thevariable=Icanbeusedtomeasurethevalidityrangeof the
Landautheory.It depends onthetypeandenergyof theparticle, Z,Aandthe
ionisationpotentialofthematerialandthelayer thickness.
where
() =
1
2i
Z
c+i1
c i1
exp(ulnu+u)du
c0
 =
 
0  ln
Emax
=
0:422784:::= 1 
 =
0:577215:::(Euler’s constant)
 =
averageenergyloss
 =
actual energyloss
2.1
Restrictions
TheLandauformalism makes tworestrictiveassumptions:
1. Thetypicalenergyloss issmall comparedtothemaximumenergyloss in
asinglecollision. ThisrestrictionisremovedintheVavilov theory(see
section 3).
2. Thetypicalenergyloss intheabsorbershouldbelargecomparedtothe
bindingenergyofthemost tightlyboundelectron. For gaseousdetectors,
typicalenergylosses areafew keVwhichiscomparabletothebindingen-
ergiesof theinner electrons. In suchcases amoresophisticatedapproach
whichaccounts for atomicenergylevels[4] is necessarytoaccuratelysim-
ulatedatadistributions. InGEANT,aparameterisedmodelbyL.Urban is
used(seesection5).
3
4
Inaddition,theaveragevalueof theLandaudistributionis innite. . Sum-
ming theLandau uctuation obtainedto theaverageenergyfrom m thedE=dx
tables,weobtainavaluewhichis larger thantheonecomingfrom thetable.
The probabilitytosamplealarge valueis s small, soittakes alargenumber
ofsteps (extractions) for theaverage uctuationtobesignicantlylarger than
zero. Thisintroduces adependenceof theenergylossonthestepsizewhich
canaect calculations.
A solutiontothis has beentointroducealimit onthevalueof thevariable
sampledbytheLandaudistributioninordertokeeptheaverage uctuationto
0.Thevalueobtainedfrom theGLANDOroutineis:
dE=dx=  = = (  0+2+ ln
Emax
)
Inorder for this tohaveaverage0,wemust imposethat:
=    ln
E
max
Thisis realised d introducinga
max
()suchthat ifonlyvaluesof 
max
areaccepted, theaveragevalueofthedistributionis
.
A parametrict totheuniversalLandaudistributionhas beenperformed,
withfollowingresult:
max =0:60715+1:1934
+ (0:67794+0:052382
)exp(0:94753+0:74442
)
onlyvaluessmaller thanmax areaccepted, otherwisethedistributionis resam-
pled.
3
Vavilov theory
Vavilov[5] derivedamoreaccuratestragglingdistributionbyintroducing the
kinematiclimit onthemaximum transferableenergyinasinglecollision, rather
thanusingEmax = 1. Nowwecanwrite[2]:
f(;s) =
1
v
v;; 2
where
v
v;;2
=
1
2i
Z
c+i1
c i1
(s)esds
c0
(s) = = exp
(1+2 )
exp[ (s)];
(s) = = sln+(s+2)[ln(s=) ) +E1(s=)]  e s=;
and
E1(z) =
Z1
z
1etdt
(theexponentialintegral)
=
 
0 2
4
5
TheVavilovparameters aresimplyrelatedtotheLandau u parameter by
L= v= ln. . It can beshown that as  !0, the e distribution of f the
variable
L
approaches that ofLandau. . For r    0:01thetwodistributions
arealreadypracticallyidentical. Contrarytowhat manytextbooks report, the
Vavilovdistributiondoes not approximatetheLandaudistributionfor small,
but rather thedistributionof Ldenedabovetendstothedistributionof the
truefrom theLandaudensity y function. . Thus s theroutine e GVAVIVsamples
thevariableLratherthanv. For 10theVavilovdistribution tends toa
Gaussiandistribution (seenext t section).
4 Gaussian n Theory
Various con ictingforms havebeenproposedfor Gaussianstragglingfunctions,
but most oftheseappeartohavelittletheoretical or experimental basis. How-
ever, it has been shown[3] that for   10 theVavilov distribution can be
replacedbyaGaussianof theform:
f(;s)
1
q
2
(1 2=2)
exp
( )2
2
2(1 2=2)
thus implying
mean = = 
=
2
(1 2=2) ) =Emax (1 2=2)
5 Urbanmodel
Themethodforcomputingrestrictedenergylosses with-rayproductionabove
giventhreshold energyin GEANTis s a a MonteCarlomethodthat t canbeused
for thin n layers. It t is fast anditcanbeusedfor any y thickness s of amedium.
Approachingthelimitofthevalidityof Landau’s theory,theloss distribution
approaches smoothlytheLandau u form m as showninFigure2.
Itis assumedthat theatoms haveonlytwoenergylevels withbindingenergy
EandE2. Theparticle{atominteractionwillthenbeanexcitationwithenergy
loss E
1
or E
2
,oranionisation withan energyloss s distributedaccordingtoa
functiong(E) 1=E2:
g(E) =
(Emax +I)I
Emax
1
E2
(1)
Themacroscopiccross-sectionforexcitations(i =1; 2)is
=C
fi
Ei
ln(2m2 2=Ei 2
ln(2m2 2=I) 2
(1 r)
(2)
andthemacroscopiccross-sectionfor ionisation n is
3
=C
Emax
I(Emax+ I)ln(Emax+I
I
)
r
(3)
5
6
La nda u
40
20
10
5
1
0. 5
dE/d x [ Ge V/cm]     ‘
Counts
0
1 00
2 00
3 00
4 00
5 00
6 00
7 00
8 00
9 00
0
0. 01
0. 02
0. 03
0.0 4
0.0 5
0 .0 6
0 .0 7
0 .0 8
0 .09
0 .1
x  10 -4
Figure2: Energylossdistributionfor a3GeV electroninArgonas given by
standard GEANT.Thewidthofthelayers s is givenincentimeters.
Emax is theGEANTcut for -production,or themaximum energytransfer minus
meanionisationenergy,if it is smaller thanthis cut-ovalue. Thefollowing
notationis used:
r;C parameters s ofthemodel
E
i
atomicenergylevels
I
meanionisationenergy
fi
oscillator strengths
Themodelhas theparameters fi,Ei, Candr(0r 1). Theoscillator
strengths fandtheatomiclevelenergiesEshouldsatisfytheconstraints
f+f= 1
(4)
f
1
lnE
1
+ f
2
lnE
2
= lnI
(5)
Theparameter C canbedenedwiththehelpof themeanenergylossdE=dx
in thefollowingway: Thenumbersofcollisions s (ni, i =1,2for theexcitation
and3 for r theionisation)followthePoissondistributionwithameannumber
hnii.Inastepxthemeannumberofcollisions is
hnii =ix
(6)
ThemeanenergylossdE=dxinastepis thesum oftheexcitationandionisation
contributions
dE
dx
x=
"
1E1+2E+3
ZE
max
+I
I
E g(E)dE
#
x
(7)
From this,usingtheequations(2),(3), (4)and(5),onecandenetheparameter
C
C =
dE
dx
(8)
6
7
Thefollowingvalues havebeenchoseninGEANTfor theother parameters:
f=
0
ifZ 2
2=Z ifZ Z >2
)
f=1 f2
E= 10Z2eV
)
E1=
I
Ef22
1
f
1
r= 0:4
With thesevalues s theatomiclevel Ecorresponds approximatelytheK-shell
energyof theatoms and Zfthenumber of K-shell electrons. r r is s the e only
variablewhichcanbetunedfreely. Itdetermines therelativecontributionof
ionisationandexcitationtotheenergyloss.
Theenergyloss is computedwiththeassumptionthat thestep p length(or
therelativeenergyloss)issmall,and|inconsequence|thecross-sectioncanbe
consideredconstantalongthepathlength. Theenergyloss duetotheexcitation
is
E=n1E1+ n2E2
(9)
wheren
1
andn
2
aresampledfromPoissondistributionasdiscussedabove. The
loss duetotheionisationcanbegeneratedfrom thedistributiong(E) by y the
inversetransformationmethod:
u= F(E) ) =
Z
E
I
g(x)dx
E= F 1(u) ) =
I
1 u Emax
Em ax+I
(10)
(11)
whereuis auniform randomnumber betweenF(I) =0andF(Emax+ I) =1.
Thecontributionfromtheionisations will be
E
i
=
n
3
X
j=1
I
1 u
j
E
m ax
Emax+I
(12)
wheren
3
is thenumber ofionisation(sampledfrom Poissondistribution). The
energylossinastepwill thenbeE =E+Ei.
5.1
Fast simulation n forn16
If thenumber ofionisationn3is bigger than16,afaster samplingmethodcan
beused. Thepossibleenergyloss intervalisdividedin twoparts: oneinwhich
thenumber of collisions is largeandthesamplingcanbedonefrom aGaussian
distributionandtheother inwhichtheenergyloss issampledfor eachcollision.
Let us calltheformer interval [I;I] theinterval A,andthelatter[I;E
max
]
theinterval B.  lies between1 andEmax=I. . A A collisionwith aloss in the
intervalA happens withtheprobability
P()=
ZI
I
g(E)dE=
(E
max
+I)( 1)
Emax
(13)
Themeanenergyloss andthestandarddeviationfor this typeof collisionare
hE()i =
1
P()
Z
I
I
Eg(E)dE=
Iln
 1
(14)
7
8
and
2() =
1
P()
Z
I
I
E2g(E) dE= I2
ln2
( 1)2
(15)
If the e collisionnumber r is high, weassumethat thenumber of the e typeA
collisions can n becalculated from aGaussiandistribution withthefollowing
meanvalueand standarddeviation:
hnAi =
n3P()
(16)
2
A
=
n
3
P()(1 P())
(17)
It is further assumedthat theenergy y loss s inthesecollisions has a a Gaussian
distributionwith
hEAi = nAhE()i
(18)
2
E;A
= n
A
2()
(19)
Theenergyloss ofthesecollisioncanthen n besampledfrom m theGaussiandis-
tribution.
Thecollisions wheretheenergylossis intheinterval Baresampleddirectly
from
E
B
=
n
3
n
A
X
i=1
I
1 u
i
E
max
+I I
Emax+I
(20)
Thetotalenergyloss isthesumofthesetwotypes of collisions:
E =EA+EB
(21)
Theapproximationofequations (16),(17),(18) and(19)canbeusedunder
thefollowingconditions:
hn
A
i c
A
0
(22)
hnAi+ c
n3
(23)
hE
A
i c
E;A
0
(24)
wherec 4. Fromtheequations(13),(16) and(18) and d fromtheconditions
(22) and(23) thefollowinglimits canbederived:
min =
(n
3
+c2)(E
max
+I)
n3(Emax+ I)+ c2I
  max=
(n
3
+c)(E
max
+ I)
c(Emax+ I)+ n3I
(25)
This conditions gives alower limit tonumberoftheionisationsn
3
forwhichthe
fast samplingcanbedone:
n c2
(26)
As intheconditions (22),(23)and(24)thevalueofcis as minimum4, onegets
n
3
 16. Inorder tospeedthesimulation, themaximum valueis used d for r .
Thenumber of collisions withenergyloss in n theinterval B (thenumber
ofinteractions which h has s tobesimulated d directly) ) increases slowlywith h the
totalnumber of collisions n3. Themaximum numberofthesecollisionscan n be
estimatedas
n
B;max
=n
3
n
A;min
 n
3
(hn
A
 
A
)
(27)
8
9
From thepreviousexpressions forhn
A
i and
A
onecanderivethecondition
n
B
 n
B;max
=
2n3c2
n+c2
(28)
Thefollowingvalues areobtainedwith h c= = 4:
n3
nB;max
nnB;max
16
16
200
29.63
20
17.78
500
31.01
50
24.24
1000
31.50
100 27.59
1
32.00
5.2
Specialsamplingforlower part ofthe spectrum
Ifthesteplengthisverysmall( 5mmingases, 2-3m insolids) themodel
gives 0energyloss for someevents. Toavoidthis,theprobability y of0energy
loss is computed
P(E= 0)= e (hn1i+hn2i+hn3i)
(29)
Iftheprobabilityis bigger than n 0.01aspecial samplingis s done, takinginto
accountthefact thatinthesecases theprojectileinteracts onlywiththeouter
electrons oftheatom. An n energylevel E0= 10eV ischosentocorrespondto
theouter electrons. Themeannumberofcollisions canbecalculatedfrom
hni =
1
E0
dE
dx
x
(30)
Thenumberofcollisions nissampledfrom Poissondistribution. . In n thecase
ofthethinlayers, all thecollisions areconsideredas ionisations andtheenergy
loss is computedas
E =
nX
i=1
E
0
Emax
Emax+E0
ui
(31)
9
Figure22.6:Ninelogicalpagesononeoutputpage
pages.
22.4.1.3 psbook:rearrangepagesinaPostScriptfileintosignatures
psbook[-q] [-ssignature] [infile] [outfile]
psbook
takesthepagesinaPostScriptdocumentandcreatesanewfileinwhichthepagesarerearranged
as“signatures”,thesectionsinaprintedbook.Inprintingabook,anumberofpagesareprintedona
largesheetofpaper that is thenfolded and bound tomakethefinalvolume.Inmakinga booklet by
hand,itishelpfultoarrangethepagessothatwhenfoldedtheycomeoutintherightorder.eoptions
ch-psextra2.tex,v:2.27
2007/08/13
141
Delete pages pdf document - remove PDF pages in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Provides Users with Mature Document Manipulating Function for Deleting PDF Pages
copy pages from pdf to new pdf; copy pages from pdf to another pdf
Delete pages pdf document - VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Visual Basic Sample Codes to Delete PDF Document Page in .NET
delete blank page in pdf; delete pages pdf online
22
POSTSCRIPTANDPDFTOOLS
totheprogramare:
-q
Runquietly,withoutshowingthenumbersofthepagesbeingprocessed.
-ssignature
Setsignaturesize,i.e.,thenumberofsides(amultipleoffour),tobefoldedandbound
togetherintheproposedbook.Extrablankpagesareaddedtomakeuptherightnumberifneeded.
Weoncemoretakeour11-pagedocumentandwant toprintitasabookletwithasignaturesize
of4.
> psbook -s4 exa.ps exabook.ps
[4] [1] [2] [3] [8] [5] [6] [7] [*] [9] [10] [11]
Wrote 12 pages, 305508 bytes
Wenoticetheorderinwhich
psbook
outputsthepageandstheblankpage(markedwith
[*]
)itinserted
tomakeupamultipleoffour.
22.4.1.4 psselect:selectingpagesfromaPostScriptfile
psselect[-q] [-e] [-o] [-r] [-ppages] [pages] [infile] [outfile]
psselect
takesasubsetofpagesfromtheinputfileandwritesanewfile.eoptionsare:
-e
Selecteven-numberedpagesonly;thiscanbeusedinconjunctionwiththeotheroptions.
-o
Selectsodd-numberedpagesonly.
-ppages
Specifythepagestobeselected,withacomma-separatedlistof pageranges;thesecanbe
eitherasinglepagenumberorarangeoftwonumbersseparatedbyacolon(
:
).efirstorlast
numberinarangecanbeomittedanddefaultstothefirstandlastpagesinthefile.Pagenumbers
precededbyanunderscore(
_
)arerelativetotheend ofthedocument,countingbackwards. Itis
importanttorealizethatpagenumbersareabsolute,i.e.,startatoneatthestartofthedocument;
theprintedpagenumbermaybesomethingelseentirely.
-q
Runquietly.
-r
Outputtheselectedpagesinreverseorder.
Afewsimpleexamplesfollow (noticeinthethirdcommandhowthe
_
specifiercountsfromthe
backofthedocument.
> psselect -e exa.ps exaeven.ps
[2] [4] [6] [8] [10] Wrote 5 pages, 251729 bytes
> psselect -p2,5,8,11 exa.ps exa25811.ps
[2] [5] [8] [11] Wrote 4 pages, 224272 bytes
> psselect -p_1-_3,5,1 exa.ps exa11back.ps
[11] [10] [9] [5] [1] Wrote 5 pages, 223664 bytes
22.4.1.5 psmerge:mergingPostScriptfiles
psmerge[-ooutfile.ps] [file1.ps file2.ps …]
psmerge
mergesasetofPostScriptfilesintooneoutputfile.isisquiteadifficultthingtodo,andcan
reallybesuccessfulonlyifallthefilescomefromthesameapplication,sincethespecificationoffonts
142
ch-psextra2.tex,v:2.27
2007/08/13
C# PDF Page Insert Library: insert pages into PDF file in C#.net
how to merge PDF document files by C# code, how to rotate PDF document page, how to delete PDF page using C# .NET, how to reorganize PDF document pages and how
cut pages from pdf file; delete blank pages from pdf file
C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
Page Process. File: Merge, Append PDF Files. File: Split PDF Document. File: Compress PDF. Page: Create Thumbnails. Page: Insert PDF Pages. Page: Delete Existing
delete pages pdf files; delete pages out of a pdf
22.4 PostScriptpage-manipulationtools
andotherresourcestendstovaryquitewidely.eoptionsare:
-ooutfile.ps
Specifythenameoftheoutputfile.
22.4.1.6 psresize:scaleandresizePostScript
psresize[-wwidth] [-hheight] [-ppaper] [-Wwidth] [-Hheight] [-Ppaper]
[-q] [infile] [outfile]
psresize
takesaninputPostScript document,rescalesandcentersittofitondifferent-sizedpaper.e
optionsare:
-hheight
Setheightoftheoutputpage.
-Hheight
Setheightoftheinputpage.
-ppaper
Set a named paper sizeforoutput; the possibilities are
a3
,
a4
,
a5
,
b5
,
letter
,
legal
,
tabloid
,
statement
,
executive
,
folio
,
quarto
or
10x14
(thedefaultpapersizeis
a4
).
-Ppaper
Sameas
-p
butfortheinputpage.
-q
Runquietly.
-wwidth
Setwidthoftheoutputpage.
-Wwidth
Setwidthoftheinputpage.
Forinstance,ifyouneedtoprint,onaprinterwithletter-sizepaper,adocumentthatwassetupforA4
paper,youcanuseacommandlike:
> psresize -pletter -Pa4 exa.ps exaletter.ps
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
Wrote 11 pages, 310514 bytes
22.4.1.7 HandlingresourceinformationinaPostScriptfile
extractres
looksfor“resources”inaPostScriptdocumentandwritesthemtofileswiththesamenameas
theresource(withanappropriatefileextension).Conversely,
includeres
physicallyinsertsrequestedre-
sourcesintoaPostScriptdocument.Resourcesaresearchedforinthecurrentdirectoryandthesystem
defaultdirectoryundertheresourcename.
Resources are elements of a PostScript file that are commonto many different documents; the
obvious examplesarefontsand sets of PostScript procedures (procsets), but Level2PostScript also
supportsresourceslikepatternsandforms.eyarerequestedintheprologueofaPostScriptdocument
ascommentsoftheform:
%%IncludeResource
eresourcesactuallypresentinaPostScriptfileshouldbenotedinacommentoftheform
%%DocumentSuppliedResources
Atpresent,thescriptsdescribedheredonotchangesuchcomments,sotheresultisnotquiteperfect.
ch-psextra2.tex,v:2.27
2007/08/13
143
C# PDF Page Extract Library: copy, paste, cut PDF pages in C#.net
Create the new document with 3 pages. String outputFilePath = Program.RootPath + "\\" Output.pdf"; newDoc.Save(outputFilePath);
delete page on pdf file; add and remove pages from pdf file online
VB.NET PDF Page Insert Library: insert pages into PDF file in vb.
Able to add and insert one or multiple pages to existing adobe PDF document in VB.NET. Add and Insert Multiple PDF Pages to PDF Document Using VB.
delete pages of pdf preview; delete page on pdf
22
POSTSCRIPTANDPDFTOOLS
Apossibleapplicationfortheseutilitiesis torewriteadocument containingseveralcopiesofre-
sourcessothatithasjustonecopyofeachinacleanway.UsingUnixpipes,youcanperformthisjob
withacommandlike:
> extractres file1.ps | includeres > file2.ps
Youcouldalsouse
extractres
todownsizefilesforsharingwithcolleaguesbyemail,ifyouaresurethey
havethesamefontsandprocsetstore-includewhentheyreceiveyourfile.
eprogramsare:
extractres[-m]< infile.ps > outfile.ps
includeres
< infile.ps > outfile.ps
-m
Combineresourceswiththesamenameintoasinglefile.
Wecanextracttheresources
dvips
hasputinthefile
exa.ps
andthenlistthemasfollows:
> extractres -m < exa.ps >exares.ps
> grep -i Resource exares.ps
%%IncludeResource: procset tex.pro 0 0
%%IncludeResource: procset texps.pro 0 0
%%IncludeResource: procset special.pro 0 0
%%IncludeResource: font CMSY10
%%IncludeResource: font CMR8
%%IncludeResource: font CMMI12
%%IncludeResource: font CMMI5
%%IncludeResource: font CMR5
%%IncludeResource: font CMTI10
%%IncludeResource: font CMBX12
%%IncludeResource: font CMSY7
%%IncludeResource: font CMEX10
%%IncludeResource: font CMTT10
%%IncludeResource: font CMMI7
%%IncludeResource: font CMR7
%%IncludeResource: font CMMI10
%%IncludeResource: font CMR10
%%IncludeResource: font CMBX10
%%IncludeResource: font CMR12
%%IncludeResource: font CMR17
Wenotethethreeheaderfilesof
dvips
,whereitspecifiesalltheutilitydefinitionstooptimizethePost-
Scriptitgenerates, plusallthefont instances(allComputerModernfontsusedintheelevenpagesof
thedocument).
22.4.1.8 epsffit:fittingEPSfilesintoaconstrainedsize
epsffit[-c] [-r] [-a] [-m] [-s] llx lly urx ury [infile] [outfile]
epsffit
putssuitablePostScriptcodeinanEPSfiletomakeitfitintoanewboundingbox.ebounding
boxis specified inthe form
llx lly urx ury
,where
llx lly
are thexandy coordinates (in
PostScriptpoints)ofthelowerlecornerand
urx ury
oftheupperrightcorner.eoptionsare:
-a
Adjusttheaspectratiotofittheboundingbox(bydefaulttheaspectratioispreserved).
144
ch-psextra2.tex,v:2.27
2007/08/13
VB.NET PDF Page Extract Library: copy, paste, cut PDF pages in vb.
' Create the new document with 3 pages. Dim outputFilePath As String = Program.RootPath + "\\" Output.pdf" newDoc.Save(outputFilePath).
cut pages from pdf preview; delete page from pdf preview
C# Word - Delete Word Document Page in C#.NET
Delete Consecutive Pages from Word in C#. How to delete a range of pages from a Word document. How to delete several defined pages from a Word document.
delete page pdf file reader; delete page from pdf file
22.4 PostScriptpage-manipulationtools
-c
Centerimageintheboundingbox.
-m
Rotateimagetomaximizeitssizeifthatwouldfittheboundingboxbetter.
-r
Rotateimageby90degreescounterclockwise.
-s
Adda
showpage
commandattheendoftheoutputfiletoforcetheimagetoprint.
22.4.2 Addinglabelstoincludedpictureswithpsfrag
e
psfrag
packagebyMichaelGrant, CraigBarratt,andDavidCarlislesolvesa commonproblemin
graphicsfileinclusion.ItprovidesamechanismwherebyT
E
Xcanbemadetotypesetlabels,equations,
andothercomplexmaterialthatoverridethetextualelementsinaPostScriptgraphicfile.Itworksby
gettingthe PostScript interpreter to identifystrings inyouroutput file, and thenprovidingreplace-
ments.
e
psfrag
packagedefinesthecommand
\psfrag
andit allowsyouto“tag”awordinthePost-
Scriptfileatthepositionwhereyouwant LAT
E
Xmaterialtobetypeset.ereplacement forthetagin
theLAT
E
Xdocumentisdefinedbytheargumentsofthecommand.
\psfrag{tag}[posn][psposn][scale][rot]{L
A
T
E
X material}
e
tag
isreplacedbytheLAT
E
Xmaterial.efirsttwooptionalargumentsareusedtodefinehowthe
boundingboxesoftheLAT
E
XtextandthePostScripttextlineup,usingthesamesyntaxasthestandard
\makebox
command. e third and fourth optionalarguments
scale
and
rot
changethe scaling
androtationofthetypesettext.
Asanexample,considerthefollowingPostScriptfile:
%!
%%BoundingBox:100 100 172 136
1 setlinewidth
100 100 moveto
/Times-Roman findfont
12 scalefont setfont
(nabla) show
100 120 moveto
(ALPHA) show
showpage
isproduces:
nabla
ALPHA
whenprocessednormally.Ifyouputthecommand:
\psfrag{ALPHA}{$\alpha \mathcal{ALPHA}$}
\psfrag{nabla}{$\nabla$}
intheL
A
T
E
Xfilethatincludesthegraphicandrunitagain,youget:
ch-psextra2.tex,v:2.27
2007/08/13
145
C# PDF metadata Library: add, remove, update PDF metadata in C#.
C#.NET PDF SDK - Edit PDF Document Metadata in C#.NET. Allow C# Developers to Read, Add, Edit, Update and Delete PDF Metadata in .NET Project.
delete pages from pdf acrobat; cut pages from pdf reader
C# PowerPoint - Delete PowerPoint Document Page in C#.NET
C#. How to delete a range of pages from a PowerPoint document. C#. How to delete several defined pages from a PowerPoint document.
delete pdf pages online; copy pages from pdf to word
22
POSTSCRIPTANDPDFTOOLS
PSfragreplacements
a
ALPHA
Ñ
All
\psfrag
callsthatprecedean
\includegraphics
command(orequivalent)areusedforall
subsequentlyincludedPostScriptfiles.ispermitsthedefinitionof globalaswellaslocal
\psfrag
substitutions.
ismethodrequiresnoeditingofthePostScriptfile,asitisalldonebythePostScriptinterpreter;
itdoes,however,assumecertainthingsaboutthewaytextispresentedinthePostScriptoutputfroma
program.Somepackagesmaytreateveryletterofawordasaseparatestringtooutput,whileevenin
thesimpleoutputfromprogramslike
dvips
,itisnot obviouswhichwordscomethrough ascomplete
strings. For instance, while most of the words inthe following piece of PostScript are amenableto
processingby
psfrag
,severalarebrokeninunexpectedplaces:
118 w(Y)l(ellowGreen)p SpringGreen 1734 1156 V Black
104 w(SpringGreen)p OliveGreen 46 1255 V Black 85 1305
a(OliveGreen)p RawSienna 384 1255 V Black 127 w(RawSienna)p
Sepia 721 1255 V Black 179 w(Sepia)p Brown 1059 1255
V Black 226 w(Brown)p Tan 1396 1255 V Black 245 w(T)g(an)p
Gray 1734 1255 V Black 260 w(Gray)p Black Black eop
It isalsopossibletoget unwantedeffects—if you markthe string“A”asatagtobetranslatedas
α,thenalldistinctstringswhichthegeneratingprogramputsoutas“A”aretranslated.Ontheother
hand,ifyoutag“A”asαand“B”asβ,then“AB”isnottranslated.
Iftheincludedgraphicsfileistoberesizedoninclusion,itisimportanttounderstandthedistinc-
tionbetween:
\resizebox{2in}{!}{\includegraphics{file.ps}}
and(usingthe
graphicx
package):
\includegraphics[width=2in]{file.ps}
Usingthe current graphics packages drivers, intheformer case
psfrag
elements arescaled with the
drawing,and inthe latter casetheyarenot. Sinceboth sorts of behaviormaybeneeded atdifferent
times,thisistoberegardedasafeature,notaproblem.
psfrag
isprincipallyusefulinconjunctionwithfairlysimpledrawingprogramssuchas
xfig
or
idraw
andplottingpackageslike
MATLAB
or
gnuplot
.Inthelatterprograms,stringscantypicallybespecified
for axis labels ongraphs and canbe set byspecifyingunique tagidentifiers and definingthe LAT
E
X
replacements.Whenalargenumberofplotsarebeingpreparedinsomeanalysisprogram,then
psfrag
letsyouautomatetypesettingthetext.However,although
psfrag
isacleverpieceofworkthatdoesits
jobwell,itisnotidealforprocessinglarge-scale,arbitrarilycomplicatedPostScript.ePostScriptfile
shouldideallybedesignedwith
psfraginmind
.Note,also,thatsystematicuseof
psfrag
requiresagood
understandingofboththePostScriptlanguageandtheapplicationgeneratingthefigures.
22.5 ProducingPDFfrom various sources
eonlygraphicalobject which LAT
E
Xcanhandle internally is the
picture
environment, which is
veryeasytouse,butratherrestrictive.Allothergraphicalmaterialmustbeencapsulatedin
\special
commandsandlaterextractedbytheDVIprocessor,e.g.,
dvips
,andtransformedintoPostScriptcode.
146
ch-psextra2.tex,v:2.27
2007/08/13
22.5 ProducingPDFfromvarioussources
Packages like
pstricks
(and itsextensions
pst-xxxx
)and
psfrag
canproducesuch
\special
com-
mands.Unfortunately,
pdflatex
cannotworkdirectlywithPostScriptfiles.Dependingonthepresence
ofEPSgraphicsfilestobeincludedbyLAT
E
XoneormorestrategiescanbeusedtoobtainPDFoutput:
• traditional:
latex
creates aDVIfilewhich isreadby
dvips
whichcreatesaPostScriptfilewhich is
finallytranslatedintoPDFby
ps2pdf
;
• using
dvipdfm
toskipthePostScript-generatingstep;
• using
pdflatex
toskiptheDVIstepandgeneratePDFdirectly;
• usingthepackage
pst-pdf
;
• usingoneofthecommercialpackagesthathavebeenmentionedinSection22.2(e.g.,
VTeX
)and
whichgeneratePDFdirectly.
Inthissectionwefirstdescribethe
dvipdfm
and
dvipdfmx
programs, whichgeneratePDFfroma
DVIfile.enweturnour attentiontothe
pst-pdf
package, whichautomatesthe translationofEPS
images and
PSTricks
PostScript codeintoPDF.e finalpartof thesectionlooks at anexampleofa
LAT
E
XfilethatistranslatedintoPDFusingeachofthefirstfouralternativesmentionedabove.
22.5.1 eprogramsdvipdfmanddvipdfmx
Mark A. Wicks’s program
dvipdfm
(
http://gaspra.kettering.edu/dvipdfm/
)supports the
followingfeatures:
• bookmarks,nameddestinations,andannotations(manyof
AcrobatDistiller
’s
pdfmark
features);
dvips
specials;
• inclusionofMetaPostoutputandofarbitraryPostScriptfileswithhelpfromanexternalprogram;
• thumbnails(generatedby
Ghostscript
);
• arbitrary,nestedlineartransformations(includingscalingandrotation)oftypesetmaterial;
• inclusionofPDFimages,includingcroppingbysupplyingaboundingbox.
• inclusionofJPEGandPNGimages;
• acolorstackforkeepingtrackofthecurrentcolor;
• partialfontembeddingandFlatecompressiontoreducefilesize;
• balancingofpageanddestinationtreestospeedupreaderaccessforverylargedocuments.
Adetaileddescriptionofhow thesefunctionsaresupportedcanbefound intheprogramdocumen-
tation(CTAN:
dviware/dvipdfm/dvipdfm-0.13.2c.pdf
). In order to takeadvantageof these
functionswhenrunning
dvipdfm
onaDVIfileyoumustspecifythe
dvipdfm
optionwithL
A
T
E
X(and
hyperref
).
Afewyearsagotheauthorof
dvipdfm
ceasedactivedevelopment.Inthemeantime,around2001
Shunsaku Hirata had developed a variant,
dvipdfm-jpn
,for Japanese, and Jin-Hwan Cho a variant,
dvipdfm-kor
,for Korean. In2002 they decided tocombine their efforts to further enhance the Uni-
code capabilities of
dvipdfm
,addingsupport for multi-byte character encodings and large charac-
ter sets for East Asian languages by CID-keyed fonts. ey released jointlythe
dvipdfmx
program
(
http://project.ktug.or.kr/dvipdfmx/
), which also has support for manyfeatures of Hàn
ê
´
ành’spdfT
E
Xprogram.
dvipdfmx
is a must if one wants to deal with large character sets, sincealltraditionalmethods,
especiallypdfT
E
X,cannothandlethosenatively.Forinstance
dvipdfmx
letsyouextractandsearch16bit
characters.FullsupportforPostScriptType1,TrueType,butalsoOpenTypeisprovided,andifthefont
residesonthesystemonecaninstruct
dvipdfmx
nottoembedit.PDFencryptionandmultiplepagesizes
inasingledocumentarepossible.
ch-psextra2.tex,v:2.27
2007/08/13
147
22
POSTSCRIPTANDPDFTOOLS
ecommandlineoptionsof
dvipdfm
arethefollowing:
-c
Disablecolorspecials.
isoptionforcesallcolorcommandstobeignored.Usefulforprintingacolordocumenton
ablackandwhiteprinter.
-e
Disablepartialfontembedding.
Usefulforformswhichneedcompletefonts,orforPFBfilesthat
dvipdfm
cannotparse.
-f
Setfontmaplename(defaultt1fonts.map).
-l
SelectLandscape.Onlymeaningfulforpapersizesspecifiedonthecommandline.
-m number Specifyadditionalmagnicationfordocument
.
-o filename OutputPDFlename
(default
dvifile.pdf
).
-p papersize Outputpapersize
(default“
letter
”).
Possibleothervaluesare“
legal
”,“
ledger
”,“
tabloid
”,“
a4
”,and“
a3
”;
papersize
canalso
bespecifiedas
w<unit>,h<unit>
,e.g.,“
20cm,30cm
”.
-s page_ranges SelectssubsetofpagesfromtheDVIle.
Similar to
dvips
’s
-pp
option,butwith thecolonrange indicator replaced byahyphen,e.g.,
dvipdfm -s 10,21,73-92
printspages10,21and73through92.Ifthefirstpageinarange
isempty,PDFgenerationstartsatthebeginningofthedocument(
dvipdfm -s -20
),while
ifthelastpageinarangeisemptytheendofthedocumentistaken(
dvipdfm -s 97-
).
-t
Embedthumbnailimages.umbnailsmustbegeneratedbyaseparateprogram.
-d
Deletethumbnailimagesaerembedding.
-x number Horizontalosetfordocument
(default1in).
-y number Verticalosetfordocument
(default1in).
-z number zlibcompressionlevel.
number
inrange0(nocompression)to9(maximalcompression,thedefault)
-v
Verbose.Displaycompletefile
-vv
Superverbose.Displaymaximallogmessages.
Totheabove
dvipdfmx
addsthefollowingoptions:
-d number PDFdecimaldigits.number
inrange0–5(default2).
-r number Resolutionforrasterfonts.
InDPI(default600).
-C number Optionags
(default0).
Ox0001
reserved;
Ox0002
usesemi-transparent fillingfor tpic shadingcommand, instead ofopaque graycolor
(requiresPDF1.4);
Ox0004
treatallCIDFontsasfixed-pitchfonts;
Ox0008
donotreplaceduplicatefontmapentries.
PositivevaluesarealwaysORedwithpreviouslygivenflags,whilenegativevaluesreplaceoldval-
ues.
-O number Maximumdepthofopenbookmarkitems
(default0).
148
ch-psextra2.tex,v:2.27
2007/08/13
22.5 ProducingPDFfromvarioussources
-P number PermissionagsforPDFencryption
(default
0x003C
).
-S EnablePDFencryption.
-T Embedthumbnailimages.
Like
-t
,butimagefilesareremovedwhenfinished.
-V number PDFminorversion
(default3).
22.5.2 FromPostScripttoPDFwithpst-pdf
e
pst-pdf
packageusestheL
A
T
E
Xpackage
preview
,whichispartofthe
preview
[8,16]bundle.
preview
extractsall“marked”parts inaL
A
T
E
XdocumentintoaDVIfile,inwhicheachsuchpart issavedona
separatepage.ismakesiteasytoconvertthisDVIfileintoPDFformatandthenincludetheseparts
inasubsequent
pdflatex
run.
22.5.2.1 Packageoptions
active
enablestheextractionmodusofthe
preview
package;theDVIoutputcollectsonlythe
images(default);
inactive
onlythepackages
pstricks
and
graphicx
areloaded,allmacrosaredisabled;
pstricks
package
pstricks
isloaded(default);
nopstricks
package
pstricks
isnotloaded; however,ifthemacrodetectsany
PSTricks
macro,then
pstricks
willbeloadedautomaticallynevertheless;
draft
samemeaningasforpackage
graphicx
,butonlyvalidforthelast
pdflatex
run;
final
inthelast
pdflatex
modethecontainerfileisused(default);
tightpage
whitespacearoundimagesiscut(default);
notightpage
whitespacearoundimagesisnotcut;
displaymath
treats
displaymath
,
eqnarray
,
equation
,and
$$
or
\(
\)
asimages;
other
allotheroptionsarepassedtothepackage
pstricks
.
Whenyouspecifythe
inactive
optionallthe
pst-pdf
macroswillbedisabled,apartfromthetrim-
mingfunction,sothat
latex
canberunintheusualwayandPostScriptoutputcanbegenerated(with
dvips
),ifdesired.
22.5.2.2 Usage
pst-pdf
wasfirstdesignedfor
PSTricks
.isiswhyitsupportsbydefaultthe
pspicture
and
psmatrix
environments,aswellasallmacroswhicharedefinedas
\pst@object
.
pst-pdf
worksviathepackage
preview
completelyinthebackgroundandoneonlyhastoloadthepackageinthepreambleofadoc-
ument.eprocessofgeneratingaPDFfilefromaLAT
E
Xsourceconsistsoftwostages:thecreationof
thegraphics containerandthe subsequent
pdflatex
runto createthePDF.esestagesare described
next.
Creationofthegraphicscontainer
latex file.tex
Initial run of
latex
,where
preview
extracts all known objects, and saves them into
file.dvi
,whereeachobjectisonitsownpage.eDVIfilethuscreatedisofaspecial
internalformatandisunsuitedforuserpurposes,suchasviewingwithaDVIviewer.
ch-psextra2.tex,v:2.27
2007/08/13
149
22
POSTSCRIPTANDPDFTOOLS
dvips -Ppdf -o file-pics.ps file.dvi
dvips
runto convert the DVI fileto PostScript, wherethe
-Ppdf
optiontells
dvips
to
loadtheconfigfileforPDF-relatedoutput.
dvips
createsthenewfile
file-pics.ps
.
ps2pdf file-pics.ps file-pics.pdf
ps2pdf
runtoconvertthePostScriptfiletoPDF,witheachimageonaseparatepage.
Creationof thefinalPDFoutputdocument
pdflatex file.tex
Firstrunof
pdflatex
runwhere
pst-pdf
isnotactive.
bibtex file
bibtex
run.
Anyotheradditionalruns(e.g.,index,glossary).
pdflatex file.tex
Ultimate
pdflatex
run,whereallgeneratedPDFimagesareincluded.
Asimpleexamplewith
PSTricks
follows.
ThisisaPDFdocument!
The
LA
T
E
X
G
r
a
p
h
i
c
s
C
o
m
panion,
2 nd
E
d
i
t
i
o
n
\usepackage{pst-plot,pst-text}
\usepackage{pst-pdf}
This is a \textbf{PDF}--document!
\begin{pspicture}(-0.25,-2.25)(6.25,2.5)
\pstextpath[linestyle=none]%
{\psplot[linewidth=1pt,%
linestyle=dotted,%
plotpoints=300,%
xunit=0.015,%
yunit=2]{0}{400}{x sin}}
{\large The \LaTeX\ Graphics
Companion, $2^{nd}$ Edition}
\end{pspicture}%
Exa.
22-5-1
pst-pdf
provides a macro
\PreviewEnvironment
,which lets you define additional environ-
ments,which arescanned bythe
preview
package and arealso writtenasanimage intotheDVIfile.
Inthe followingexample,
PSTricks
is used to connect some nodes in a tabular. With the command
\PreviewEnvironment{tabular}
thisenvironmentisalsowrittenintotheDVIfile.ereareno
restrictionsindeclaringenvironmentsfor
preview
.
\usepackage{bigdelim,multirow,array}
\usepackage[table]{pstricks}
\usepackage{pst-node,pst-pdf}
\PreviewEnvironment{tabular}
\definecolor{Gray}{gray}{0.1}
\renewcommand\arraystretch{1.1}
\begin{tabular}{c|c|l}
\multicolumn{1}{c}{\textbf{Segment}} & \multicolumn{1}{c}{\textbf{Usage}} & \\
\multicolumn{1}{c}{\textbf{number}}
& \multicolumn{1}{c}{} & \\\cline{2-2}
0x0
& \cellcolor{gray}Kernel text and data & \\\cline{2-2}
0x1
& \cellcolor{gray}User text
& \\\cline{2-2}
0x2
& \cellcolor{red}User stack, data
& \\\cline{2-2}
0x3
& \pnode{A}
& \rdelim\}{10}{5.5cm}[\parbox{7.5cm}{Available for the user process\\
\hspace*{0.25cm}\pnode{A2}if \texttt{shmat()}or
\texttt{mmap()} is called}]\\\cline{2-2}
0x4
&
& \\\cline{2-2}
0x5
&
& \\\cline{2-2}
150
ch-psextra2.tex,v:2.27
2007/08/13
Documents you may be interested
Documents you may be interested