c# open pdf file in adobe reader : Copy pages from pdf to word Library application class asp.net html winforms ajax tlgc2extra13-part1453

22.3 Ghostscript,aPostScriptinterpreter
-dNOPAGEPROMPT
Disableprompt,butnotpause,attheendofeachpage.
-dNOPAUSE
Disable prompt and pause at theend of each page. Normallythis isused alongwith
-dBATCH
todirectoutputtoaprinterorafile.
-dNOPROMPT
Disableprompt whenexpectinginteractiveinput, aswellasthe end-of-pageprompt
(
-dNOPAGEPROMPT
).Usefulforpipinginputdirectlyinto
Ghostscript
.
-dQUIET
Suppressmessagesonstandardoutput.
-sstdout=filename
Redirect PostScript
%stdout
to a file or
stderr
,to avoid it beingmixed
with device
stdout
,i.e.,
-sstdout=%stderr
redirects
stdout
to
stderr
,while
-
sstdout=%stdout
or
-sstdout=-
cancelredirection.
-dTTYPAUSE
Readacharacterfrom
/dev/tty
,ratherthanstandardinput,attheendofeachpage.
Usefulifinputcomesfromapipe(
-dTTYPAUSE
overrides
-dNOPAUSE
).
Deviceandoutputselectionparameters
-dNODISPLAY
Initialize
Ghostscript
withanulldevice(adevicethatdiscardstheoutputimage)rather
thanthedefault deviceorthedeviceselectedwith
-sDEVICE=
.Usefulwhenrunning
PostScriptcodewhosepurposeistocomputeratherthantodisplay,e.g.,whenconvert-
ingPostScripttoPDForcalculatingaboundingbox(seeSection22.3.5).
-sDEVICE=device
Defineanalternateinitialoutputdevice(seeSection22.3.3).
-sOutputFile=filename
Selectanalternateoutput file(orpipe)for theinitialoutputdevice, as
describedabove.
EPSparameters
-dEPSCrop
CropanEPSfiletotheboundingbox.UsefulwhenconvertinganEPSfiletoabitmap.
-dEPSFitPage
ResizeanEPSfiletofitthepage.UsefulforenlarginganEPSfiletofitthepapersize
whenprinting.
Otherparameters
-dDOPDFMARKS
Use
pdfmark
forbookmarks,annotations,linksandcropboxwhenprocessingPDF
files.
-dSAFER
StopthePostScript
deletefile
and
renamefile
operatorsfromworking,disallow
theabilitytousepipedcommands,anddonotallowfilestobeopenedforwriting(apart
from
%stdout
and
%stderr
).It issensibleto set this wheninterpretingdocuments
whichdonotoriginatewithatrustedparty.
When
Ghostscript
starts,itneedstofindasetofinitializationfiles(muchoftheinterpreter’sfunc-
tionsarewritteninPostScriptitselfandloadedwhentheprogramstarts).Normally,theprogramisset
uptolookinthecurrentdirectoryforyourfilesandinasystemdirectoryfortheprogramfiles,butyou
mayneedtooverridethis.Youcanaskforextradirectoriestobesearchedbyusingthe
-I
optionon
thecommandline;oryoucansetanenvironmentvariable
GS_LIB
topointtodirectories.Directories
canbespecifiedasalist,separatedby“
:
”(Linux)or“
;
”(MicrosoWindows).
ch-psextra2.tex,v:2.27
2007/08/13
121
Copy pages from pdf to word - remove PDF pages in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Provides Users with Mature Document Manipulating Function for Deleting PDF Pages
delete pages in pdf; delete pages from pdf file online
Copy pages from pdf to word - 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 pdf pages in reader; delete pdf page acrobat
22
POSTSCRIPTANDPDFTOOLS
22.3.2 Ghostscriptandfonts
Inadditiontoitssystemfiles,
Ghostscript
needs tofindfonts. Unlikemost PostScript printers,itnor-
mallyhas no built-in fonts at all,but loadseverything as PostScript Type1or TrueType fonts from
yourdisk.
Ghostscript
comeswithabasicsetof35fontstomatchthosefoundinmostPostScriptprint-
ers.esearegood-qualityType1PostScriptfontsmadefreelyavailablebytheGermanfontcompany
URW.Itstartsbylookingforafilecatalogcalled
Fontmap
(youcanchangethenamewith
-sFONTMAP
)
amongthesystemfiles.isfilespecifieshowtorelatePostScriptfontnamestoactualfilesonthesys-
tem.Itthensearchesanyofthedirectoriesspecifiedwith the
GS_FONTPATH
environmentvariableor
-sFONTPATH
optionforfiles that appear tocontainPostScript fonts.Ifitdecides that theyarevalid
fonts,
Ghostscript
addsthosefilesandfontstoitsinternalcopyofthe
Fontmap
catalog.
Whenyour files areread, font requests are satisfied usingthe
Fontmap
catalog; if no match is
found, the default font isused. If onyour system other PostScript Type1 fonts are availableinone
or moredirectories theirpath should beadded to
GS_FONTPATH
,sothatallfonts areautomatically
available.Notethatyou should alsoadd thenamesof thefontsandthenamesofthefileswherethey
resideintothefontcatalog,whichisdescribednext.
e
Fontmap
catalogfileconsists of aset oflinesdescribinga font;each linehasthenameofa
PostScriptfont(prefixedwith
/
),followedbysomewhitespace,andthenthenameofafileondisk,in
parentheses.Alternatively,thesecondpartofthelinecanbethenameofanalreadydefinedfont,toact
asanalias.elinemustbeterminatedbyasemicolon.Commentsareaddedbystartingalinewitha
%character.
Asanexample,thefamiliarPalatinofamilyisprovidedbyURW’sPalladiofonts;thisextractfrom
Fontmap
showshowthenamesaremappedtoactualfilesondisk:
/URWPalladioL-Roma
(p052003l.pfb) ;
/URWPalladioL-Ital
(p052023l.pfb) ;
/URWPalladioL-Bold
(p052004l.pfb) ;
/URWPalladioL-BoldItal (p052024l.pfb) ;
efullpathnameofthefileisnotnormallygiven,sincethefontsareexpectedtobefoundinthefont
directorypath.Inordertoallow filestocallupthefontbytherealPalatinonames,a set ofaliases is
provided:
/Palatino-Roman
/URWPalladioL-Roma ;
/Palatino-Italic
/URWPalladioL-Ital ;
/Palatino-Bold
/URWPalladioL-Bold ;
/Palatino-BoldItalic
/URWPalladioL-BoldItal ;
Since
Ghostscript
normallysearchesthedirectoriesforsuitablefontfilesanyway,thefirstexample
aboveisactuallyredundant,butthealias entriesin
Fontmap
arevital,unlessyouhaveacopyofreal
Palatinoonyourdisk.Usersof
AdobeTypeManagerdo
haverealAdobefontsthat
Ghostscript
canuse,
andspecialversionsofthe
Fontmap
fileareprovidedforthisandothersetups.
22.3.3 Selectingan outputdevice
Ghostscript
savesordisplays its resultsinaparticularformatonan“output device”,ofwhich it hasa
largevarietyallowingittosupportvectorandrasterfileoutput,screendisplay,andmanynativeprinter
formats.ecommand
gs -h
listsalldevicesavailablewithyourversion.Frominside
Ghostscript
you
122
ch-psextra2.tex,v:2.27
2007/08/13
C# PDF Page Extract Library: copy, paste, cut PDF pages in C#.net
Ability to copy selected PDF pages and paste The portable document format, known as PDF document, is a widely-used form of file that allows users to
delete pages pdf file; delete pages from a pdf reader
VB.NET PDF Page Extract Library: copy, paste, cut PDF pages in vb.
VB.NET: Copy and Paste PDF Pages. VB.NET programming example below will show you how to copy pages from a PDF file and paste into another one.
delete pages from pdf in preview; delete pages from a pdf online
22.3 Ghostscript,aPostScriptinterpreter
canalsofindoutwhatdevicesareavailablebytypingthefollowingattheinteractiveprompt.
GS> devicenames ==
[/bjc600 /bit /cdeskjet /tiffg4 /deskjet /pnm /cljet5 /x11gray2
/pcxgray /png256 /pjxl300 /tiff32nc /ljet3d /pksm /psdrgb /bmpsep8
/pbmraw /pswrite /bjc800 /bit rgb /cdjcolor /tifflzw /djet500 /pnmraw
/cljet5c /x11gray4 /pcx16 /png16 /unipri nt /tiffsep /ljet4 /pksmraw
/nullpage /bmp16 /pgm /epswrite /faxg3 /bitcmyk /cdj mono /tiffpack
/laserjet /ppm /spotcmyk /x11mono /pcx256 /pngalpha /ijs /psmono
/ljet4d /tiffcrle /bmp256 /pgmraw /pxlmono /x11 /faxg32d /png16m
/cdj550 /tiff12 nc /ljetplus /ppmraw /devicen /bmpmono /pcx24b /jpeg
/bj10e /psgray /lj5mono /ti ffg3 /bmp16m /pgnm /pxlcolor /x11alpha
/faxg4 /pnggray /pj /tiff24nc /ljet2p /pk m /xcf /bmpgray /pcxcmyk
/jpeggray /bj200 /psrgb /lj5gray /tiffg32d /bmp32b /pgn mraw /bbox
/x11cmyk /pcxmono /pngmono /pjxl /tiffgray /ljet3 /pkmraw /psdcmyk
/bmpsep1 /pbm /pdfwrite]
Acompletedescriptionof alldevicessupportedby
Ghostscript
andtheiroptions canbe foundinthe
file
Devices.html
inthedirectorycontainingthedocumentation.
As output device
Ghostscript
uses the one specified with the command line option
-
sDEVICE=device
orthe defaultdevice(oenthedisplay)otherwise. is switchmustprecede the
nameofthefirstinputfile,andonlyitsfirstusehasanyeffect.Anexampleis:
> gs -sDEVICE=deskjet myfile.ps
e output device can also be set through the
GS_DEVICE
environment variable, or from inside
Ghostscript
ontheinteractivepromptasfollows:
GS> (deskjet) selectdevice
Alloutputthengoestothedeskjetprinterinsteadofthedisplayuntilyouchangethedevice,e.g.,
GS> (laserjet) selectdevice
GS> (myfile.ps) run
GS> (deskjet) selectdevice
Some printers canmanagedifferent resolutions, oentradingresolutionagainst printingspeed.
eresolutionisselectedwiththe
-r
switch(seeSection22.3.1).isoptionisalsousefulforcontrol-
lingthedensityofpixelswhenrasterizingtoanimagefile.
eoutputof
Ghostscript
canbesenttoafilewiththe
-sOutputFile=
switch,e.g.,
> gs -sOutputFile=myfile.xyz
isfilewillthenhavetobesenttotheprinterviatheappropriateprocedureonyouroperatingsystem.
especialfilename“
-
”tells
Ghostscript
tosenditsoutputtostandardoutput(thecommandshell).
Youcaninstruct
Ghostscript
toputeachpageofoutputinaseriesofsimilarlynamedfiles.isis
achievedbyplacingatemplate“
%d
”inthefilenamewhich
Ghostscript
willreplacewiththepagenum-
ber,wherethenumberofdigitsinthefilenamecanalsobecontrolled,e.g.,
gs -sOutputFile=fil-%d.png
produces
ABC-1.png, …, ABC-10.png
gs -sOutputFile=fil-%03d.png
produces
ABC-1.png, …, ABC-999.png
gs -sOutputFile=fil-%04d.png
produces
ABC-1.png, …, ABC-9999.png
ch-psextra2.tex,v:2.27
2007/08/13
123
C# Word - Extract or Copy Pages from Word File in C#.NET
C#.NET PDF file & pages edit, C#.NET PDF pages extract, copy, paste, C#.NET rotate PDF pages, C#.NET VB.NET How-to, VB.NET PDF, VB.NET Word, VB.NET Excel, VB
delete a page from a pdf acrobat; delete pdf pages ipad
VB.NET PDF Convert to Word SDK: Convert PDF to Word library in vb.
NET code. All PDF pages can be converted to separate Word files within a short time in VB.NET class application. In addition, texts
delete pages from a pdf file; delete page from pdf document
22
POSTSCRIPTANDPDFTOOLS
Table22.1:StandardUS,ISO,andJapanesepapersizes
U.S.standardpapersizes
inches
mm
points
inches
mm
points
Name
W × H
W × H
W × H
Name
W × H W × H
W × H
11x17
11.0 17.0 279 432 792 1224
archE 36.0 48.0 914 1219 2592 3456
ledger
17.0 11.0 432 279 1224 792
archD 24.0 36.0 610 914 1728 2592
legal
8.5 14.0 216 356 612 1008
archC 18.0 24.0 457 610 1296 1728
letter
8.5 11.0 216 279 612 792
archB 12.0 18.0 305 457 864 1296
lettersmall
8.5 11.0 216 279 612 792
archA
9.0 12.0 229 305 648 864
ISOstandardpapersizes
a0
33.1 46.8 841 1189 2384 3370
a5
5.8 8.3 148 210 420 595
a1
23.4 33.1 594 841 1684 2384
a6
4.1 5.8 105 148 297 420
a2
16.5 23.4 420 594 1191 1684
a7
2.9 4.1 74 105 210 297
a3
11.7 16.5 297 420 842 1191
a8
2.1 2.9 52
74 148 210
a4
8.3 11.7 210 297 595 842
a9
1.5 2.1 37
52 105 148
a4small
8.3 11.7 210 297 595 842
a10
1.0 1.5 26
37
73 105
isob0
39.4 55.7 1000 1414 2835 4008
c0
36.1 51.1 917 1297 2599 3677
isob1
27.8 39.4 707 1000 2004 2835
c1
25.5 36.1 648 917 1837 2599
isob2
19.7 27.8 500 707 1417 2004
c2
18.0 25.5 458 648 1298 1837
isob3
13.9 19.7 353 500 1001 1417
c3
12.8 18.0 324 458 918 1298
isob4
9.8 13.9 250 353 709 1001
c4
9.0 12.8 229 324 649 918
isob5
6.9 9.8 176 250 499 709
c5
6.4 9.0 162 229 459 649
isob6
4.9 6.9 125 176 354 499
c6
4.5 6.4 114 162 323 459
JISstandardpapersizes
jisb0
1030 1456
jisb4
257 364
jisb1
728 1030
jisb5
182 257
jisb2
515 728
jisb6
128 182
jisb3
364 515
For normal documents, “
%03d
”is usuallyall right.¹ is functiondoes not work with document-
directeddevices,suchas
pdfwrite
and
pswrite
.InthecaseofPDFgenerationoneofmorepages
canbeextractedwiththe
-dFirstPage
and
-dLastPage
switches(seeSection22.3.5).
22.3.3.1 Measurements
PostScriptand
Ghostscript
useacertainnumberofmeasures:inches(in)centimeters(cm),millimeters
(mm),andpoints(pt).Onehas1in=2.54cm=72ptwherethelatteraresocalled“bigpoints,”or
PostScriptpoints,sothat1cm≈25.35pt.Table22.1providesalistofpapersizesexpressedinthese
units.Anothercommonunitis“bitsperpixel”(bpp),alsoknownasthe“bitdepth”orthe“pixeldepth”,
andwhichcorrespondstothenumberofdigitalbitsusedtorepresentthecolorofeachpixel.
¹e character “%” has a special meaning on Microso Windows, hence you must double it “%%”, e.g.,
gs -sOutputFile=file-%%03d.png
.
124
ch-psextra2.tex,v:2.27
2007/08/13
C# PDF Image Extract Library: Select, copy, paste PDF images in C#
PDF ›› C# PDF: Extract PDF Image. How to C#: Extract Image from PDF Document. Support PDF Image Extraction from a Page, a Region on a Page, and PDF Document.
add or remove pages from pdf; delete page pdf acrobat reader
VB.NET PDF Page Insert Library: insert pages into PDF file in vb.
Page: Insert PDF Pages. |. Home ›› XDoc.PDF ›› VB.NET PDF: Insert PDF Page. Add and Insert Multiple PDF Pages to PDF Document Using VB.
acrobat export pages from pdf; pdf delete page
22.3 Ghostscript,aPostScriptinterpreter
22.3.3.2 Papersizes
Bydefault
Ghostscript
usesU.S.letterpaperasitsdefaultpagesize.Youcanchangethisandsetittoone
oftheinternationallyrecognizeddimensionsofTable22.1ontheprecedingpage,asfollows:
> gs -sPAPERSIZE=a4 …
Moregenerally,thepagewidth(
w
)andheight(
h
)canbespecifiedinpointsbyusingapairofswitches,
asfollows:
> gs -dDEVICEWIDTHPOINTS=w -dDEVICEHEIGHTPOINTS=h …
Documentsoenspecifyapaper sizewhichtakesprecedenceoverthe defaultsize.If this is not
desired(e.g., onewantstoprinta“letter”sizeddocumentonan“a4”printer”)aspecificpapersizecan
beforcedbyselectingthedesiredsizeandaddthe
FIXEDMEDIA
switch,asfollows:
> gs -sPAPERSIZE=a4 -dFIXEDMEDIA …
einstalleddefaultpapersizeonyourinstallationcanbechangedbyeditingtheinitializationfile
gs_init.ps
,which usuallyresidesina
Ghostscript
’s
lib
directory(seetheoutputofthecommand
gs h
foritswhereabouts).Inthatfileyoushouldlocatetheline
% /DEFAULTPAPERSIZE (a4) def
anduncommentitifyouwant“
a4
”asdefault,asfollows:
/DEFAULTPAPERSIZE (a4) def
Insteadof“
a4
”youcansetanyoftheknowpapersizesofTable22.1onthefacingpage.
22.3.3.3 Usingpipes
e input and output files can, onmost operatingsystems, bereplaced bypipes, inwhich case you
shoulduse“
-
”asplaceholderforthefilename.is,however,onlyworksforPostScriptsources,since
PDFfileshavearandomaccessstructureandthuscannotbereadfromstandardinputorusedinpipes.
Twoexamplesfollow.
> … | gs [options] -
> gs [options] myfile.ps -q -sOutputFile=- | lpr
Inthefirstlinewepipedatainto
gs
,whileinthesecondlinewereadafileandpipeoutputintothe
lpr
command (the
-q
switch is neededtoprevent
Ghostscript
fromwritingmessages tostandardoutput
whichbecomemixedwiththeintendedoutputstream.)
22.3.3.4 Preparingimagefiles
When preparing image files by rasterizing one oen uses switches to specify the output file
(
-sOutputFile
), define the resolution (
-r
, default 72 dpi), set antialiasing characteristics (
-
dTextAlphaBits
and
-dGraphicsAlphaBits
), and to suppress interactiveprompts and enable
somesecuritychecksonthefiletoberun(
-dSAFER
,
-dBATCH
,and
-dNOPAUSE
).
ch-psextra2.tex,v:2.27
2007/08/13
125
VB.NET PDF Image Extract Library: Select, copy, paste PDF images
VB.NET PDF - Extract Image from PDF Document in VB.NET. Support PDF Image Extraction from a Page, a Region on a Page, and PDF Document in VB.NET Project.
delete pages from pdf online; delete page from pdf
C# Create PDF from Word Library to convert docx, doc to PDF in C#.
Convert multiple pages Word to fillable and editable PDF documents in both .NET WinForms and ASP.NET. Able to get word count in PDF pages.
delete pages from pdf document; delete blank pages in pdf
22
POSTSCRIPTANDPDFTOOLS
PNG
PortableNetworkGraphics(PNG,see
http://www.libpng.org/pub/png/pngintro.html
)is
therecommendedformatforhigh-qualitybitmapimages.PNGfeaturesfullqualitycolor,transparency,
excellentlosslesscompression,andiswidelysupported.
PossiblePNGdevicessupportedby
Ghostscript
are:fornormaluse
png16m
for24-bitRGBcolor,
or
pnggray
forgrayscalearerecommendeddevices;forspecialneeds
png256
,
png16
,and
pngmono
provide,respectively,8-bitcolor,4-bitcolorandblack-and-whitesupport.Moreover,
pngalpha
gives
you 32-bit RGBAcolorwith transparencyindicatingpixelcoverage. is devicelets you specifythe
background color in the RGB model with the option
-dBackgroundColor=16#RRGGBB
(default
white=
16#ffffff
).
Examplesofhow
Ghostscript
canconvertPostScriptorPDFtoPNGare:
> gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dGraphicsAlphaBits=4 \
-sOutputFile=myfile.png myfile.ps
> gs -dSAFER -dBATCH -dNOPAUSE -r150 -sDEVICE=pnggray -dTextAlphaBits=4
\
-sOutputFile=myfile-%02d.png myfile.pdf
JPEG
JointPhotographicExperts Group(JPEG, see
http://www.jpeg.org/
)imagesarespecificallyin-
tendedforcontinuous-toneimagessuchasphotographs,notfortheusualkindofgraphicsimagesthat
areproducedwithPostScript.Infact,foranythingotherthanverysimpledrawingsJPEG’slossycom-
pressionwillresultinpoorqualityoutputregardless of theinput.¹e
jpeg
and
jpeggray
devices
generateforcolor,respectively,grayscaleJPEGimages,eg
> gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -sOutputFile=myfile.jpg myfile.ps
Severaloptions are available tocontroltheJPEG“qualitysettings”(seethedocumentationformore
details).
PNM
e“portablenetworkmap”(PNM)familyof formats areverysimpleuncompressed image formats
commonlyused onUnix-likesystems.ePNM format is anabstractionofthe lowestcommonde-
nominatorfileformats for color(PBM), grayscale (PGM), and black-and-white(PPM).²
Ghostscript
supports a wide varietyof such data formats, e.g.,
pbm
,
pbmraw
,
pgm
,
pgmraw
,
ppm
,
pnm
,
pkm
,and
manyothers.
TIFF
Tagged Image File Format (TIFF, see
http://en.wikipedia.org/wiki/TIFF
)is a file format
mainly used for storing images—especially high color-depth ones—, including photographs and
lineart.³ Although nowadays largelysuperceded by PNG, TIFF is still widelysupported by image-
manipulationdesktopandpagelayouttools,andespeciallyusefulinconnectionwithscanners,optical
characterrecognitiontools,faxmachines,etc.
¹eWebpagehttp://www.faqs.org/faqs/jpeg-faq/explainssomeoftheissueswhenchoosinganoutputformat.
²e
netpbm
Project(http://netpbm.sourceforge.net/doc/index.html) hasover 200programs totransform
betweentheseandothergraphicsformats.e
ImageMagick
Project(http://www.imagemagick.org)alsosupportsover
90differentformatsandallowsconversionsbetweenthem.
³especificationisathttp://partners.adobe.com/public/developer/tiff/index.html.
126
ch-psextra2.tex,v:2.27
2007/08/13
22.3 Ghostscript,aPostScriptinterpreter
FivecolorTIFFdriversproduceuncompressedoutput:
tiffgray
(8-bitgray),
tiff12nc
(12-bit
RGB,4bitspercomponent),
tiff24nc
(24-bitRGBoutput,8bitspercomponent),
tiff32nc
(32-bit
CMYKoutput,8bitspercomponent).Moreover,
tiffsep
createsmultipleoutputfiles,asingle32bit
composite CMYK file (
tiff32nc
format)and several
tiffgray
files,oneforeach separation(see
thedocumentationfordetailsofhowtospecifyseparations).
Other TIFF drivers produce black-and-white output with different compression modes:
tiffcrle
and
tiffg3
(G3faxencodingwithout and with end-of-lines),
tiffg32d
(2-D G3fax
encoding),
tiffg4
(G4faxencoding)
tifflzw
and
tiffpack
(LZW-compatibleandPackBitscom-
pression).
Ghostscript
supports avarietyoffaxencodings,either encapsulatedinTIFF, as described above
andasrawfiles(
faxg3
,
faxg32d
and
faxg4
).
MicrosoWindowsbitmapformats
BMP(orDIBfordevice-independentbitmap)isasimple,uncompressed,bitmappedgraphicsformat
developedbyMicrosoandIBM.Imagescanhaveacolordepthupto24bits(16.7millioncolors).8-
bitimagescanalsobegreyscaleinsteadofindexedcolor.Analphachannel(fortransparency)maybe
storedinaseparatefile,orcanbeintegratedina32-bitversionthathasbeenintroducedwithWindows
XP,butisnotyetgenerallysupportedinimagesoware.In
Ghostscript
BMPissupportedbythedevices
bmpmono
,
bmpgray
,
bmpsep1
,
bmpsep8
,
bmp16
,
bmp256
,
bmp16m
,
bmp32b
.
PCX (
http://www.qzx.com/pc-gpe/pcx.txt
)is an image file format that uses a simple
formofrun-lengthencoding(alosslesscompressionalgorithm). Althoughpresentlylargelyreplaced
byformatswithbettercompression,suchasJPEGandPNG,PCXisstilloenusedonMicrosoWin-
dows. PCX filesuse acolor palette with alternate colorspaces and so canbea useful wayto output
CMYK.In
Ghostscript
PCXissupportedbythedevices
pcxmono
,
pcxgray
,
pcx16
,
pcx256
,
pcx24b
,
pcxcmyk
.
22.3.3.5 OutputforInkjetandotherrasterdevices
IJSisaprotocolfor transmissionofrasterpageimages. Itisarelativelynewinitiativetoimprovethe
qualityandeaseofuseofinkjetprintingwith
Ghostscript
.WithIJSyoucanaddnewdrivers,orupgrade
existingones,withoutrecompiling
Ghostscript
.AlldriverauthorsareadaptingtheirdriversforIJS.¹An
exampleofacommandlineforanIJSdeviceis:
gs -dSAFER -sDEVICE=ijs -sIjsServer=hpijs \
-sDeviceManufacturer=HEWLETT-PACKARD -sDeviceModel=’DESKJET 990’ \
-dIjsUseOutputFD -sOutputFile=/dev/usb/lp1 -dNOPAUSE -- myfile.eps
e
-sIjsServer
switch specifies the pathname for the IJS printer driver.
Ghostscript
will spawn
anew process for this driver and will communicate with it usingthe IJS protocol. e switches
-
sDeviceManufacturer
and
-sDeviceModel
are provided bythe manufacturer (values contain-
ingspacesshouldbequoted, as shownintheexample).e
-dIjsUseOutputFD
flagindicates that
Ghostscript
should opentheoutput file and passa file descriptor tothe server. If notset,
Ghostscript
simplypassesthefilenamesetin
-sOutputFile
totheserver.
Otherrelevant
Ghostscript
parametersare:
-dBitsPerSample=n
Numberofbitspersample(defaultvalueis8).Formonochromeimages,use
-dBitsPerSample=1
.
¹eIJSwebpage(http://www.linuxprinting.org/ijs/)hasmoreinformationaboutIJS,includingalistingof
IJS-compatibledrivers.
ch-psextra2.tex,v:2.27
2007/08/13
127
22
POSTSCRIPTANDPDFTOOLS
-rnb
Resolution(seeSection22.3.1).Ifthe resolutionisnot specified,
Ghostscript
queries
theIJSservertodetermine thepreferred resolution,otherwiseit overridesthevalue
(ifany)preferredbytheIJSserverbytheonespecifiedonthecommandline.
-dDuplex
Enableduplex(two-sided)printing.
-dTumble
Controlstheorientation.WhenTumbleisfalse,thepagesareorientedsuitablyatthe
leor right. WhenTumbleistrue, thepages areoriented suitablyfor bindingatthe
toporbottom.
-sProcessColorModel=name
Settheprocesscolormodel.Possiblevaluesinclude
DeviceGray
,
DeviceRGB
,and
DeviceCMYK
.
HP provides official drivers for many of their Deskjet printer models. In order to use these
drivers, you willneed the HPInkjetServer available fromtheHPDriverProject (
http://hplip.
sourceforge.net/
). Currently, they provide support for nearly 1000printing models, including
colorDeskjet and BusinessInkjetandcolor InkjetPhotoprinters(Photosmart),color LaserJet Print-
ers and Multi-FunctionPrinters (MFPs), Color Inkjet all-in-ones (Officejet andPSC), monochrome
(B&W)LaserJetprintersandMFPs(seethewebpagementionedforacompletelist).Recentversions
ofthehpijsdriverssupporttheIJSprotocol.
eGimp-PrintProject(
http://gimp-print.sourceforge.net/
)alsoprovidesalargecol-
lectionofprinterdriverswithanIJSinterface.
22.3.3.6 High-level devices
esedevicespreserveasmuchaspossiblethevectordrawingelementsoftheinputfile.
e
pdfwrite
deviceoutputsPDF(seebelow or thefile
Ps2pdf.htm
inthe
Ghostscript
distri-
butionfordetailsaboutthemanysupportedoptions).
e
pswrite
and
epswrite
devicesoutputPostScriptandEncapsulatedPostScript,respectively.
Both thesedevices have anoption
-dLanguageLevel
which canbeset equaltothe value1, 1.5,2
(default),and3.ItsetsthePostScriptlanguagelevelforthegeneratedfile.
e
pxlmono
and
pxlcolor
devicesoutputHPPCL-XL,agraphiclanguageunderstoodbymany
recentlaserprinters.
22.3.3.7 Displaydevices
ForpreparingscreendisplaysofPostScriptorPDFdocuments
Ghostscript
isagoodchoice.Aclientor
viewercancallthe
Ghostscript
enginetodotherasterizationandhandlethedisplayoftheresultingim-
ageitself,or
Ghostscript
canbeinvokedtohandlethedisplayoftheimageonscreenitselfbyspecifying
anadequateoutputdevice.
On Unix, the most commonly used displaydevice is based onthe X Window System. Various
possibilitiesexist.
x11
thedefaultdeviceforhandlingthedisplayonX11R6;
x11alpha
thesameastheabovebutwithantialiasing;
x11mono
black-and-whitedevicefor1-bitmonochromedisplays;
x11gray2
two-bit(4-level)monochromedisplays;
x11gray4
four-bit(16-level)monochromedisplays.
On Microso Windows and with the gtk+ versions of
Ghostscript
one can use the
display
device. e displayformat is set with the
-dDisplayFormat
option, an integer representinga bit
string(seethedocumentationfordetails).Examplesare
16#30804
(WindowsRGB),
16#804
(gtk+
RGB),
16#20101
(Windows monochrome),
16#102
(gtk+ monochrome),
16#20802
(grayscale),
16#20808
(CMYK),and
16#a0800
(separations).
128
ch-psextra2.tex,v:2.27
2007/08/13
22.3 Ghostscript,aPostScriptinterpreter
e option
-dDisplayResolution
,which initializes theresolution for a display device, lets
WindowsclientssetthisresolutiontotheWindowsdisplaylogicalresolution.iscanbeoverridden
bythecommandlineoption
-rDPI
.
Finally,aspecial
bbox
“device”justprintstheboundingboxofeachpage.Itcanberunasfollows:
gs -dSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox frag2.eps
AFPL Ghostscript 8.51 (2005-04-18)
...A few lines deleted
%%BoundingBox: 148 624 228 668
%%HiResBoundingBox: 148.667990 624.467934 227.507987 667.307977
e boundingboxinformationis output to
stderr
.Beware that whiteobjects areinvisible to this
procedure.
22.3.4 Interactive Ghostscriptversions
Plain
ghostscript
providesnoeasyfacilitiestonavigateadocument,zoominonpartsofthepage,rotate
pages,printselectedpages,etc.Suchfunctionsareprovidedbyfrontendsthatofferaconvenientinter-
faceto
ghostscript
,suchasthefreelyavailableprograms
GSview
forMSWindowsdevelopedbyRussell
Lang,
MacGSViewer
fortheMacintosh,and
ghostview
forUnixXWindowsSystem.Figure22.3showsa
PostScriptpageviewedwithTimothyeisen’s
ghostview
.¹Aportionofthepagehasbeenmagnified.
emenu ontheleindicatesthefunctionsavailable, includingloadingnew files, printingselected
pages,jumpingtodifferentpagenumbers,andchangingmagnification,papersize,andorientation.
Figure22.4onthenextpagedisplaysaPDFincarnationofthesamepageasinFigure22.3displayed
by
Evince
.²eAboutinformationandthecontentsoftheEditmenuareshown.
22.3.5 Ghostscriptapplications
ManyapplicationsforhandlingPostScriptprogramsdependon
Ghostscript
tohandle(convert,trans-
form,rasterize)thedata,andwelookatafewofthemhere.
esesmallapplicationsaresometimeswrittenasscriptsthatcallPostScriptprograms;theseare
usuallyprovided as both Unix shell scripts and MS-DOS batch files and theyoensimplygive the
command-lineoptionsneededfor
Ghostscript
.Hence,usersofotheroperatingsystemscaneasilyadapt
thesefilestotheirneeds.
22.3.5.1 ExtractingtextfromPostScriptfiles
Ghostscript
comes with a PostScript file called
ps2ascii.ps
,which extracts theASCIItextfroma
PostScript file; nothingisdisplayed,but thetext is writtento standard output. It is wrapped up ina
scriptcalled
ps2ascii
,usedasfollows:
> ps2ascii myfile.ps [myfile.txt]
¹
ghostview
,thefirstX11interfaceto
Ghostscript
,gavelifetoseveralderivedprograms(seehttp://www.cs.wisc.edu/
~ghost/gv/foralist),suchasJohannesPlass’sgvonLinux.Currently,JakaMocnikisdevelopingaGnome-basedinterface
ggv
(http://directory.fsf.org/print/misc/ggv.html).
²
Evince
(http://www.gnome.org/projects/evince/)isadocumentviewerformultipledocumentformats.Itcur-
rently supports PDF, PostScript,DJVU (a new compression technology,seehttp://www.djvuzone.org/),TIFF,and
DVI.egoalof
evince
istoreplacethemultipledocumentviewersthatexistonthe
Gnome
Desktopwithasinglesimple
application.
ch-psextra2.tex,v:2.27
2007/08/13
129
22
POSTSCRIPTANDPDFTOOLS
Figure22.3:Exampleoftheuseof
ghostview
.
Figure22.4:Exampleoftheuseof
evince
.
Another utility,
pstotext
,(
http://www.cs.wisc.edu/~ghost/doc/pstotext.htm
)origi-
nallywrittenbyAndrewBirrellandPaulMcJones,isalittlemorerobust.Like
ps2ascii.ps
,itreads
oneormorePostScriptfilesandwritesoutarepresentationoftheplaintextthatwouldbedisplayedif
thePostScriptfilewereprinted.Internally
pstotext
uses
Ghostscript
andloadsaPostScriptlibrarythat
locateseachstringinthefile,andenoughadditionalinformationtoapproximatethestring’sbounding
rectangle.
pstotext
thenpost-processesthisinformationandoutputsasequenceofwordsdelimitedby
space, newline, and formfeed.Inpartucular, eight-bit input codes aretranslated into an ISO 8859-1
charactercode,whenavailable,orintoasequenceofcharactersotherwise,e.g.,“
---
”foremdash.
22.3.5.2 CreatingEPSInterchangefiles
eutilityscript
ps2epsi
takesaPostScriptfileasinput andgeneratesanoutput filethatconformsto
Adobe’sEncapsulatedPostScript Interchange(EPSI)format.¹isspecialformofEncapsulatedPost-
Scriptaddsamonochromebitmapversionofthefinaldisplayedpage(intheformofPostScriptcom-
ments)tothebeginningofthefile. isisusefulfortext processorsordesktop publishingtoolslike
FrameMaker
whichuseittodisplayanapproximaterepresentationofthepictureintheregulardisplay.
escriptisusedasfollows:
> ps2epsi infile [outfile]
Ifthe outputfileis notspecified thenthe samenameasfor theinput file nameisused,butwiththe
extension
.epsi
.
¹Seehttp://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf.
130
ch-psextra2.tex,v:2.27
2007/08/13
Documents you may be interested
Documents you may be interested