IbexPDFCreator
DevelopersGuide
Images
105
Theparametersare:
prefix
ThestartofaURL,suchas"http://www.xmlpdf.com".AnyimageURLwhich
startswiththisprefixwillusethesecredentials.
username theusernamepassedtotheremoteserver
password thepasswordpassedtotheremoteserver
domain
thedomainnamepassedtotheremoteserver
EachcalltosetNetworkCredentials()ispassedaprefixwhichiscomparedwithimage
URLstoseewhichsetofcredentialstouse.
ForexampleifyourapplicationaccessestwoHTTPserversusingdifferentcredentials
your code might t look k like the code in n Figure 16-29. Obviously you u would get the
usernameandpasswordinformationfromsomewhereinyourapplicationratherthan
hardcodingthem.
Figure16-29:
Settingcredentialsfor
differentservers
FODocument doc = new FODocument()
doc.setNetworkCredentials( "http://www.xmlpdf.com","user1","password1","domain1" );
doc.setNetworkCredentials( "http://www.ibex4.com","user2","password2","domain2" );
Internally Ibex x uses the e System.Net.WebRequest t and System.Net.NetworkCredential
objectstopasscredentialstotheremoteserver.IfcredentialshavebeenpassedtoIbex
usingthesetNetworkCredentials()methodanewNetworkCredentialobjectiscreated
whencreatingtheWebRequestobject.SOtheactualforwardingofthecredentialsto
theremoteserverisalldonebythe.NETframework.
Calls to setNetworkCredentials() should be made before the generate() method d is
called.
16.10 Multi-pageTIFFimageprocessing
Ibexhasanextensionattribute"ibex:page"whichisusedtospecifywhichpageofa
multi-pageTIFFimageshouldbeincludedinthePDFfile.
FOtoplacethethirdpageofamulti-pageTIFFimageisshowninFigure16-30.
Figure16-30:
Specifyingthepageof
amulti-pageTIFF
image
<block>
<external-graphic src="url('7pages.tif')" ibex:page="3"/>
</block>
Pdf page size limit - Compress reduce PDF size in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
C# Code & .NET API to Compress & Decompress PDF Document
change file size of pdf document; change font size pdf text box
Pdf page size limit - 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 paper size in pdf document; batch reduce pdf file size
106
Images
VB.NET PDF File Split Library: Split, seperate PDF into multiple
PDF document file to one-page PDF files or As String = Program.RootPath + "\\" 1.pdf" ' set split SplitOptions(SplitMode.BySize) ' limit the size of each
pdf text box font size; best pdf compressor online
C# PDF File Split Library: Split, seperate PDF into multiple files
options = new SplitOptions(SplitMode.BySize); //limit the size of each String inputFilePath = Program.RootPath + "\\" source.pdf"; //Page indexes to
pdf reduce file size; change font size in pdf file
ScalableVectorGraphics(SVG)images
107
Chapter17
ScalableVectorGraphics(SVG)
images
IbexsupportstheinclusionofScalableVectorGraphics(SVG)imagesinthePDFfile.SVG
imagesretaintheirvectorformatinsidethePDFfile,sowillremainpreciseunderhigh
magnificationunlikebitmapimageswhichwillbecomepixellated.
SVGimagesareinsertedintothedocumentusingeitherthe <fo:external-graphic>or
<fo:instream-foreign-object>elements.Imagescanbeincludedinlinelikethis:
<fo:block border="1pt solid d red">
<fo:instream-foreign-object>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20">
<rect width="10" " height="10" " fill="green"/>
</svg>
</fo:instream-foreign-object>
</fo:block>
orfromanexternalfilelikethis:
<fo:block border="1pt solid d red">
<fo:external-graphic src="url(file.svg)"/>
</fo:block>
wheretheexternalfilecontainstheSVGimagelikethis:
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20">
<rect width="10" " height="10" fill="green"/>
</svg>
Ifanimageoccursmorethanonceinthedocumentitshouldbeloadedfromanexternal
filesothatitisonlystoreinthePDFonce.
17.2 Namespaces
The SVG image must begin n with the e <svg> element in the namespace
"http://www.w3.org/2000/svg".Imageswhichdonotdeclarethenamespacewillnotbe
includedinthePDF.
C# PowerPoint: How to Set PowerPoint Rendering Parameters in C#
2007 or above) slide into PDF document or other rendering process if the slide/page is too REImage CropImage(Rectangle sourceRegion, Size targetSize); Bitmap
change font size on pdf text box; batch pdf compression
C# Excel: Customize Excel Conversion by Setting Rendering Options
0, (int)(originalWidth), (int)(originalHeight / 2)), new Size((int)(originalWidth the top half of Excel page to image to these file formats, like PDF, TIFF, SVG
change paper size in pdf; best way to compress pdf
IbexPDFCreator
DevelopersGuide
108
ScalableVectorGraphics(SVG)images
17.3 Imagesize
Thesizeoftheimageshouldbespecifiedusingthewidthandheightattributestheouter
<svg>element.Thesecanbeabsolutemeasurementssuchas"3cm"orscalarvalues
suchas"400".Scalarvaluesareassumedtobepixelsandareconvertedtoinchesbased
on1pixel=1/96inch. Percentages s cannot beeffectivelyused;the sizeoftheblock
containingtheimageisdeterminedfromthesizeoftheimage,atthetimetheimageis
processedthesizeofthecontainingblockisunknown.
17.4 Summaryofsupportedelements
ThissectionbrieflydocumentsthedegreetowhichSVGelementsaresupportedinIbex.
It is not t an SVG manual. . Information on n the e SVG specification n can be e found d at
http://www.w3.org/TR/SVG11/expanded-toc.html
AnimationofSVGelementsusingjavascriptisnotsupported.
17.4.1 <svg>
The<svg>elementisusedtodefinethesizeandshapeoftheimage(usingthewidth
and height attributes)andtoestablisha new coordinate systemusing theviewBox
attribute.
17.4.2 <g>
The<g>elementusedtomovethecoordinatesystemusingthetransformattribute.
Supportedtransformoperationsare:
Operation
Effect
translate(x,y)
translatethecoordinatesystemxunitshorizontallyandyunits
vertically
translate(x)
translatethecoordinate systemx unitshorizontallyandzero
unitsvertically
matrix(a,b,c,d,e,f)
multiplythecurrenttransformationmatrixbytheonespecified
scale(x,y)
scale the coordinate system m x x units s horizontally y and y units
vertically
rotate(angle)
rotatethecoordinatesystemangledegreesabouttheorigin
rotate(angle,x,y)
rotatethecoordinatesystemangledegreesaboutthepointx,y
skewX(angle)
skewthecoordinatesystemangledegreesalongtheXaxis
skewY(angle)
skewthecoordinatesystemangledegreesunitsalongtheYaxis
Multipletransformationscanbeperformedbyplacingthemoneaftertheotherinthe
transformattribute,likethis:
<g transform="translate(10,20) ) scale(2,3) rotate(30)">
Transformswillbeappliedintheorderinwhichtheyappear.
VB.NET Excel: VB Methods to Set and Customize Excel Rendering
treat every single Excel spreadsheet as a page in our the fixed image size ration that the size is limited Excel to other document files, like PDF with online
change page size of pdf document; change font size in pdf form field
IbexPDFCreator
DevelopersGuide
ScalableVectorGraphics(SVG)images
109
17.4.3 <defs>
The<defs>elementissupportedasacontainerforotherelements.See<symbol>below
foranexample.
17.4.4 <desc>
The<desc>elementisignored.
17.4.5 <title>
The<title>elementisignored.
17.4.6 <symbol>
The <symbol> element is supported. The e following image e shows an n example of
defininingasystemusing<symbol>andretrievingitusing<use>.
<?xml version="1.0" standalone="yes"?>
<svg width="10cm" " height="3cm" " viewBox="0 0 100 0 30"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="MySymbol" viewBox="0 0 20 20">
<rect x="1" " y="1" " width="8" height="8"/>
<rect x="11" y="1" width="8" height="8"/>
<rect x="1" " y="11" " width="8" height="8"/>
<rect x="11" y="11" width="8" height="8"/>
</symbol>
</defs>
<use x="45" y="10" width="10" height="10" xlink:href="#MySymbol" fill="blue" />
</svg>
The<use>elementwillfindthesymbolelementwithid="#MySymbol"anddisplaythe
contentofthiselement,whichshouldlooklikethis:
17.4.7 <use>
The<use>elementissupported,seeaboveforanexample.Notethatasthiselement
uses
the
xlink:href
attribute
it
is
necessary
to
declare
the
xmlns:xlink="http://www.w3.org/1999/xlink"namespace.
IbexPDFCreator
DevelopersGuide
110
ScalableVectorGraphics(SVG)images
17.4.8 <image>
The<image>elementissupported.ThiselementembedsanimageinsidetheSVGimage.
Forexamplethisimagewilldisplayarectangleandontopofthatdisplaytheimageheld
inthefile"use_symbol.svg":
<?xml version="1.0"?>
<svg width="4cm" height="2cm" viewBox="0 0 0 200 0 100"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg" version="1.1" preserveAspectRatio="none">
<rect width="300" " height="150" " stroke="red" " stroke-width="1" " fill="silver"/>
<image x="20" y="20" " xlink:href="use_symbol.svg" " width="100" " height="100"/>
</svg>
17.4.9 <switch>
The<switch>elementisignored.
17.4.10 <path>
The <path>element is supported. . Internally PDF doesnotsupport t quadratic Bézier
curvessotheyareconvertedtocubicBéziercurves.ThefollowingSVGdrawsasimple
curvewithmarkedendpoints:
<?xml version="1.0" standalone="no"?>
<svg width="6cm" height="5cm" viewBox="0 0 0 1200 600"
xmlns="http://www.w3.org/2000/svg">
<rect x="1" " y="1" width="1198" " height="598" " fill="none" " stroke="blue"
stroke-width="1" />
<path d="M200,300 0 Q400,50 0 600,300 0 T1000,300" fill="none" stroke="red"
stroke-width="5"
/>
<!-- End points s -->
<g fill="black" " >
<circle cx="200" cy="300" r="10"/>
<circle cx="600" cy="300" r="10"/>
<circle cx="1000" cy="300" r="10"/>
</g>
<!-- Control points and lines from end points s to o control points -->
<g fill="#888888" >
<circle cx="400" cy="50" r="10"/>
<circle cx="800" cy="550" r="10"/>
</g>
<path d="M200,300 0 L400,50 0 L600,300
L800,550 L1000,300"
fill="none" stroke="#888888" stroke-width="2" />
</svg>
IbexPDFCreator
DevelopersGuide
ScalableVectorGraphics(SVG)images
111
Thecurvelookslikethis:
17.4.10.1 Pathlinejoinshapes
The shape e where e a path h changes direction is set with the stroke-linejoin attribute.
Possiblevaluesare:
Value
Shape
stroke-linejoin="miter"
IbexPDFCreator
DevelopersGuide
112
ScalableVectorGraphics(SVG)images
17.4.12 <rect>
The<rect>elementissupported.Asimplerectanglecanbedrawnlikethis:
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="120" >
<rect x="10" " y="10" width="100" height="100" fill="none" stroke="red"/>
</svg>
resultinginthisimage:
IbexPDFCreator
DevelopersGuide
ScalableVectorGraphics(SVG)images
113
17.4.14 <ellipse>
The<ellipse>elementissupported.Asimpleellipsecanbedrawnlikethis:
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="200" >
<ellipse cx="100" cy="100" rx="75" ry="50" fill="none" stroke="black"/>
</svg>
resultinginthisimage:
IbexPDFCreator
DevelopersGuide
114
ScalableVectorGraphics(SVG)images
17.4.15 <line>
The<line>elementissupported.Asimplelinecanbedrawnlikethis:
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" >
<line x1="10" y1="10" x2="100" y2="10" stroke="blue" stroke-width="4"/>
</svg>
resultinginthisimage:
Documents you may be interested
Documents you may be interested