IbexPDFCreator
DevelopersGuide
Images
105
Theparameters are:
prefix
The startof a URL, such as "http://www.xmlpdf.com". Any imageURL which
starts with this prefixwilluse these credentials.
username the username passed to the remote server
password the password passed to the remote server
domain
the domain name passed to the remote server
Each call to setNetworkCredentials() is passed a prefix which is compared with image
URLs to seewhich set of credentials to use.
For example if your application accesses two HTTP servers using different credentials
your code might look like the code in Figure 16-29. Obviously you would get the
username and password information from somewhere in your application rather than
hard coding them.
Figure 16-29:
Settingcredentials for
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 uses the System.Net.WebRequest and System.Net.NetworkCredential
objects to pass credentials to the remote server. If credentials have been passed to Ibex
using the setNetworkCredentials() method a new NetworkCredential object is created
when creating the WebRequest object. SO the actual forwarding of the credentials to
the remote server is alldone by the .NET framework.
Calls to setNetworkCredentials() should be made before the generate() method is
called.
16.10 Multi-page TIFF image processing
Ibex has an extension attribute "ibex:page" which is used to specify which page of a
multi-pageTIFF imageshould be included in the PDF file.
FO to placethe third page of a multi-page TIFF image is shown in Figure16-30.
Figure 16-30:
Specifyingthe page of
amulti-page TIFF
image
<block>
<external-graphic src="url('7pages.tif')" ibex:page="3"/>
</block>
Enable pdf thumbnails - application SDK utility:C# PDF Thumbnail Create SDK: Draw thumbnail images for PDF in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Support Thumbnail Generation with Various Options for Quick PDF Navigation
www.rasteredge.com
Enable pdf thumbnails - application SDK utility:VB.NET PDF Thumbnail Create SDK: Draw thumbnail images for PDF in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Support Thumbnail Generation with Various Options for Quick PDF Navigation
www.rasteredge.com
106
Images
application SDK utility:VB.NET PDF File Compress Library: Compress reduce PDF size in vb.
Embedded page thumbnails. outputFilePath = Program.RootPath + "\\" 3_optimized.pdf"; 'create optimizing for Monochrome Image 'to enable dowmsampling for
www.rasteredge.com
application SDK utility:C# PDF File Compress Library: Compress reduce PDF size in C#.net
Embedded page thumbnails. outputFilePath = Program.RootPath + "\\" 3_optimized.pdf"; // create optimizing Monochrome Image -- // to enable downsampling for
www.rasteredge.com
Scalable Vector Graphics (SVG) images
107
Chapter 17
Scalable Vector Graphics (SVG)
images
Ibex supports the inclusion of Scalable Vector Graphics (SVG) images in the PDF file. SVG
images retain their vector format inside the PDF file, so will remain precise under high
magnification unlikebitmap images which will be come pixellated.
SVG images are inserted into the document using either the <fo:external-graphic> or
<fo:instream-foreign-object>elements. Images can beincluded inlinelike this:
<fo:block border="1pt solid 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>
or from an externalfilelike this:
<fo:block border="1pt solid red">
<fo:external-graphic src="url(file.svg)"/>
</fo:block>
where the externalfilecontains the SVG image like this:
<?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>
If an image occurs more than once in the document it should beloaded from an external
fileso that itis only store in the PDF once.
17.2 Namespaces
The SVG image must begin with the <svg> element in the namespace
"http://www.w3.org/2000/svg". Images which do not declare the namespace will not be
included in the PDF.
application SDK utility:C# HTML5 PDF Viewer SDK to view, annotate, create and convert PDF
framework class. An advanced PDF editor enable C# users to edit PDF text, image and pages in Visual Studio .NET project. Support to
www.rasteredge.com
application SDK utility:C# HTML5 PDF Viewer SDK deployment on IIS in .NET
and set the “Physical path” to the place where you store XDoc.PDF.HTML5 Viewer Demo. Pool Defaults…" in the right panel, and set the value "Enable 32-Bit
www.rasteredge.com
Ibex PDF Creator
Developers Guide
108
Scalable Vector Graphics (SVG) images
17.3 Image size
Thesize of theimage should be specified using the width and heightattributes the outer
<svg> element. These can be absolute measurements such as "3cm" or scalar values
such as "400". Scalar values are assumed to be pixels and are converted to inches based
on 1 pixel = 1/96 inch. Percentages cannot be effectively used; the size of the block
containing the image is determined from the size of the image, at the time the image is
processed the sizeof the containing block is unknown.
17.4 Summary of supported elements
This section briefly documents the degree to which SVG elements are supported in Ibex.
It is not an SVG manual. Information on the SVG specification can be found at
http://www.w3.org/TR/SVG11/expanded-toc.html
Animation of SVG elements using javascriptis notsupported.
17.4.1 <svg>
The <svg> element is used to define the size and shape of the image (using the width
and height attributes) and to establish a new coordinate system using the viewBox
attribute.
17.4.2 <g>
The <g> element used to move the coordinate system using the transform attribute.
Supported transform operations are:
Operation
Effect
translate(x,y)
translate the coordinate system x units horizontally and y units
vertically
translate(x)
translate the coordinate system x units horizontally and zero
units vertically
matrix(a,b,c,d,e,f)
multiply the current transformation matrixby the one specified
scale(x,y)
scale the coordinate system x units horizontally and y units
vertically
rotate(angle)
rotate the coordinatesystem angledegrees aboutthe origin
rotate(angle,x,y)
rotate the coordinatesystem angledegrees aboutthe pointx,y
skewX(angle)
skew thecoordinate system angle degrees along the X axis
skewY(angle)
skew thecoordinate system angle degrees units along the Y axis
Multiple transformations can be performed by placing them one after the other in the
transform attribute, likethis:
<g transform="translate(10,20) scale(2,3) rotate(30)">
Transforms willbeapplied in theorder in which they appear.
application SDK utility:VB.NET PDF - VB.NET HTML5 PDF Viewer Deployment on IIS
and set the “Physical path” to the place where you store XDoc.PDF.HTML5 Viewer Demo. Pool Defaults…" in the right panel, and set the value "Enable 32-Bit
www.rasteredge.com
application SDK utility:C# PDF Page Rotate Library: rotate PDF page permanently in C#.net
Enable batch changing PDF page orientation without other PDF reader control. Support to overwrite PDF and save rotation changes to original PDF file.
www.rasteredge.com
Ibex PDF Creator
Developers Guide
Scalable Vector Graphics (SVG) images
109
17.4.3 <defs>
The <defs>element is supported as a container for other elements. See <symbol> below
for an example.
17.4.4 <desc>
The<desc> element is ignored.
17.4.5 <title>
The<title> elementis ignored.
17.4.6 <symbol>
The <symbol> element is supported. The following image shows an example of
definining a system using <symbol>and retrieving itusing <use>.
<?xml version="1.0" standalone="yes"?>
<svg width="10cm" height="3cm" viewBox="0 0 100 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> element will find the symbol element with id="#MySymbol" and display the
contentof this element, which should look likethis:
17.4.7 <use>
The <use> element is supported, see above for an example. Note that as this element
uses
the
xlink:href
attribute
it
is
necessary
to
declare
the
xmlns:xlink="http://www.w3.org/1999/xlink"namespace.
application SDK utility:C# Create PDF from OpenOffice to convert odt, odp files to PDF in
with XDoc.PDF SDK. Enable C#.NET Users to Create PDF OpenOffice Document (Odt, Ods, Odp) from PDF with .NET PDF Library in C# Class.
www.rasteredge.com
application SDK utility:VB.NET PDF metadata library: add, remove, update PDF metadata in
VB.NET PDF - Read and Write PDF Metadata in VB.NET. Enable VB.NET Users to Read, Write, Edit, Delete and Update PDF Document Metadata in Visual Basic .NET.
www.rasteredge.com
Ibex PDF Creator
Developers Guide
110
Scalable Vector Graphics (SVG) images
17.4.8 <image>
The<image>element is supported. This element embeds an image inside the SVG image.
For example this image will display a rectangle and on top of that display the image held
in thefile "use_symbol.svg":
<?xml version="1.0"?>
<svg width="4cm" height="2cm" viewBox="0 0 200 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> element is ignored.
17.4.10 <path>
The <path> element is supported. Internally PDF does not support quadratic Bézier
curves so they are converted to cubic Bézier curves. The following SVG draws a simple
curve with marked end points:
<?xml version="1.0" standalone="no"?>
<svg width="6cm" height="5cm" viewBox="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 Q400,50 600,300 T1000,300" fill="none" stroke="red"
stroke-width="5"
/>
<!-- End points -->
<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 to control points -->
<g fill="#888888" >
<circle cx="400" cy="50" r="10"/>
<circle cx="800" cy="550" r="10"/>
</g>
<path d="M200,300 L400,50 L600,300
L800,550 L1000,300"
fill="none" stroke="#888888" stroke-width="2" />
</svg>
application SDK utility:VB.NET PDF Text Extract Library: extract text content from PDF
Enable extracting PDF text to another PDF file, and other formats such as TXT and SVG form. OCR text from scanned PDF by working with XImage.OCR SDK.
www.rasteredge.com
application SDK utility:C# PDF Text Extract Library: extract text content from PDF file in
Enable extracting PDF text to another PDF file, TXT and SVG formats. Support extracting OCR text from PDF by working with XImage.OCR SDK.
www.rasteredge.com
Ibex PDF Creator
Developers Guide
Scalable Vector Graphics (SVG) images
111
Thecurve looks likethis:
17.4.10.1 Path line join shapes
The shape where a path changes direction is set with the stroke-linejoin attribute.
Possible values are:
Value
Shape
stroke-linejoin="miter"
Ibex PDF Creator
Developers Guide
112
Scalable Vector Graphics (SVG) images
17.4.12 <rect>
The<rect> elementis supported. A simple rectanglecan be drawn likethis:
<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>
resulting in this image:
Ibex PDF Creator
Developers Guide
Scalable Vector Graphics (SVG) images
113
17.4.14 <ellipse>
The<ellipse>element is supported. A simpleellipse can bedrawn like this:
<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>
resulting in this image:
Ibex PDF Creator
Developers Guide
114
Scalable Vector Graphics (SVG) images
17.4.15 <line>
The<line>element is supported. A simple linecan be drawn likethis:
<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>
resulting in this image:
Documents you may be interested
Documents you may be interested