22.2 DVItoPostScriptdriversanddvips
Boththeselinesmap aslantedand re-encoded versionof
Utopia-Regular
(downloadedwiththe
job)to the T
E
Xname
putro8r
.e first instance uses the global
<
notationto include files, while
thesecond instanceincludestheencodingfilewiththemorespecific
<[
operator(seeitem4.above).
erefore, theonlypracticaldifferencebetweentheinstances is that
<<
(seeitem3. above)specifies
thatwewantthefile
putr8a
tobefullydownloaded,whilethefirstdeclaration(using
<
)allowspartial
downloading,ifitisrequested.Notethatfontfiles(andencodingfiles)aredownloadedonlyonceper
job,howeveroenmapfilesrefertothem.
When installing the T
E
XLive distributionallthe mappinglines for all fonts available on your
systemareenteredintothedefaultfilecalled
psfonts.map
.However,
dvips
allowsfinergranularityby
theuseofmultipleconfigurationfilesandmapfiles.Extramapfilescanbeloadedwiththe
p
command
inaconfigurationfile;thus
p new.map
establishes
new.map
astheonlysetofmappings,whereas
p +new.map
appendsthevaluesin
new.map
tothecurrentlist.erearesomesuggestionsincludedascomments
inthedefault
dvips
configurationfile(p.104ff,lines46–60).
22.2.6 Specialhooks
dvips
provides a series of “hooks” that let the user plug in code to be executed at several useful
places.ItdoesthisbydefiningfourPostScriptprocedures(
start-hook
,
end-hook
,
bop-hook
,and
eop-hook
)inthePostScript
userdict
;theseproceduresareexecutedatthestartandtheendofthe
documentandatthebeginningandtheendofeverypage,respectively.eprocedurescanberedened
inheadersaddedbythe
-h
optionorthe
\special{header=…}
command.iscodeisexecutedout-
sidethesave/restorecontextofthepage,soitcanaccumulateinformationaboutthewholedocument
(unless it isbrokeninto sections because of memoryconstraints.) edefault PostScript coordinate
systemandoriginareineffectwhenthecodeintheseproceduresisrun.
When
bop-hook
isexecuted,twovaluesareplacedonthePostScriptstack,theT
E
Xpagenumber
andthesequencenumberofthepageinthefile.For
start-hook
,thehorizontalsize,theverticalsize,
themagnification,thehorizontalandverticalresolutions(indpi),andthenameofthe
.dvi
inputfile
areputonthestack. eproceduresmustleave these parametersonthestack. eotherhookshave
novaluesonthestack.
Ifyoudouse
bop-hook
or
eop-hook
tokeepinformationacrosspages,thenthedocumentno
longer complies withtheAdobedocumentstructuringconventions,soyou shouldusethe
-N
option
toturnoffstructuredcomments.
Typicalusesofthe
bop-hook
procedurearewritingverylargewordsacrosseach page(overlay-
ingthetext)orprintingcropmark identifiers inthecornerofeach page. Forexample,ifyouput the
followingcodeintoafilecalled
secret.pro
:
userdict begin
/bop-hook{gsave
200 100 translate
65 rotate
/Times-Bold findfont 124 scalefont setfont
0 0 moveto
0.7 setgray
ch-psextra2.tex,v:2.27
2007/08/13
111
Pdf remove metadata - add, remove, update PDF metadata in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Allow C# Developers to Read, Add, Edit, Update and Delete PDF Metadata
pdf keywords metadata; batch update pdf metadata
Pdf remove metadata - VB.NET PDF metadata library: add, remove, update PDF metadata in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Enable VB.NET Users to Read, Write, Edit, Delete and Update PDF Document Metadata
online pdf metadata viewer; pdf metadata
22
POSTSCRIPTANDPDFTOOLS
SEC
RET!
SimulationofEnergyLossStraggling
MariaPhysicist
June 9,2006
Contents
1 Introduction
1
2 Landautheory
2
2.1 Restrictions s .. . .. . .. . .. . .. . .. . .. . .. . .. . . ..
3
3 Vavilov v theory
4
4 GaussianTheory
5
5 Urbanmodel
5
5.1 Fastsimulationfor r n
3
16 .. . . .. . .. . .. . .. . .. . . ..
7
5.2 Specialsamplingforlower r partof thespectrum . . .. . . .. . ..
9
1
Introduction
Due to the statistical natureofionisationenergy loss, large uctuations s can
occur intheamount of energydeposited by aparticletraversing anabsorber
element.Continuousprocesses suchasmultiplescatteringand energyloss play
arelevant rolein thelongitudinalandlateraldevelopmentofelectromagnetic
and hadronicshowers,and in thecaseofsamplingcalorimetersthemeasured
resolutioncanbesignicantlyaectedbysuch uctuationsintheiractivelayers.
Thedescriptionofionisation uctuations is characterised bythesignicance
parameter , , which is s proportional l totheratio ofmean energyloss s to the
maximumallowedenergytransfer inasinglecollisionwithanatomicelectron
=
E
max
E
max
is themaximumtransferableenergyin asinglecollision with anatomic
electron.
E
max
=
2m
e
2 2
1+2 m
e
=m
x
+(m
e
=m
x
)
2
;
where =E=m
x
,E is energyandm
x
themass oftheincident particle,=
1 1= andm
e
istheelectron mass.comesfromtheRutherfordscattering
cross section andisdenedas:
=
2z2e4N
Av
Zx
m
e
2c2A
=153:4
z2
2
Z
A
x keV;
1
SEC
RET!
where
z
chargeoftheincidentparticle
N
Av
Avogadro’s number
Z
atomicnumber ofthematerial
A
atomicweight ofthematerial
density
x
thicknessofthematerial
measures thecontribution of thecollisionswith energytransfer closeto
E
max
. Foragivenabsorber, tendstowards s largevaluesifxislargeand/orif
is small.Likewise, tendstowards zeroifxissmalland/orif approaches
1.
Thevalueof distinguishestworegimes whichoccurinthedescriptionof
ionisation uctuations:
1.Alargenumberofcollisionsinvolvingthelossofallormostoftheincident
particleenergyduringthetraversalof anabsorber.
As thetotalenergytransfer is composedof amultitudeof smallenergy
losses,wecanapplythecentrallimittheoremanddescribethe uctuations
by aGaussiandistribution. . This s case e is s applicableto non-relativistic
particles andis describedbytheinequality >10(i.e. . whenthemean
energyloss intheabsorberis greaterthanthemaximum energytransfer
inasinglecollision).
2.Particlestraversingthin countersandincidentelectronsunderanycondi-
tions.
The relevant t inequalitiesanddistributions are0:01<  < 10,Vavilov
distribution,and<0:01,Landaudistribution.
Anadditionalregimeisdenedbythecontributionofthecollisionswithlow
energytransferwhichcanbeestimatedwiththerelation =I
0
,whereI
0
isthe
meanionisationpotentialoftheatom. Landautheoryassumesthatthenumber
of these collisions is high, and consequently,it has a restriction =I
0
 1.
InGEANT(seeURLhttp://wwwinfo.cern.ch/asdoc/geant/geantall.html),
thelimitofLandautheoryhasbeen setat=I
0
=50. Belowthis s limit special
modelstakingintoaccounttheatomicstructureofthematerialareused.This
isimportantinthinlayersandgaseousmaterials. Figure1showsthebehaviour
of=I
0
as afunctionofthelayerthicknessforanelectronof100keVand1GeV
ofkineticenergyinArgon,SiliconandUranium.
In the e followingsections,thedierent t theories and models for theenergy
loss  uctuation are e described. . First, , theLandau theoryand its limitations
arediscussed,andthen,theVavilovand Gaussianstragglingfunctionsandthe
methods inthethinlayers andgaseousmaterialsarepresented.
2 Landautheory
Foraparticleofmassm
x
traversingathicknessofmaterialx,theLandauprob-
ability distribution maybewritten in terms of theuniversalLandau function
()as[1]:
f(;x) =
1
()
2
Figure22.1:Stampingpagesusing
dvips
(SECRET!) show
grestore} def end
andrunafilecalled
test.dvi
through
dvips
withthecommandline
> dvips -h secret.pro test.dvi -o test.ps
eachpagelookslikethoseinFigure22.1.
JürgenVollmer’s
draftcopy
packageusesthistechniquetoofferamoresophisticatedLAT
E
Xinterface
toaddoverlayinformationonpages;thedefaulttextcanbeindifferentlanguages(“Dra”inEnglish,
“Entwurf” inGerman, etc.), or the user can specify some other word. It also supports several DVI
driversotherthan
dvips
.
SergioCallegari’s
draftwatermark
packagetakesamorelightwightapproach,which doesnotrely
onPostScriptspecialsandisfullycompatiblewith
pdflatex
.is
draftwatermark
package,whichisbased
onthe
everypage
packagebythesameauthor,letsyouaddatextual,lightgraywatermarkoneverypage
(default)oronthefirstpageofadocumentonly,byspecifyingthe
firstpage
option,asfollows
\usepackage[firstpage]{draftwatermark}
Fivecommands, eachonetakinga singleargument,let you influencethewaythewatermarkispre-
sented.
\SetWatermarkAngleangle
realnumberspecifyingtheangleindegrees(default
45.
)at whichthewatermarktext
isdrawn;
\SetWatermarkLightnessgraylevel
realnumber specifyingthe graylevel (
1.
for white,
0.
for black, default
0.8
)of the
112
ch-psextra2.tex,v:2.27
2007/08/13
VB.NET PDF remove image library: remove, delete images from PDF in
Insert Image to PDF. Image: Remove Image from PDF Page. Image: Copy, Paste, Cut Image in Page. Link: Edit URL. Bookmark: Edit Bookmark. Metadata: Edit, Delete
adding metadata to pdf; read pdf metadata
VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.
Able to remove a single page from adobe PDF document in VB.NET. Ability to remove consecutive pages from PDF file in VB.NET. Enable
batch edit pdf metadata; acrobat pdf additional metadata
22.2 DVItoPostScriptdriversanddvips
watermarktext;
\SetWatermarkFontSizefontsize
lengthspecifyingthefontsize(default
5cm
)forthewatermarktext;
\SetWatermarkScalescale
realnumber specifyingthescalingfactor(default
1.2
)tobeappliedto thewatermark
text;
\SetWatermarkTexttext
textstringspecifyingthewatermarktexttobeprinted(default
DRAFT
).
Aneleganttricksuggestedbytheauthorof
dvips
istowriteaheaderfiledynamicallyfromacon-
figurationfilethatcangiveyou,forinstance,accesstothecurrentdate.Youcanputthefollowingcode
intoafilecalled
config.dte
:
E echo /bop-hook userdict begin \{ gsave
> date.txt
E echo
/Times-Roman findfont 10 scalefont setfont
>> date.txt
E echo
10 10 moveto \(printed on ‘date‘\) show grestore
>> date.txt
E echo
\} def end >> date.txt
h date.txt
andthensay
> dvips -R0 -Pdte test.dvi -o test.ps
towrite, atthebottomofeachpage,thedateonwhichthedocumentwentthrough
dvips
.isworks
onlyonUnixsystems(theprogrammustbeabletoexecutecommandslike
date
fromwithinitself).
Wespecifythe
R0
optiontooverridethe
z1
entry(line12inthedefaultconfigurationfile,seep.104ff),
whichwouldotherwisedisallowthe
E
optioninourconfigurationfile
config.dte
.
Asanalternative,youcanwritematerialtothePostScriptheaderareausingthe
\special{
!…
}
technique;youcanthereforerecodethelastexampleas:
\special{!
userdict begin
/bop-hook {gsave
/Times-Roman findfont 10 scalefont setfont
10 10 moveto (typeset on \today) show grestore
} def end
}
isofcoursewritesthedateonwhichthedocumentwastypeset,notputthrough
dvips
.
Anotherusefor thiskind ofhookisinprepressapplications.InusingL
A
T
E
Xand
dvips
toprepare
filmdirectlyforaprinter,youmightneedtoprintit“facedown”,asamirrorimage.efollowingcode
inaheaderfileachievesthissimplywithPostScript
translate
and
scale
operators.¹
userdict begin
/hmirror {hsize 0 translate -1 1 scale} def % horizontal mirror
/vmirror {0 vsize translate 1 -1 scale} def % vertical mirror
/bop-hook{hmirror} def % apply horizontal mirror for each page
%
/bop-hook{vmirror} def % apply vertical mirror for each page
end
¹etranslateoperatorinthehmirrormacroconsumesthevalueofthePostScriptmacrohsize,where
dvips
stores
thepagewidth.Similarly,invmirrorweusethePostScriptmacrovsizewhich
dvips
setstotheverticalpagesize.
ch-psextra2.tex,v:2.27
2007/08/13
113
C# PDF Page Delete Library: remove PDF pages in C#.net, ASP.NET
console application. Able to remove a single page from PDF document. Ability to remove a range of pages from PDF file. Free trial package
clean pdf metadata; batch pdf metadata editor
C# PDF Password Library: add, remove, edit PDF file password in C#
String outputFilePath = Program.RootPath + "\\" Remove.pdf"; // Remove password in the input file and output to a new file. int
pdf xmp metadata viewer; edit pdf metadata acrobat
22
POSTSCRIPTANDPDFTOOLS
wherez
chargeoftheincidentparticle
NAv
Avogadro’snumber
Z
atomicnumberofthematerial
A
atomicweightofthematerial
density
x
thicknessofthematerial
measures thecontributionofthecollisions withenergytransferclose to
Emax. Foragivenabsorber,tendstowardslargevaluesifxislargeand/orif
issmall. Likewise, tendstowardszero ifxissmalland/orifapproaches
1.
The valueofdistinguishestworegimeswhichoccurinthedescriptionof
ionisation uctuations:
1. A largenumberofcollisionsinvolvingthelossofall ormostoftheincident
particle energyduring the traversalofanabsorber.
As thetotal energytransferiscomposedofa multitudeofsmall energy
losses,wecanapplythecentrallimittheoremanddescribethe uctuations
bya Gaussiandistribution. . This s case is applicable to non-relativistic
particlesandisdescribedbythe inequality>10(i.e. . whenthe e mean
energylossintheabsorberisgreaterthanthemaximumenergytransfer
ina single collision).
2. Particlestraversingthincountersandincidentelectronsunderanycondi-
tions.
Therelevant inequalities anddistributions are 0:01 1 << < 10, , Vavilov
distribution, and<0:01, Landaudistribution.
Anadditionalregimeisdenedbythecontributionofthecollisionswithlow
energytransferwhichcanbeestimatedwiththe relation=I0, whereI0 isthe
meanionisationpotentialoftheatom.Landautheoryassumesthatthenumber
ofthese collisionsishigh, , and consequently, , ithasa a restriction =I0 0  1.
InGEANT(seeURLhttp://wwwinfo.cern.ch/asdoc/geant/geantall.html),
thelimitofLandautheoryhasbeensetat=I0=50. Below thislimitspecial
modelstaking into accounttheatomicstructureofthematerialareused. This
isimportantinthinlayersandgaseousmaterials. Figure1 showsthe behaviour
of=I0asa functionofthelayerthicknessforanelectronof100 keVand1GeV
ofkineticenergyinArgon, SiliconandUranium.
Inthefollowing sections, the dierent t theories and modelsforthe energy
loss uctuationare described. . First, , the e Landau u theory andits limitations
arediscussed,andthen,the VavilovandGaussianstragglingfunctionsandthe
methodsinthethinlayersandgaseousmaterialsarepresented.
2
Landautheory
Foraparticleofmassmxtraversingathicknessofmaterialx,theLandauprob-
abilitydistributionmaybe writtenintermsofthe universal Landaufunction
()as[1]:
f(;x)
=
1
()
2
erehw
elcitraptnedicni ehtfo o charge
vAN
rebmuns’ordagovA
Z
l aireta mehtforebmunci i atom
A
l aireta mehtfothgiewci i atom
ytis den
x
laireta mehtfosse e thickn
otesolcrefsnart ygrene hti i wsnoisilloc ehtfo noitubirtnoc ehtserusaem
fi ro/dnaegralsi xfi seul avegral sdrawotsdnet,rebrosbanevi garoF.xamE
sehcaorppa fi ro/dnalla mssi i xfi orezsdrawotsdnet ,esi i weki L.ll amssi i 
1.
fo noitpircsedeht t ni i rucco hci hwsemi ger owt t sehsiugnitsi i dfoeulavehT
:snoitautcu noitasi ion
tnedicni ehtfotsomrollafossol ehtgnivlovnisnoisillocforebmunegral l A 1.
.rebrosba nafolasrevarteht t gnirudygrene e particle
ygrenella msfo edutitl umafo desopmocsi i refsnart ygrenelatot ehtsA
snoitautcu ehtebircseddna meroehtti millartnecehtylppanace e losses,w
citsi vitaler-nonot t el l bacil ppa si i esacsihT T .noitubirtsi dnaissua Ga a by
nae meht nehw.e.i( 01 1 ytilauqenie e hty y bdebircsedsid nap p articles>
refsnart ygrene e mumixa a meht t nahtretaerg g si rebrosba ehtni ssol y y energ
.)noisillocelgnisa in
-i dnoc ynarednusnortceletnedicni dnasretnuocni ht t gnisrevartselcitraP P 2.
.sn tio
voli vaV,01 1 1 0:0er r asn oitubirtsiddnase itilauqenitn avelereh T<<
.noitubirtsiduadnaL,10:0 dna,noitud d istrib<
wol hti wsnoisillocehtfonoitubirtnocehtybdenedsi i emi gerl anoitiddanA
ehtsi 0I erehw,0I= noitalereht t hti i wdetamitseebnac hcihwrefsnart t energy
rebmunehttahtsemussayroeht uadnaL. motaehtfolaitnetopnoitasi i noi nae m
.1 0I=  noitcirtser a sahti i ,yltneuqesnoc c dna, hgihsi i snoisilloc c eseht t of
,)lmth.llatnaeg/tnaeg/codsa/hc.nrec.ofniwww//:ptthLRUees( TNAEG In
laicepsti mil l siht woleB.05 =0I=tates s neebsahyroeht uadnaLfo ti mil l the
sihT. desueralairetamehtfo erutcurts ci mota ehttnuocca otni gnikatsledo m
ruoivahebehtswohs1 erugi F.slaireta msuoesagdnasreyal ni ht t ni i tnatropmi i is
VeG1dna Vek001fo nortcelenarofssenkcihtreyal ehtfonoitcnufasa0I=  of
. muinarUdna nociliS, nogrAni ygrene citenik k of
ygrene ehtrofsledomdnaseiroehttnereideht,snoitces gni wollof f eht t In
snoitati mil sti i dna a yroeht t uadnaLeht,tsri i F . debircsedera a noitautcu    loss
eht dnasnoitcnuf gnilggartsnaissuaGdna a volivaVeht,neht t dna,dessucsid d are
. detneserperaslairetamsuoesagdnasreyal nihteht t ni i sdohte m
2
yroeht uadnaL
-borpuadnaLeht,xlaireta mfossenkcihtagnisrevartx mssamfoelcitrapar r Fo
noitcnuf uadnaLl l asrevinuehtfo smret t ni i nettirwebyamnoitubirtsi i dytili i ab
:]1[sa)(
) f(;x
=
1
)( 
2
(a)
(b)
Figure22.2:Mirror-imageprintingwith
dvips
.
eeffectofapplyingthisheaderfileisshowninFigure22.2(a).Asimplechange(executing
vmirror
insteadof
hmirror
inthe
bop-hook
definitionbycommentingoutline4andactivatingline5above)
mirrors with respect to thehorizontalaxis (Figure22.2(b)). InLevel 2PostScript this mirror effect,
andthewhite-on-blackeffectalsoneededinprinting,aredirectlysupportedwiththe
setpagedevice
command[see2,p.679].ismeansyouneedmerelyinsertthefollowingcodeinthePostScriptpream-
ble:
<< /MirrorPrint true >> setpagedevice
togetmirroring,and
<< /NegativePrint true >> setpagedevice
togetblackonwhite.Unfortunately,notallPostScriptimplementationssupportthisyet,whereashigh-
endphototypesetters,forwhichthesefunctionsareimportantwhenprintingtofilm,mostoendo.
Ourfinalexampleshowshowtodisplaythecurrentpagenumberasonoverlayoneachpage.
1
userdict begin
2
/mystring 20 string def
3
/center {% stack: string to be centered
4
dup stringwidth pop 2 div neg 0 rmoveto
5
} bind def
6
/bop-hook{% stack: page-number page-sequence-number
7
gsave
114
ch-psextra2.tex,v:2.27
2007/08/13
C# PDF bookmark Library: add, remove, update PDF bookmarks in C#.
Ability to remove and delete bookmark and outline from PDF document. Merge and split PDF file with bookmark. Save PDF file with bookmark open.
remove pdf metadata online; endnote pdf metadata
C# PDF remove image library: remove, delete images from PDF in C#.
Insert Image to PDF. Image: Remove Image from PDF Page. Image: Copy, Paste, Cut Image in Page. Link: Edit URL. Bookmark: Edit Bookmark. Metadata: Edit, Delete
preview edit pdf metadata; pdf xmp metadata editor
22.2 DVItoPostScriptdriversanddvips
8
/Helvetica findfont 550 scalefont setfont
9
hsize 2 div 200 moveto
10
0.9 setgray
11
exch dup mystring cvs center show exch
12
grestore} def
13
end
Aerdeclaringthestringvariable
mystring
(line2)afunction,
center
,isdefinedwhich calculates
thehorizontaloffsetneededtocenterthestringitreceivesonitsstack(lines3–5).Asalreadymentioned,
dvips
putstheLAT
E
Xpagenumberandpagesequencenumberonthestackbeforeexecuting
bop-hook
.
erefore,aersettingthefonttoHelvetica(line8)anddefiningthegraylevel(line9)wearereadyto
addtheL
A
T
E
Xpagenumberasanoverlayoneachpage(line10).erefore,wefirsthavetogetholdof
thesecondentryonthestack(thepagenumberinquestion)andmoveittothetopofthestack(
exch
),
duplicateit(
dup
),sincewehavetoleavethestackuntouched,convertthenumbertoastring(
cvs
)that
isstoredin
mystring
,whichwecenter(
center
)andshownontheoutputmedium(
show
).Finally
thestackisputbackinthecorrectorder(
exch
,whichundoestheeffectofthefirstsuchcommandat
thebeginningofline10).WeusedthisheaderfiletopreparethePostScriptfilethatwasusedtocreate
Figure22.6onpage141.
Color separations(e.g., makingfour separate instances of eachpage,correspondingtothebase
colorstobeprinted infour-color mode)canalsobemadewith the
bop-hook
procedure. However,
dvips
makesnoprovisionforcheckingthecontentoraccumulatingcommands.ereforeifyouwant
tocombineseveraleffects,e.g.,write“SECRET!”oneach pageandprintcropmarks,youcannotjust
loadtwoheaderfilesinsuccession,butyou mustwritemoresophisticatedPostScriptcode. Bogusław
Jackowskihascontributedinthe
macros/generic/TeX-PS
directoryonCTANafewexamplefiles
whereheshowshowtocombinesuchcomplextasks.
22.2.6.1 Conversionbetweencolormodels
It is possible to convert between color models by placing the relevant PostScript code inside a
\special
command to be included just before starting composing the body of the document
(
\AtBeginDocument
command).efollowingexampleshowshowtotransformvariouscolormod-
elsintograylevels[2,Section7.2ConversionamongDeviceColorSpaces,p.473].
1
\AtBeginDocument{%
2
\special{ps:
3
/setcmykcolor { exch 0.11 mul add
4
exch 0.59 mul add
5
exch 0.3 mul add
6
dup 1 gt { pop 1 }
if neg 1 add setgray } def
7
/setrgbcolor
{ 0.11 mul
8
exch 0.59 mul add
9
exch 0.3 mul add setgray } def
10
/sethsbcolor
{ /b exch def
/s exch def 6 mul dup cvi dup
11
/i exch def sub /f exch def
12
/F [[0 1 f sub 1][f 0 1][1 0 1 f sub][1 f 0]
13
[1 f sub 1 0][0 1 f][0 1 1]] def
14
F i get { s mul neg 1 add b mul} forall
15
0.11 mul
16
exch 0.59 mul add
17
exch 0.3 mul add setgray } def
18
}
19
}
ch-psextra2.tex,v:2.27
2007/08/13
115
C# TIFF: TIFF Metadata Editor, How to Write & Read TIFF Metadata
You can also update, remove, and add metadata. List<EXIFField> exifMetadata = collection.ExifFields; You can also update, remove, and add metadata.
get pdf metadata; pdf metadata viewer
VB.NET PDF delete text library: delete, remove text from PDF file
projects. Basically, you can use robust APIs to select a PDF page, define the text character position, and remove it from PDF document.
adding metadata to pdf files; c# read pdf metadata
22
POSTSCRIPTANDPDFTOOLS
22.2.7 Debugging
Youcanusethe
-d
optionof
dvips
fortrackingdownerrorsandunderstandingwhatisgoingon.You
mustsupplyanintegerspecifyingtheclassofinformationtobedisplayed,asfollows:
1 specials
4
fonts
16 headers
64
files
2 paths
8
pages
32 fontcompression
128 memory
Togetseveraltypesofinformation,simplyaddthenumbers together forthetypes youareinterested
in.Avalueof
-1
selectsthemall.Forexampleifyoucall
dvips
withtheoption
-d 4
yougetsomething
likethis:
> dvips -d4 -n1 exadvips
This is dvips(k) 5.95b Copyright 2005 Radical Eye Software (www.radicaleye.com)
’ TeX output 2006.05.28:1655’ -> exa.ps
Defining font () cmr17 at 17.3pt
Font cmr17 <CMR17> is resident.
Defining font () cmr12 at 12.0pt
Font cmr12 <CMR12> is resident.
Defining font () cmbx12 at 14.4pt
Font cmbx12 <CMBX12> is resident.
Defining font () cmbx10 at 10.0pt
Font cmbx10 <CMBX10> is resident.
Defining font () cmr10 at 10.0pt
Font cmr10 <CMR10> is resident.
Defining font () cmmi10 at 10.0pt
Font cmmi10 <CMMI10> is resident.
Defining font () cmr7 at 7.0pt
Font cmr7 <CMR7> is resident.
Defining font () cmsy10 at 10.0pt
Font cmsy10 <CMSY10> is resident.
Defining font () cmmi7 at 7.0pt
Font cmmi7 <CMMI7> is resident.
<tex.pro><texps.pro><special.pro>. <cmmi7.pfb><cmsy10.pfb><cmr7.pfb>
<cmmi10.pfb><cmr10.pfb><cmbx10.pfb><cmbx12.pfb><cmr12.pfb><cmr17.pfb>[1]
isshowswhichfontsareneededforandhowtheyaredereferenced(herePostScriptType1versions
oftheCMfontsareincludedintheoutputfileanddownloadedwiththejob).
22.3 Ghostscript,aPostScriptinterpreter
Aladdin
Ghostscript
(
http://www.cs.wisc.edu/~ghost/
)is a freelyavailable PostScript inter-
preterwrittenbyL.PeterDeutsch.Itcanbeusedforvariouspurposes:
• PreviewingPostScriptcode.
Ghostscript
displays your PostScript or PDF onscreen(supportinga
widevarietyofdevices), makingpossiblefastcheckingofyour drawingsbeforesendingthemto
aprinter;moresophisticated interfaces existonLinux, MacOSX, andMicrosoWindows(see
Section22.3.4).
• Preparingoutputforvariousprintingdevices.e
Ghostscript
program comes with a large set of
drivers,soPostScript codecanbetransformedintoaformatthatisunderstood bymost printers
(seeSection22.3.3).
116
ch-psextra2.tex,v:2.27
2007/08/13
22.3 Ghostscript,aPostScriptinterpreter
• Convertingintorasterformats.
Ghostscript
canconvertPostScriptintomanydifferentrasterformats,
suchasTIFF,PBM,andPNG(seeSection22.3.3).
• ManipulatingPostScript.
Ghostscript
performs various helper tasks, such as extractingtext from
PostScriptfiles,calculatingtheboundingboxofanEPSfile,andconvertingPostScriptinto
Adobe
Illustrator
format(seeSection22.3.5).
• Multi-platformPDFreader.
Ghostscript
readsPDF(PortableDocument Format)files, sothat you
canview Acrobat files(seeSection22.3.4).
Ghostscript
can“distill”PostScriptcodeinto PDF, or
generatePostScriptfromPDF(seeSection22.3.5).
e source code of
Ghostscript
is mostlywritten in C and can be freely downloaded from the
Internet and installed. Versions are available for all current computer platforms. How to start and
use
Ghostscript
dependsslightlyontheoperatingsystem.¹Nevertheless, thecommand-linetoinvoke
Ghostscript
isessentiallythesame onallsystems, althoughthenameof theexecutableprogramitself
maydiffer.Forinstance,toinvoke
Ghostscript
onUnix-likesystemstype:
gs [options] file1 ... [options] fileN ...
iswillreadeachofthefilesandexecutethePostScriptcommandscontainedinthem.Dependingon
theoptions, theresult maybedisplayedonscreen,passed tosomeotherprocess, or writtentoa file.
Whenallfileshavebeenread, theprogramnormallypromptsforfurtherkeyboardinput. Toexitthe
interpreter,enterthecommand
quit
.
einterpreterrecognizesmanyoptions.Anoptionmayappearanywhereinthecommandline,
andappliestoallfilesnamedaeritontheline.Manyoftheminclude“
=
”followedbyaparameter.e
most importantaredescribed here.For acompletedescriptionseethefile
Use.htm
,whoselocation
onyoursystemisindicatedattheend oftheoutputgeneratedbytypingthecommand
gs -h
,which
displaysasummaryof theavailabledevicesonagiveninstallation,aswellasashort overview of the
syntax.
> gs -h
AFPL Ghostscript 8.51 (2005-04-18)
Copyright (C) 2005 artofcode LLC, Benicia, CA.
All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
-dNOPAUSE
no pause after page
| -q
‘quiet’, fewer messages
-g<width>x<height>
page size in pixels
| -r<res>
pixels/inch resolution
-sDEVICE=<devname>
select device
| -dBATCH
exit after last file
-sOutputFile=<file> select output file: - for stdout, |command for pipe,
embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
Default output device: x11
Available devices:
bbox bit bitcmyk bitrgb bj10e bj200 bjc600 bjc800 bmp16 bmp16m bmp256
bmp32b bmpgray bmpmono bmpsep1 bmpsep8 cdeskjet cdj550 cdjcolor cdjmono
cljet5 cljet5c deskjet devicen djet500 epswrite faxg3 faxg32d faxg4 ijs
jpeg jpeggray laserjet lj5gray lj5mono ljet2p ljet3 ljet3d ljet4 ljet4d
ljetplus nullpage pbm pbmraw pcx16 pcx24b pcx256 pcxcmyk pcxgray pcxmono
pdfwrite pgm pgmraw pgnm pgnmraw pj pjxl pjxl300 pkm pkmraw pksm pksmraw
png16 png16m png256 pngalpha pnggray pngmono pnm pnmraw ppm ppmraw
¹Itisbeyondthescopeofthisbooktocoverhow
Ghostscript
isobtained,installed,possiblycompiled,andsetup;omas
Merz’excellentbookonPostScriptandPDF[14]hasadetailedappendixthatshouldanswermostquestions;the(nowsome-
whatoutdated)
Ghostscript
chapterisfreelyavailableattheURLhttp://www.cs.wisc.edu/~ghost/doc/merz.htm.
ch-psextra2.tex,v:2.27
2007/08/13
117
22
POSTSCRIPTANDPDFTOOLS
psdcmyk psdrgb psgray psmono psrgb pswrite pxlcolor pxlmono spotcmyk
tiff12nc tiff24nc tiff32nc tiffcrle tiffg3 tiffg32d tiffg4 tiffgray
tifflzw tiffpack tiffsep uniprint x11 x11alpha x11cmyk x11gray2 x11gray4
x11mono xcf
Search path:
. : /usr/local/share/ghostscript/8.51/lib :
/usr/local/share/ghostscript/8.51/Resource :
/usr/local/share/ghostscript/fonts
For more information, see /usr/local/share/ghostscript/8.51/doc/Use.htm.
Report bugs to bug-gs@ghostscript.com, using the form in Bug-form.htm.
Notethepathsforresources,fonts,anddocumentationprintedattheendoftheoutput.iswillhelp
youlocatethefilesreferencedinthissection.
22.3.1 Ghostscriptoptionsandinitialization
e
Ghostscript
command-lineoptionsperformthreefunctions:theyletyousupplyfilestorun,change
options,andgivevaluestovariousPostScriptobjectsthatcanbeaccessedbytheprogramoryourfiles.
egeneralstructureoftheoptionsisasfollows:
@filename
Readfile
filename
andtreat itscontents asiftheyweretypedonthecommand line.
eoptionsorfilenamesinthefilecanbeonseverallines.
--filename arg1 …
and
-+filename arg1 …
Interpretlenameas normalbut takeallremainingargumentsand write them inthe
PostScript
userdict
asanarrayofstringscalled
ARGUMENTS
.
-@filename arg1 …
Asprevious,butexpand
@filename
arguments.
-c token …
and
-c string …
Interpret the arguments, up to the next argument that begins with
-
followed by a
non-digit or with
@
,as PostScript code. You can use this, for instance, to force exe-
cutionof a PostScript
showpage
at the end of a file
picture.ps
bythe command
gs picture.ps -c showpage
.Morecommonly,commandlinesareendedwith
-
c quit
tomake
Ghostscript
quitaerthefilesarefinished.
-Dname=value
and
-dname=value
Defineanamein
systemdict
withthegivenvalue,whichmustbeavalid PostScript
token.Ifnovalueissupplied,itissetto
true
.
-ffilename
Runthefile,evenifitsnamebeginswith a
-
oran
@
.
-f
byitself doesnothing, butit
canbeusedtoendasetof
-c
options.
-gn1xn2
Specifiesthewidthandheightoftheoutputdeviceinpixels(equivalenttothetwoop-
tions
-dDEVICEWIDTH=n1
and
-dDEVICEHEIGHT=n2
).
-Idirectories
Addthelistofdirectoriestothefrontofthesearchpathforsystemfiles;directories
areseparatedby“
:
”(Linux)or“
;
”(MicrosoWindows).
-P
Lookfirstincurrentdirectoryforsystemfiles(thisisthedefault).
-P-
Donotlookfirstincurrentdirectoryforsystemfiles.
-q
Runquietly,withnostartupmessages.
-rn1xn2
and
-rnb
(equivalentto
-rnbxnb
)
118
ch-psextra2.tex,v:2.27
2007/08/13
22.3 Ghostscript,aPostScriptinterpreter
Sets the resolution of the output device, e.g., a printer with varyingresolution, or a
bitmap file. e second simpler alternative is the more common one, whereas the
more generic first form allows you to handle printingdevices that have differentx
andy resolutions.It hasthesame effectas using
-dDEVICEXRESOLUTION=n1
and
-
dDEVICEYRESOLUTION=n2
.
-Sname=string
and
-sname=string
Definesanamein
systemdict
withthegivenstringasvalue.¹
-uname
Undefineaname,cancelling
-d
or
-s
.
-
Tell
Ghostscript
thatthestandardinputiscomingfromafileorapipe.
Ghostscript
reads
from
stdin
untilreachinganend-of-file,executingitlikeanyotherfile,andthencon-
tinuesprocessingthecommandline.Attheendofthecommandline,
Ghostscript
exits,
ratherthangoingbacktoaninteractiveprompt.
22.3.1.1 Parameterswitches
-d
and
-s
eparameterswitches
-d
and
-s
defineinitialvalues forPostScriptnames. eycanbe parameter
namesthatcontroltheinterpreterorthegraphicsengine,buttheycanalsodefineavalueforanyde-
viceparameteroftheinitialdevice(definedwith
-sDEVICE=
).Inthefollowingwedescribethemore
importantparameters.Acompletelistcanbefoundinthedocumentationfile
Use.html
.
Renderingparameters
-dCOLORSCREEN
,
-dCOLORSCREEN=0
,
-dCOLORSCREEN=false
Force the use of separate halone screens on devices with a resolution over 150
dpi;
-dCOLORSCREEN=0
usesseparatescreenswiththesame frequencyandangle;
-
dCOLORSCREEN=false
forcestheuseofa singlebinaryscreen.edefaultbehavior
is to use separate screens with different angles if thedevicehas fewerthan5bits per
color,andasinglebinaryscreenotherwise.
-dDITHERPPI=lpi
Forcesalldevicestobeconsideredhigh-resolution,andforcesuseofahalone
screenorscreenswith
lpi
linesperinch,disregardingtheactualdeviceresolution.
-dDOINTERPOLATE
and
-dNOINTERPOLATE
efirstoptionturnsonimageinterpolationforallimages,improvingimagequality
for scaledimagesatthe expenseofspeed, while thesecond, turnsinterpolationoff.
-
dNOINTERPOLATE
overrides
-dDOINTERPOLATE
ifbotharespecified.
-dTextAlphaBits=n
and
-dGraphicsAlphaBits=n
eseoptionsshouldbeusedtoguaranteehighqualityrasterizationsbycontrolingthe
useofsubsampleantialiasingfortextandgraphics,whichareenabledseparately.Ideally,
thesubsamplingboxsize
n
shouldbe4for optimum output, but smallervalues(1or
2) canbeusedforfaster rendering.Inparticularwhenstrange lines are encountered
withinsolidareas,tryrenderingthatfileagainwith
-dGraphicsAlphaBits=1
.
-dAlignToPixels=n
Choosesglyphalignmenttointegralpixelboundaries(value1)ortosubpixels
(value0,thedefault).elattercorrespondstotheuseinternallyofasmallerrastergrid
for text antialiasing. Setting
-dAlignToPixels=0
can improve renderingof poorly
hintedfonts,butmayimpairtheappearanceofwell-hintedfonts.
¹edifferencebetween this and-d isthatthevalueis aPostScriptstring, notatoken.For instance,the option“-d
myvar=123”writes“/myvar 123 def”,whereas“-s myvar=123”writes“/myvar (123) def”.
ch-psextra2.tex,v:2.27
2007/08/13
119
22
POSTSCRIPTANDPDFTOOLS
-dUseCIEColor
Sets
UseCIEColor
in the page device dictionary, remappingdevice-dependent
colorvaluesthroughaCIEcolor space.iscanimproveconversionofCMYKdocu-
mentstoRGB.
-dNOSUBSTDEVICECOLORS
Prevents the substitution
of the
ColorSpace
resources
(
DefaultGray
,
DefaultRGB
, and
DefaultCMYK
) for the
DeviceGray
,
De-
viceRGB
,and
DeviceCMYK
color spaces. is switch is primarily useful for PDF
creationusingthepdfwritedevicewhenretaining thecolor spacesfromthe original
documentisimportant.
Pageparameters
-dFIXEDMEDIA
Fixthemediasizeaerinitialization,forcingpagesofothersizesororientationsto
beclipped.Impliedbythe
-g
option.
-dFIXEDRESOLUTION
Fixmediaresolutionaerinitialization.Impliedbythe
-r
option.
-dDEVICEWIDTHPOINTS=w
and
-dDEVICEHEIGHTPOINTS=h
Set the initial page width and height to
w
and
h
,respectively (units are PostScript
points).
-sDEFAULTPAPERSIZE=a4
Replacethedevicedefaultpapersizewith
a4
(seeTable22.1onpage124
foralistofknownpapersizes).
Font-relatedparameters
-dNOFONTMAP
Suppressthenormalloadingofthe
Fontmap
file.
-dNOFONTPATH
Donotconsultthe
GS_FONTPATH
environmentvariable.
-dNOPLATFONTS
Disabletheuseoffontssuppliedbytheunderlyingplatform(XWindowsorMi-
crosoWindows).
-sFONTMAP=fn1;fn2;...
Specifyoneormorealternatenamesforthe
Fontmap
file(onLinuxthe
separatorbetweenthefilenamesis“
:
”).
-sFONTPATH=dir1;dir2;...
Specifya list of directories to be scanned whenlooking for fonts
not found onthe search path (onLinuxthe separator betweenthe filenames is “
:
”).
Overridestheenvironmentvariable
GS_FONTPATH
.
-sSUBSTFONT=fontname
Substitute
fontname
for allunknownfonts;
Ghostscript
normallytries
tofindasuitablefont,andusesCourierasalastresort.
Resource-relatedparameters
-sGenericResourceDir=path
Specifypath togenericresourcefiles(Default
./Resource/
on
Linux,andanequivalentoneonotherplatforms).
-sFontResourceDir=path
Specifypathtofontresourcefiles(Default
./Font/
onLinux,andan
equivalentoneonotherplatforms).
Interaction-relatedparameters
-dBATCH
Exit aer processing allfiles named on the command line (equivalent to endingthe
commandlinewith
-c quit
).
120
ch-psextra2.tex,v:2.27
2007/08/13
Documents you may be interested
Documents you may be interested