Description
Specifies the image that the current PDFRichText object shall wrap around.
Applies to
Syntax
WrapImage(PDFImage image)
Return value
Long. Returns 1 if it succeeds, or -1 if it fails. For more errors, see the Error Codes.
Usage
PDFRichText can wrap around one or more images that are already added into the current PDF page. However, if a page has two images with the same name, the PDFRichText object can only wrap around the first image, and will ignore the existence of the second image (as the result ,the second image may be overlaid by the text).
Examples
This example adds an image, and a PDFRichText object to a PDFPage, and sets the wrapping of the PDFRichText object around the image:
PDFdocument lpdf_doc
PDFpage lpdf_page
PDFrichtext lpdf_rtext
PDFimage lpdf_image
lpdf_image = create PDFimage
lpdf_doc = create PDFdocument
lpdf_page = create PDFpage
lpdf_rtext = create PDFrichtext
string ssText
integer fhandle;
long fileLen;
long readSize
lpdf_rtext.width = lpdf_page.getwidth( )
lpdf_image.filename = "import\image1\1.jpg"
lpdf_image.setposition(50, 50)
lpdf_image.setsize( 200, 200)
//Read the text file in the current directory
fileLen = FileLength64("testdocument.txt")
fhandle = fileopen("testdocument.txt", textMode! )
blob readByte
readSize = fileReadEx(fhandle, readByte, fileLen)
ssText = string(readByte)
fileclose(fhandle)
//Add text content to the PDFRichText and image to the PDFPage
lpdf_rtext.addtextblock( ssText)
lpdf_page.AddContent( lpdf_image)
lpdf_rtext.wrapimage( lpdf_image)
lpdf_page.addcontent( lpdf_rtext)
//Get the count of the wrapped images
messagebox("The return value shall be 1", lpdf_rtext.getwrapimagecount( ))
lpdf_doc.addpage( lpdf_page)
lpdf_doc.save("D:\save\addwrapimage1.pdf")
See also


