asp.net open pdf file in web browser using c# : Reduce pdf file size control Library platform web page asp.net winforms web browser ibex7-part297

Fonts
65
Chapter10
Fonts
IbexsupportsTrueTypeandType1(Postscript)fonts.Fontinformationisreadfromthe
registryatruntime,noconfigurationoffontsisrequired.
Informationonhow tolistthe fontswhichIbexcanusecanbefoundintheusage
chapteronpage30.
Ibexreadstheregistrytoseewhichfontsareavailable.Specificallytheentriesunder
"HKLM\software\microsoft\windowsnt\currentversion\fonts"listavailablefonts,and
thoseunder"HKLM\software\microsoft\windowsnt\currentversion\fontsubstitutes"list
translationsfromfontnamestoexistingfonts.Anyofthefontnameslistedinthesetwo
placescanbeused.
In addition n Type 1 1 font names are read d from m "HKLM\software\microsoft\windows
nt\currentversion\type1installer\type1fonts". OnlyType1fontsthatcomeasaPFM
(metrics)andPFB(binary)pairoffilesaresupported.
10.1 HowIbexusesfonts
YourFOfilecontainsaseriesofletters.Eachofwhichisstoredinthefileasaoneortwo
bytecodepointsuchas65for'A'or0x8226forthebulletcharacter.
Ibexreads the TrueType orType 1font file andlooksinthe fontto see ifthefont
supportsthatparticularcodepoint.Ifitdoes,thenthefontmapsthatcodepointtoa
glyph,whichiswhatgetsdisplayed.
Notallfontssupportallcodepoints.Forexamplearial.ttfis370KBinsize,whereas
arialuni.ttfis23,000KB,becausearialunihasglyphsforamanymorecodepointsthat
arial.ttf.
Notallfontsmapacodepointtothesameglyph.Somefontsmapcodepointstheydo
notsupporttoaglyphsuchasthesquareboxone.
Reduce pdf file size - 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 comment box; best compression pdf
Reduce pdf file size - 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 file size of pdf; advanced pdf compressor online
66
Fonts
VB.NET Image: Image Resizer Control SDK to Resize Picture & Photo
easy and developers can shrink or reduce source image NET Image SDK supported image file formats, including & profession imaging controls, PDF document, image
pdf page size; change font size in pdf form field
C# Image: Zoom Image and Document Page in C#.NET Web Viewer
jpeg), gif, bmp (bitmap), tiff / multi-page tiff, PDF, etc so you can zoom any image or file page with Out" functionality is aimed to help users reduce the size
adjust size of pdf in preview; change font size pdf
Floats
67
Chapter11
Floats
Thefloatelementcanbeusedtopositionanimageorotherelementstothesideortop
ofthepageandcausetexttoflowaroundthatimage.
TheparagraphinFigure11-1usestwofloatelementstomaketheimageappearonthe
leftandrightsides,withthetextflowingaroundtheimagesbelowthem.
Figure11-1:
Leftandrightfloats
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis in
dolor quis s lectus cursus condimentum. Vestibulum id d nunc c vitae dui
semper ultrices. Mauris a mi. . Phasellus s eu lacus. Pellentesque eu
ligula mattis s odio faucibus s faucibus. Aliquam sit t amet
nunc laoreet tellus ullamcorper r malesuada. . Vestibulum
ante ipsum primis in faucibus orci i luctus s et ultrices
posuere cubilia Curae; ; Cras s nec c mauris. Proin cursus
tincidunt
leo.
Maecenas
metus
lacus,
imperdiet
fermentum,
blandit
at,
sollicitudin
eu,
sem.
Duis
elementum libero o vitae lacus. . Curabitur justo. . Aliquam erat t volutpat.
Maecenas nec c nulla in massa consectetuer volutpat. Aenean n turpis
nisl, rutrum m a, posuere e sit amet, varius s in, enim. Praesent risus.
Nam volutpat t enim eget neque. Maecenas s a a dui ac felis s nonummy y sollicitudin. Proin
iaculis. Vestibulum in eros sit amet libero mollis convallis. nunc laoreet tellus
ullamcorper malesuada. Vestibulum ante ipsum primis s in n faucibus orci luctus et
ultrices posuere
cubilia
Curae; Cras
nec
mauris.
Proin
cursus tincidunt
leo.
Maecenas metus s lacus, , imperdiet fermentum, blandit t at, sollicitudin n eu, sem. . Duis
elementum libero o vitae lacus. . Curabitur justo. . Aliquam erat t volutpat. Maecenas nec
nulla in n massa consectetuer volutpat. Aenean turpis nisl, rutrum a, posuere sit
amet, varius in, , enim. Praesent t risus. Nam volutpat t enim eget neque. . Maecenas s a a dui
ac felis nonummy sollicitudin. . Proin iaculis. . Vestibulum in eros sit amet libero
mollis convallis.
Thiseffectisachievedbyhavingablockwhichcontainsthetextandtwofloatelements.
The float elements in n turn n contain n a block-container element which has s a
inline-progression-dimensionattributedefiningthewidthofthefloatarea.Anyelements
insidetheblock-containerwillbeinthefloatarea.Ifablock-containerisnotusedwithin
thefloatandthewidthofthefloatcannotbedetermined,adefaultconfigurablevalueis
used.
TheFOforcreatingtheaboveisshowinFigure11-2.Figure11-2isitselfcontainedinsidea
floatwithfloat="before",whichwillmakeitappearatthetopofthefollowingpage.
Thistechniqueisusedinthismanualwhenwedonotwantalargeexampletobesplit
acrosspagebreaksortointerruptthecontent.Whenafloathasfloat="before",its
positioninthePDFfileisnotthesameasitspositionintheFOfile,inthatitwillbe
movedtothetopofthenextpageandtheblocksbeforeandafterthefloatwillflowas
ifthefloatwasnotthere.
Thesideonwhichthefloatoccursisspecifiedusingthefloatattribute.Thiscanbesetto
"left" or "right" topositionthe float at the side ofthepage. It canalsobe setto
"before"topositionthefloatatthestartofthenextpage.
.NET JBIG 2 SDK | Encode & Decode JBIG 2 Images
Highly-efficient data/image compression, 2-5 times than CCITT G3, CCITT G4; Simple to reduce PDF file size using JBIG2 compression within PDF;
adjust file size of pdf; acrobat compress pdf
How to C#: Special Effects
filter will be applied to the image to reduce the noise. LinearStretch. Level the pixel between the black point and white point. Magnify. Double the image size.
pdf compression; pdf custom paper size
IbexPDFCreator
DevelopersGuide
68
Floats
Sidefloats(withfloat="left"orfloat ="right")are closelytiedtotheblockwhich
containsthefloatelement.Ifthefloatelementdoesnotfitonthepage,thenthefloat
andsomeorallofthecontainingblockwillbemovedtothefollowingpage.Thisensures
thatthetextintheblockdoesnotreferto(forexample)animageinthefloatwhichis
notonthesamepageasthetext.
11.1 Howthefloatwidthiscalculated
Ibexlooksatthecontentofthefloatelementtotryanddeterminehowwidethefloat
shouldbe.Ifablock-containerelementisfounddirectlybelowthefloatelement,and
thisblock-containerhasawidthattribute,thenthatdeterminesthewidthofthefloat.If
nowidthcanbefound,thenthewidthofthefloatiscalculatedfrombymultplyingthe
containingblockwidthbySettings.SideFloatDefaultWidthPercentage,whichdefaultsto
30%.
Figure11-2:
FOforfloatexample
<block font-size="1.0em" text-align="justify">
<float float="left">
<block-container inline-progression-dimension="2.5cm">
<block text-align="center">
<external-graphic src="url(ibexorange.jpg)" " content-width="50%"
padding="3pt"/>
</block>
</block-container>
</float>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis in dolor quis lectus
cursus condimentum. Vestibulum id d nunc vitae
dui semper r ultrices. Mauris a mi. . Phasellus eu u lacus. . Pellentesque e eu ligula mattis
odio faucibus s faucibus. Aliquam m sit amet
<float float="right">
<block-container inline-progression-dimension="2.5cm">
<block text-align="center">
<external-graphic src="url(ibexorange.jpg)" " content-width="50%"
padding="3pt"/>
</block>
</block-container>
</float>
nunc laoreet tellus ullamcorper malesuada. Vestibulum m ante ipsum m primis in faucibus
orci luctus et ultrices s posuere e cubilia Curae; Cras nec mauris. . Proin n cursus
tincidunt leo. Maecenas s metus s lacus, imperdiet fermentum, blandit at,
sollicitudin eu, sem. Duis elementum libero o vitae e lacus. Curabitur justo. . Aliquam
erat volutpat. Maecenas s nec c nulla a in n massa consectetuer volutpat. Aenean turpis
nisl, rutrum a, posuere e sit t amet, , varius s in, enim. Praesent risus. Nam volutpat
enim eget neque. Maecenas a dui ac felis nonummy y sollicitudin. . Proin n iaculis.
Vestibulum in n eros sit t amet libero mollis convallis. nunc laoreet tellus
ullamcorper malesuada. Vestibulum m ante ipsum m primis in faucibus s orci luctus s et
ultrices posuere e cubilia Curae; Cras nec mauris. . Proin n cursus tincidunt leo.
Maecenas metus s lacus,imperdiet fermentum, blandit at, , sollicitudin n eu, sem.
Duis elementum libero vitae lacus. Curabitur justo. Aliquam erat volutpat.
Maecenas nec c nulla a in n massa consectetuer volutpat. Aenean turpis nisl, rutrum a,
posuere sit amet, varius in, , enim. . Praesent t risus. . Nam volutpat t enim eget neque.
Maecenas a a dui ac felis s nonummy y sollicitudin. Proin iaculis. Vestibulum in eros
sit amet libero o mollis convallis.
</block>
VB.NET Image: Compress & Decompress Document Image; RasterEdge .
reduce Word document size according to specific requirements in VB.NET; Scanned PDF encoding and decoding: compress a large size PDF document file for easier
best online pdf compressor; change font size fillable pdf
VB.NET Image: How to Zoom Web Images in Visual Basic .NET Imaging
out" functionality allows VB developers to easily reduce the size gif, tiff and bmp) or document (PDF, multi-page you want to view your document file or image
optimize scanned pdf; change font size pdf form reader
SpaceHandling
69
Chapter12
SpaceHandling
XSL-FOdefinesvariousattributesformanagingwhitespaceinFO.Theseallowyouto
controlhowlinefeedsandwhitespaceareoutput.
12.1 Linefeedsandcarriagereturns
Alinefeedisa characterwithASCIIcode 10, orUnicodecode pointU+000A. Thisis
differenttoacarriagereturnwhichhasASCIIcode13.Ibexactsonlinefeeds,noton
carriagereturns.CarriagereturnsareignoredduringPDFcreation.
12.2 Defaulttreatmentoflinefeedsandspaces
Bydefaultlinefeeds andwhitespace preceding andfollowing linefeedsare removed
duringformatting.Figure12-1showsFOwhichhaslinefeedsattheendofeachline.The
resultingoutputshowninFigure12-2hasneitherlinefeedsnorspacesaroundthetext.
ThisisthedefaulttreatmentfortextinXSL-FO.
Figure12-1:
Textwithlinefeeds
andspaces
<block margin='2cm'>To o be, , or not to be: that is the e question:
Whether 'tis nobler r in n the e mind to suffer
The slings and arrows of outrageous fortune,
Or to o take arms against a sea of f troubles,
</block>
Figure12-2:
Outputwithdefault
handlingTo be, or not t to o be: that is s the e question: Whether 'tis nobler in the mind to suffer
The slings s and arrows of outrageous fortune, Or to take arms against t a a sea of
troubles,
12.3 Usinglinefeedstobreaktext
Thelinefeed-treatmentattributeisusedtospecifythetreatmentoflinefeedsintext.
Thisdefaultsto"ignore"causinglinefeedstobeignored.Wecanretainthelinefeedsby
settingthelinefeed-treatmentattributeto"preserve".Figure12-3showsourexample
withthisattributeadded.Figure12-4showstheoutputfromthisFO.
View Images & Documents in Web Image Viewer | Online Tutorials
document or image file, like Word, PDF or TIFF View Image File via ZoomIn or ZoomOut Function. This ASP to help developers to decrease and reduce current zooming
can a pdf be compressed; can pdf files be compressed
VB.NET Image: How to Process & Edit Image Using VB.NET Image
Compact rich image editing functions into several small-size libraries that are VB.NET programmers the API to scale source image file (reduce or enlarge image
change font size in pdf file; reader compress pdf
IbexPDFCreator
DevelopersGuide
70
SpaceHandling
Figure12-3:
Using
linefeed-treatment
<block linefeed-treatment="preserve">To be, or not to be: : that is s the question:
Whether 'tis nobler r in n the e mind to suffer
The slings and arrows of outrageous fortune,
Or to o take arms against a sea of f troubles,
</block>
Figure12-4:
Outputwithlinefeeds
preservedTo be, or not t to o be: that is s the e question:
Whether 'tis nobler in the mind to suffer
The slings s and arrows of outrageous fortune,
Or to take arms against t a a sea of troubles,
12.4 Retainingspaces
Thewhite-space-treatmentandwhite-space-collapseattributesareusedtocontrolthe
handlingofspaces.
Ifwewanttoputsomeformattedcodeinourdocumen,Figure12-5showsFOforthis.
Figure12-5:
Codeexample
<block linefeed-treatment="preserve">
private void swap_byte( ( ref f byte x, , ref byte y ) {
byte t = = x;
x = = y;
y = = t;
}
</block>
Settinglinefeed-treatment="preserve"wegettheoutputshowinFigure12-6.Wehave
preservedthelinefeedsbutallformattingspaceshavegone.
Figure12-6:
Codewithlinefeeds
butnospacing
private void swap_byte( ( ref f byte x, ref byte y ) ) {
byte t = = x;
x = = y;
y = = t;
}
Thewhite-space-collapse attribute controlswhether Ibex compressesadjacentwhite
space charactersintoa single space. Bydefault anynumber ofadjacent spaces are
compressedintoasinglespace.
Thewhite-space-treatmentattributecontrolswhetherIbexignoresspacesadjacentto
linefeeds. Settingwhite-space-treatment= "preserve"makesIbexretainwhitespace
whichappearsadjacenttolinefeeds.
Ifwesetwhite-space-treatmentto"preserve",andwhite-space-collapseto"false"we
willretainthewhitespacesaroundthelinefeeds.TheFOforthisisshowninFigure12-7,
andtheformattedoutputisshowninFigure12-8.
Figure12-7:
FOtoretainspaces
andlinefeeds
<block
linefeed-treatment="preserve"
white-space-treatment="preserve"
white-space-collapse="false"
>
private void swap_byte( ( ref f byte x, ref byte y ) ) {
IbexPDFCreator
DevelopersGuide
SpaceHandling
71
byte t t = x;
x = y;
y = t;
}
</block>
Figure12-8:
Outputwithlinefeeds
butnospacing
private void swap_byte( ( ref f byte x, ref byte y ) ) {
byte t t = x;
x = y;
y = t;
}
12.5 Non-breakingspaces
UnicodedefinesthecodepointU+00A0calledNO-BREAKSPACE.Thiscanbeusedto
insert a space between wordswithout allowing a line break to occur between the
words.IbextreatstwowordsseparatedbyaU+00A0asasingleword.
Thenon-breakingspacecanbeinsertedintoXMLusingthe&#xA0;entity.
TheexampleinFigure12-9showsablockusedinatableheader.Itcontainsthethree
words"Scoreper100".ThedefaultformattingisshowninFigure12-10.Ifwewantto
movetheword"per"tothenextlinetokeepitwiththe"100",wereplacethespace
between"per"and"100"withanon-breakingspace.ThiswillpreventIbexbreakingthe
linebetweenthe"per"and"100"words.
Figure12-11showstheFOwithanon-breakingspaceandFigure12-12showstheresulting
output.
Figure12-9:
FOwithouta
non-breakingspace
<block-container width="2.8cm">
<block border="1pt t solid black"
padding="3pt" text-align="center">
Score per r 100
</block>
</block-container>
Figure12-10:
Outputwithouta
non-breakingspace
Score per
100
Figure12-11:
FOwithnon-breaking
space
<fo:block-container width="2.8cm">
<fo:block border="1pt t solid d black"
padding="3pt" text-align="center">
Score per&#xA0;100
</fo:block>
</fo:block-container>
Figure12-12:
Outputwitha
non-breakingspace
Score
per 100
72
SpaceHandling
Colors
73
Chapter13
Colors
XSL-FOdefinesvariousattributesformanagingcolor.Bydefaultablockisdisplayedwith
the foregroundcolor(thatis the text) being g blackand the e backgroundcolorbeing
white.
Colorsaremostcommonlyexpressed usingtheRGB B colorscheme, wherethere are
threepartstoacolor:red,greenandblue.IbexalsosupportstheCMYKcolorscheme
commonlyusedintheprintingindustry.
13.1 Textcolor
The color of f text is specified using the e color r attribute. . Figure 13-1 1 shows a simple
exampleofsomeFOtomaketextblue.TheoutputisshowninFigure13-2.
Figure13-1:
FOforbluetext
<block color="blue">
To be, or not to be: : that is s the question:
</block>
Figure13-2:
Bluetext
The resulting text will be e blue like this
13.2 Backgroundcolor
Thebackgroundcolorofanyelementisdefinedusingthebackground-colorattribute.
Figure13-3showsFOforablockwithagraybackground.Theoutputfromthisisshown
inFigure13-4.
Figure13-3:
FOforgray
background
<block background-color="gray">
To be, or not t to o be: that is s the e question:
</block>
Figure13-4:
Graybackground
The resulting text will have a a gray background like this
IbexPDFCreator
DevelopersGuide
74
Colors
13.3 Availablecolors
Thevalueusedforthecolorandbackground-colorattributescanbeapredefinedcolor
suchas"red",anRGBcolordefinedusingahexvaluesuchas"#eeffdd"oraCMYKcolor.
13.3.1 Predefinedcolors
XSL-FOusesthelistofcolorsdefinedforHTML4.0,whichcontainsthesevalues:
aqua
ibex
black
ibex
blue
ibex
fuchsia
ibex
gray
ibex
green
ibex
lime
ibex
maroon
ibex
navy
ibex
olive
ibex
purple
ibex
red
ibex
silver
ibex
teal
ibex
white
ibex
yellow
ibex
13.3.2 HexadecimalRGBcolors
Acolorcanbedefinedasastringofsixdigitsprecededbya"#"character.Thefirsttwo
digitsdefinetheredcomponentofthecolor,inarangefrom0to255.Thesecondtwo
digitsdefinethegreencomponentandthelasttwodigitsdefinethebluecomponent.
ThisisthesameschemefordefiningcolorsasisusedinHTML.
13.3.3 CMYKcolors
CMYK colors s are e four-part t colors usingvalues for cyan, magenta, , yellow w and black
respectively. The CMYK systemis subtractive, meaningthat higher valuesmeanless
color,unlikeRGBwherehighervaluesmeanmorecolor.CMYKcolorsareusedinthe
printingindustrytodefineacolorwhichwillappearthesameacrossallmedia.Typically
acolordefinedusingRGBwillnotappearexactlythesameonthe screenandona
Documents you may be interested
Documents you may be interested