22.03.2015 Views

DLI Implementation and Reference Guide - Datalogics

DLI Implementation and Reference Guide - Datalogics

DLI Implementation and Reference Guide - Datalogics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

11.8 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Inserting a EPS Image with dlpdfimagecreatefromps<br />

/* Open read the bitmap, <strong>and</strong> close the PostScript file */<br />

ImageFile = fopen ("Image.eps", "rb");<br />

fseek (ImageFile, Concepts 0, <strong>and</strong> SEEK_END); Facilities: <strong>Guide</strong> to the DL Pager Composition System<br />

ImageSize = ftell (ImageFile);<br />

fseek (ImageFile, 0, SEEK_SET);<br />

/* Allocate memory to hold the image */<br />

ImageString = malloc (ImageSize);<br />

fread (ImageString, 1, ImageSize, ImageFile);<br />

fclose (ImageFile);<br />

Image = dlpdfimagecreatefromps (Doc, "Grid", ImageString,<br />

ImageSize, FALSE);<br />

/* "Paste" the image into the container, centered over the<br />

* red box */<br />

dlpdfcontentreferenceimage (Content, Image,<br />

(fixedFour * 72) - ((Image->BBox.left + Image->BBox.right)/2),<br />

(fixedFour * 72) - ((Image->BBox.top + Image->BBox.bottom)/2),<br />

0, fixedOne, fixedOne);<br />

dlpdfimagecreatefrompdf<br />

This method will create an image from a PDF file. The image will be of a single<br />

specified page of the image document.<br />

• The first parameter is a h<strong>and</strong>le for the document in which this image is to be placed.<br />

• The second is the name of the file containing the PDF image page.<br />

• The third <strong>and</strong> fourth are ASFixed values giving the desired width <strong>and</strong> depth of the<br />

image. If either is 0, the PDF page's crop box is used to form the DLPDFIMAGE's<br />

visible region.<br />

• The fifth <strong>and</strong> sixth are ASFixed values giving the offset within the image<br />

document at which the image should be displayed, relative to the position at which<br />

the image page is set.<br />

• The last parameter is an integer which is used as a page number (starting from 1) to<br />

access the image document <strong>and</strong> to select the image page displayed.<br />

This segment of the complete <strong>DLI</strong> Graphics example inserts a PDF image into the<br />

document:

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

Saved successfully!

Ooh no, something went wrong!