简体   繁体   English

使用javascript将图像插入pdf(Adobe Acrobat Pro)

[英]Insert an image into pdf (Adobe Acrobat Pro) using javascript

This is what I want to do: 这就是我想做的:

.this.getField('imageField').importImage('path_to_img');

I know this code is not correct, but is there a way to do this? 我知道这段代码不正确,但是有办法吗? I couldn't find the solution in Acrobat's documentation. 我在Acrobat的文档中找不到解决方案。

I need to do it using javascript because path_to_image is a variable I'm pulling from a database... 我需要使用JavaScript来完成此操作,因为path_to_image是我从数据库中提取的变量...

I got an anwser on Adobe forums. 我在Adobe论坛上遇到了疑问。 Here is the full discussion: https://forums.adobe.com/message/8694023#8694023 这里是完整的讨论: https : //forums.adobe.com/message/8694023#8694023

var f = this.getField("btnImage");
f.buttonSetCaption("Title");
  if (f.buttonImportIcon("/C/image.pdf") == 0){  // if 0 == no error
      f.buttonImportIcon("/C/image.pdf");
  }

Also when you are setting a button you have to select an option "Icon only" for this to work. 同样,在设置按钮时,必须选择一个选项“仅图标”才能起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM