17.05.2014 Views

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Fig. 7.3 Fitting an image into a box subject to various fit methods<br />

Generated output Option list for fit_image( )<br />

a) boxsize={70 45} position=center<br />

b) boxsize={35 45} position=center<br />

c) boxsize={70 45} position=center fitmethod=meet<br />

d) boxsize={35 45} position=center fitmethod=meet<br />

e) boxsize={70 45} position=center fitmethod=entire<br />

f) boxsize={30 30} position=center fitmethod=clip<br />

g) boxsize={30 30} position={right top} fitmethod=clip<br />

Adjusting an object to the page. Adjusting an object to a given page size can easily be<br />

accomplished by choosing the page as target box for placing the object. The following<br />

statement uses an A4-sized page with dimensions 595 x 842:<br />

p.fit_image(image, 0, 0, "boxsize={595 842} position={left bottom} fitmethod=slice");<br />

In this code fragment a box is placed at the lower left corner of the page. The size of the<br />

box equals the size of an A4 page. The object is placed in the lower left corner of the box<br />

and scaled proportionally until it fully covers the box and therefore the page. If the object<br />

exceeds the box it will be cropped. Note that fitmethod=slice results in the object being<br />

scaled (as opposed to fitmethod=clip which doesn’t scale the object). Of course the<br />

position and fitmethod options could also be varied in this example.<br />

7.3.3 Orientating an Object<br />

Placing an image with orientation. In our next example we orientate an image towards<br />

western direction (orientate=west). This means that the image is rotated by 90˚<br />

counterclockwise and then the lower left corner of the rotated object is translated to the<br />

reference point (0, 0). The object will be rotated in itself (see Figure 7.6a). Since we have<br />

194 Chapter 7: Importing Images and PDF Pages (Edition for <strong>COM</strong>, .<strong>NET</strong>, and REALbasic)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!