Question

I added an image to PDF using $p->load_image (http://www.php.net/manual/en/function.pdf-fit-image.php). Now, I want to write JavaScript in it so that the user can manipulate image in the PDF. How can I get access to the image in PDF using Javascript?

Was it helpful?

Solution

Using PdfLib, add the following option to the load_image call:

"iconname=HelloImage" where HelloImage is the name of the image. The complete call would be,

$p->load_image('jpeg', 'C:/hello.jpg', "iconname=HelloImage");

In Javascript code, you can access it. For example,

var hello_image = this.getIcon("HelloImage");

Now hello_image points to the HelloImage.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top