asp.net mvc display pdf : Best way to compress pdf files Library control component .net web page windows mvc hoeppner0-part144

ThePracT
E
XJournal
TPJ2005No03,2005-07-15
Rev.2005-07-15
StrategiesforincludinggraphicsinL
A
T
E
X
documents
KlausH¨oppner
Abstract
ThisarticlepresentsstrategiesforincludinggraphicsintoL
A
T
E
Xdocuments.
ItshowstheusageofthestandardgraphicspackagesofLAT
E
Xaswellasanin-
troductiontodifferentgraphicsformats. Someexternaltoolsforconverting
graphicsformatsarediscussed.
1 Overviewofgraphicsformats
Ingeneral,thereexisttwokindsofgraphicsformats:vectorandbitmapgraphics.
Forbitmaps,thereexistdifferentflavors: nocompression(whichcanmakeyour
filestrulyhuge,dependentonresolutionandcolordepth,soIwon’tcoverthem
fromhereon),compressionmethodswhichcompletelypreservetheimagequality
whilereducingthedatasize,and“lossy”compressionmethodswhichcausea
consequentreductioninimagequality.
Solet’sgomoreintodetail:
Vectorgraphics aresetupbydrawingorfillinggeometricalobjectssuchaslines,
B´eziercurves,polygons,circlesandsoon. Thepropertiesoftheseobjects
arestoredmathematically. Vectorgraphicsareingeneraldeviceindepen-
dent.Itiseasytoscaleorrotatethemwithoutlossofquality,sincethejobof
rasterizingthemintoactualpixelsisdonebytheprinterorprinterdriver.
Best way to compress pdf files - Compress reduce PDF size in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
C# Code & .NET API to Compress & Decompress PDF Document
change font size in pdf fillable form; best pdf compression tool
Best way to compress pdf files - VB.NET PDF File Compress Library: Compress reduce PDF size in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Compression and Decompression Control SDK
change font size in pdf form field; pdf compression
Bitmapswithoutlossycompression storetheimageinformationaspixels,each
pixelofagivencolor. Inprinciple,thequalityofabitmapbecomesbetter
withincreasedresolutionandcolordepth(e.g.GIFfilesuseacolordepthof
8bits,leadingto256differentindexedcolorswhileabitmapwith24bitcolor
depthcanhaveabout16millioncolors).Scalingandrotatingbitmapimages
willyieldalossofquality,andprintingbitmapstoadevicewithadifferent
resolutioncanproducebadresults. Fig.1showsthedifferencebetweena
scaledimageasvectorandbitmapgraphics.
Bitmapswithlossycompression usethefactthatwhilethehumaneyeisfairly
goodatseeingsmalldifferencesinbrightnessoverarelativelylargearea,itis
notgoodatdistinguishingbrightnessvariationsinasmallarea. Therefore,
thedetailinformationinthelattercasecanbereduced,leadingtosmaller
filesizes.Thisworkswellforphotographsthatusuallycontainsmoothtran-
sitionsincolor,butforgraphicswithasharpborder,artifactscanoccur,as
showninfig.2. Themostprominentgraphicsformatusinglossycompres-
sionisJPEG.
Figure1: Zoomedviewintoasampleimageasvectorgraphics(left)andbitmap
(right).
2
C# PDF File Split Library: Split, seperate PDF into multiple files
Best and professional adobe PDF file splitting SDK for PDF, provides an advanced C# programming way to split PDF document into smaller PDF files in .NET
best way to compress pdf file; reader pdf reduce file size
C# PDF Convert to Tiff SDK: Convert PDF to tiff images in C#.net
Best C#.NET PDF converter SDK for converting PDF to high-fidelity PDF to TIFF conversion in an easy way. C# developers can render and convert PDF document to
advanced pdf compressor online; pdf custom paper size
Figure2: AlowqualityJPEGimage
showingsomeartifactsatthetransi-
tionbetweenblackandwhite.
2 Graphicsformatsinpractice
Thereexistverymanygraphicsformats,soIwillconcentrateonafewofthose
mostoftenused:
EPS istheencapsulatedPostScriptformat. Itismostlyusedforvectorgraphics
butcanalsocontainbitmaps.
PNG istheportablenetworkgraphicsformat.Itwasintroducedduetotheprob-
lemthatUnisysclaimedapatentforthecompressionalgorithmusedinGIF
format. Forthisreason,itisoftenusednowadaysonwebpages. PNGis
abitmapformatthatsupportscompressionbothwithandwithoutlossof
imagequality.
JPEG isabitmapformatwithlossycompressionandisoftenusedforphotographs
(e.g.mostdigitalcamerasproduceJPEGfiles).
TIFF isabitmapformatsometimesusedforhighqualitypictures—inpartbe-
causeitsupportstheCMYKcolorspaceimportantespeciallyforcommercial
printing.
Nowthequestionis:WhatformatshallIuseforwhatpurpose?Thoughthere
isnoonetrueanswertothisquestion,myadviceisasfollows:
1. Fordrawings(e.g.technicaldrawingsordataplots)usevectorgraphics. . It
givesyoumaximumfreedomtomanipulatetheimagewhenincludingitinto
3
VB.NET PowerPoint: Merge and Split PowerPoint Document(s) with PPT
Then the best way to reach this target is to use a be divided into two separate sub-PPT files from the Note: If you want to see more PDF processing functions
advanced pdf compressor; reduce pdf file size
C# PDF Text Redact Library: select, redact text content from PDF
File: Compress PDF. Page: Create Thumbnails. Page: Insert PDF Pages. Page: Delete Existing PDF Pages. Provide a best and easy way to darken text in PDF
pdf edit text size; best compression pdf
adocumentwhereyouoftenneedtoscaletheimagetofitintoyourlayout.
Additionally,itisindependentoftheoutputdevice,andthusyoucanzoom
intotheimageinyourdocumentviewerwithoutseeingsinglepixels.
DrawingtoolsofferedbyT
E
Xdistributions—notably PSTricksandMETA-
POST—canusuallyproduceEPSoutputnatively.Mostvectordrawingpro-
gramslikexfigandCorelDrawalsoofferexportfunctionalityforproducing
EPSoutput(thoughsometimesbuggy).
2. Ifyouarestuckwithbitmaps,usePNGforimageswithsharpcolortransi-
tions,suchasblackandwhiteboundaries.
3. Forphotographs,youcanuseJPEGinmostcases,sincethequalitylossby
compressionisnormallyimperceptiblewhenprinted. Onmostdevices,a
resolutionof100to200dpiwillbesufficient(rememberthatscreenresolu-
tionisnormallyabout75to100dpi,andcolorprintersclaimtohavehigh
resolutionsbutdithercolorprints,soyouwillhardlynoticethedifference
comparedtoJPEGswithhigherresolution).
3 TheL
A
T
E
Xgraphicspackage
SincetheintroductionofL
A
T
E
X2
ε
, thegraphicsbundleis part ofthestandard
packagesetaccompanyingtheLAT
E
Xbasedistribution[1].Itconsistsoftwostyle
files,graphics.styandgraphicx.sty. Whilegraphics.styrequirestheuseof
\scaleboxand\rotateboxforscalingorrotating graphics, theextended style
graphicx.stysupportsscalingandrotatingusingthekeyvalpackage,whichpro-
videsaconvenientinterfaceforspecifyingparameters.Ingeneral,thereisnorea-
sonnottoalwaysusegraphicx.sty.
Sothefirststepistoloadthegraphicxstylefileafterthe\documentclassstate-
ment:
\usepackage{graphicx}
Infact,theT
E
Xcompilerdoesn’tknowanythingaboutgraphics,andincluding
themisdonebytheDVIdriver.Sothegraphicxpackagehastodotwothings:
1. findtheboundingboxoftheimage(thiscanbetroublesomewhenyouhave
e.g. anEPSfilecreatedbyanapplicationthatwroteawrongBoundingBox
4
VB.NET Image: Tutorial for Converting Image and Document in VB.NET
Image Conversion SDK is your best choice for supports multiple image conversions in a simple way. powerful & profession imaging controls, PDF document, tiff
pdf file size; change paper size pdf
C# WPF PDF Viewer SDK to annotate PDF document in C#.NET
Best WPF PDF Viewer control for PDF annotating in .NET WPF class. 3. Wavy underline text. Click to add way underline under selected PDF text. 4.
best pdf compressor; best way to compress pdf files
comment—inthiscase,itcanbehelpfultoputtheincludegraphicscom-
mandintoan\fboxtofindoutwhatgraphicxthinksaboutthebounding
box);
2. producetheappropriate\specialfortheoutputdriver;thus,theusageof
thegraphicsbundleisdriverdependent.
Nowadays, therearetwomainworkflowsforproducingdocuments: : using
latextoproduceaDVIfileandthendvipsforconvertingittoPostScript,and
usingpdflatextoproduceaPDFfile. MostmodernT
E
Xsystemsareconfigured
toautomaticallycheckwhetheryouareusinglatexorpdflatexandproducing
dvips\specialsinthefirstcaseandtheappropriate\pdfimagecommandsinthe
secondcase.Soifyouareusingoneoftheaboveworkflows,youshouldn’tneed
tospecifyyouroutputbackendexplicitly. Ifyouareusinganotherbackendyou
havetospecifyitasanoption,e.g.
\usepackage[dvipsone]{graphicx}
(fortheY&Ydvipsonedriver),butbeawarethatotherbackendsoftendon’tsup-
portscalingorrotating. Forexample,DVIpreviewerslikexdviorwindvitryto
interpretthedvipsspecials,butrotationsmaynotbedisplayedproperlyinDVI
preview.
Afterthepackageisloaded,toincludeanimagesimplyuse
\includegraphics{sample}
Pleasenoticethatnoextensionforthefilewasgiven.Theexplanationwhywill
followlater. Inthecaseofusing\includegraphicswithoutoptionstheimageis
includedatitsnaturalsize,asshownabove.Whenusingthegraphicxstyle,you
canscaleyourimagebyafactor:
\includegraphics[scale=0.5]{sample}
\includegraphics[scale=1.2]{sample}
5
C# Image: Zoom Image and Document Page in C#.NET Web Viewer
This "Best Fit" function will help developers and users To put it in another way, after you activate powerful & profession imaging controls, PDF document, tiff
change font size pdf fillable form; pdf text box font size
VB.NET Create PDF Library SDK to convert PDF from other file
Best VB.NET component to convert Microsoft Office Word, Excel and PowerPoint to searchable PDF document. Creating a PDF document is a good way to share your
pdf compressor; 300 dpi pdf file size
Anotheroptionsupportsrotatinganimage:
\includegraphics[angle=30]{sample}
\includegraphics[angle=-10]{sample}
Positivenumbersleadtocounterclockwiserotation,negativenumberstoclock-
wiserotation. Theoriginfortherotationisthelowerleftcorneroftheimage,so
intheclockwiserotationabovetheresulthasnotonlyaheightbutalsoadepth
belowthebaseline(asshownbytherules).
Imagescannotonlybescaledbyagivenfactor,youcanspecifyaheightand/or
widthfortheresultingimageinstead:
\includegraphics[width=2cm]{sample}
\includegraphics[height=1.5cm]{sample}
heightgivestheheightabovethebaseline.Ifyourimagehasadepth,youcan
usetotalheightinstead,i.e.thesumofheightanddepthwillbescaledtothe
givenlength.
\includegraphics[angle=-30,height=1cm]
{sample}
\includegraphics[angle=-30,
totalheight=1cm]{sample}
6
VB.NET PDF - Annotate PDF with WPF PDF Viewer for VB.NET
Best WPF PDF Viewer control as well as an advanced PDF annotating software for Visual Basic .NET Click to add way underline under selected PDF text. 4.
pdf paper size; adjust pdf page size
C# PDF Page Move Library: re-order PDF pages in C#.net, ASP.NET
Best Visual Studio .NET PDF file edit SDK for sorting PDF or just change the position of certain one PDF page in an extremely easy and quick way using C#
pdf markup text size; best way to compress pdf
Youcanspecifybothwidthandheight.Inthiscaseyourimagemaybescaled
differentlyinhorizontalandverticaldirection,unlessyouusethekeepaspectratio
option:
\includegraphics[width=1.5cm,height=1.5cm]
{sample}
\includegraphics[width=1.5cm,height=1.5cm,
keepaspectratio]{sample}
Pleasenoticethatusageofangleandwidthorheightissensitivetotheorder
inwhichtheoptionsaregiven. Specifyingtheanglefirstmeansthatyourimage
isrotatedfirstandthentherotatedimageisscaledtothedesiredwidthorheight,
whilespecifyingawidthorheightfirstwillfirstscalethenaturalimageandrotate
itafterwards.
4 Supportedgraphicsformats
Tomakethingsabitmorecomplicated,latexwithdvipsandpdflatexsupport
differentgraphicsformats:
latex+dvipsEPS
pdflatexPDF,PNG,JPEG,MPS
Table1showswaystoconvertthestandardgraphicsformatstosupportedfor-
mats. Inparticular,convertingEPSgraphicsusedwithlatex+dvipstoPDFfor
pdflatexworkflowisquiteeasy;justruntheepstopdfPerlscript[2],whichuses
GhostscripttoconvertEPStoPDF.Thisconversioncanbeperformedautomati-
callyusingHeikoOberdiek’sepstopdfLAT
E
Xpackage[3]thatcallstheepstopdf
scriptontheflywhencompilingthedocument.
Thisalsoexplainswhyitisgenerallybesttogivethefilenameswithoutex-
tionsionin\includegraphicscommands. Inthiscasethegraphicspackagelook
forasupportedgraphicsformatautomatically. Soifyouhaveanimagebothas
7
Source Target Tool
latex+dvips
EPS
directlysupported
PNG
EPS
ImageMagick/netpbm
JPEG
EPS
ImageMagick/netpbm
TIFF
EPS
ImageMagick/netpbm/tif2eps
pdflatex
PDF
directlysupported
EPS
PDF
epstopdf
PNG
directlysupported
JPEG
directlysupported
TIFF
PNG
ImageMagick/netpbm
TIFF
PDF
tif2eps+epstopdf
Table1:Conversionofgraphicsformatssupportedbylatex+dvipsandpdflatex.
EPSand(e.g.)PDF,youcanuseboththelatex+dvipsandpdflatexworkflows
withoutchangingyoursource.
Oneotherusefulspecialcase:includingtheoutputofMETAPOSTisalsoeasy;
althoughitistechnicallyanEPSfile, itusesonlyasmallsetofcommands. . So
pdflatexcansupporttheinclusionofMETAPOSToutputdirectly.Theonlything
youhavetodoistochangethefileextensionoftheoutputfile(e.g..1)to.mps.
5 Toolsforimageconversion
Thereexistseveraltoolsforconversionofgraphicsformats,bothfreeandcommer-
cial. BesidesfreeGUI-basedtoolslikeGimponUnixsystemstherearetwocom-
mandlinetoolsavailableforUnixandWindows:ImageMagick[4]andnetpbm[5].
ImageMagickcanconvertimagesdirectly,e.g.bytyping
convert sample.gif sample.png
whilenetpbmusesthepnmformatasintermediateformat:
giftopnm sample.gif f | pnmtopng - - > > sample.png
8
Anothernicetoolistif2epsbyBogusławJackowskietal.[6]whichusesGhost-
scripttoconvertaTIFFfiletoEPS,e.g.
gs -- - tif2eps.ps sample.tif f sample.esp -rh
whichproducesaRLEcompressedandhexencodedEPSfile. Inmyexperience
EPSfilesproducedwithtif2epsaresmallerthanthoseproducedbyImageMag-
ick.AdditionallyitsupportsCMYKTIFFfilessmoothly.
6 Additionaltools
Therearemanyotherhelpfultools.IwillmentiontwoIusequiteoften.
6.1 overpic
isaLAT
E
XpackagewrittenbyRolfNiepraschk[7].ItincludesanimageintoaLAT
E
X
pictureenvironment, givingyoutheopportunitytoaddnewelementsintothe
imagewithnormalLAT
E
Xpicturecommands. Fig.3showsamapoverlaidwith
symbolsandtextatsomepoints.Thesourcecodeforthispicturelookslike
0
5 10 0 15 5 20 0 25 30 35 5 40 0 45 50 0 55 5 60 65 70
0
5 10 0 15 5 20 0 25 30 35 5 40 0 45 50 0 55 5 60 65 70
0
5
10
15
20
25
30
35
40
45
50
55
60
65
70
75
80
0
5
10
15
20
25
30
35
40
45
50
55
60
65
70
75
80
Windm¤uhle
MainzerStr.
7
Hausf¤ur
Industriekultur
AFr
D


Figure 3: : A A map with h additional
marksproducedwithoverpic
9
\usepackage[abs]{overpic}
...
\begin{document}
\begin{overpic}[grid,tics=5]{map}
\put(32,74){\includegraphics[scale=.3]
{busstop.mps}}
\put(32,77){\llap{\scriptsize%
\colorbox{back}{Windm\"uhle}}}
\put(28,63){\small\textcolor{red}{%
\ding{55}}}
...
\put(17.5,11){\scriptsize\colorbox{back}%
{{\Pisymbol{ftsy}{65} Fr}}}
\put(6.3,13){\colorbox{back}%
{{\Pisymbol{ftsy}{68}}}}
\put(29.8,61.4){\color{blue}\vector(-1,-3){2}}
\put(38.6,63){\color{blue}\vector(1,3){2}}
\end{overpic}
\end{document}
6.2 potrace
isatooltoconvertapureblackandwhitebitmaptovectorgraphics[8]. Fig.4
showsasamplebitmapconvertedtoavectorimage.
Figure4:Zoomedview:bitmap(left)convertedtovectorgraphics(right)
10
Documents you may be interested
Documents you may be interested