Import image using JS (preferred on document-level)

Hello,
I am going to implement a dynamic legend using JavaScript in Adobe Acrobat. The document contains a lot of layers. Every layer has an own legend. The origin idea is to implement the legend so, that it contains the images in a dialog box for the visible layers. I can only hide/show the layers by setting state to false or true (this.getOCGs()[i].state = false;) on document-level.
Question 1: Can I extract data from layer somehow  for legend establishing? I think no, as we only have these function on layers: getIntent(), setIntent() and  setAction(). Right? Therefore I decided to arrange it so, that all needed icons for every layer are saved in a folder with corresponding names. JavaScript should import the icons and I build the a dialog window with icons of visible Layers and place a text(description for this icon).
I tried all possibilities of image import described here: http://pubhelper.blogspot.com.au/2012/07/astuces-toolbar-icons-et-javascript.html. I got only one way (Convert the icons as hexadecimal strings). This way isn't good, as it is too much work to create with an other tool a hexadecimal string from a images and place it into a javascript code.
Unfortunately, I cannot import image using other methods:(. Since the security settings in Adobe are changed after version 7 or so, it is not possible to use functions like app.newDoc, app.openDoc, even app.getPath On document-level. I decided to implement the import on the folder level using trusted functions like this:
Variant 1:
var importImg = app.trustedFunction(function() {
    app.beginPriv();
    var myDoc = app.newDoc({
        nWidth: 20,
        nHeight: 20
        var img = myDoc.importIcon("icon", "/icon.png", 0);
        app.endPriv();
    return img;
var oIcon = importImg();
NotAllowedError: Security settings prevent access to this property or method.
App.newDoc:109:Folder-Level:User:acrobat.js
Variant 2:
var importImg = app.trustedFunction(function() {
       var appPath = var phPath = app.getPath({
        cCategory: "user",
        cFolder: "javascript"
       try {
               app.beginPriv();
        var doc = app.openDoc({
            cPath: phPath + "/icon.png",
            bHidden: true
         app.endPriv();
    } catch (e) {
        console.println("Could not open icon file: " + e);
        return;
        var oIcon = util.iconStreamFromIcon(doc.getIcon("icon"));
    return oIcon;
var oIcon = importImg();
Error: Could not open icon file: NotAllowedError: Security settings prevent access to this property or method.
The settings in Preferences->JavaScript-> JavaScript Security are disabled (Enable menu item JS execution privileges, enable global object security policy).
Question 2: Is it not allowed or should I change some other settings or use the import on any other way?
I tried all these possibilities with .jpg, .png, .pdf. with different sizes(big images and 20x20 pxls), It doesn't work.
Could somebody help me, as I spent a lot of time with trying different possibilities. It would be actually better to implement the main goal described above on document level, are there other possibilities to access images, maybe using xml or something else) (Question 3)?
Thank you and kind regards,
Alex

... After checking: I cannot delete my posts either.
I can see some sort of button "Actions" at the bottom of my replies, but it seems to be missing from a 'main' post. You may want to ask this in the Forum About Forums: Forum comments

Similar Messages

  • After importing images from my card using LR 5.4, the GPS data does not show in the metadata panel. However, when I look at the imported images using Bridge, the GPS data is visible. Anybody know why LR is not seeing the GPS data? Camera is Canon 6D.

    After importing images from my card using LR 5.4, the GPS data does not show in the metadata panel. However, when I look at the imported images using Bridge, the GPS data is visible. Anybody know why LR is not seeing the GPS data? Camera is Canon 6D.

    Ok, the issue seem to be solved. The problem was this:
    The many hundred files (raw and xmp per image) have been downloaded by ftp in no specific order. Means - a couple of files in the download queue - both raw and xmps. Most of the time, the small xmp files have been finished loading first and hence the "last change date" of these xmp files was OLDER than the "last change date" of the raw file - Lightroom then seem to ignore the existence of the xmp file and does not read it during import.(a minute is enough to run into the problem)
    By simply using the ftp client in a way that all large raw files get downloaded first followed by the xmp files, we achieved that all "last changed dates" of the xmp files are NEWER than the related raw files. (at least not older)
    And then LR is reading them and all metadata information has been set / read correctly.
    So this is solved.

  • Can't import images using iCloud on iPad and Mac

    Yes. I have followed the "easy" instructions of the Apple site for setting my up my icloud account and sign in with both devices. Yes I have seen every imaginable youtube video of how to's and followed the steps.  I am connected to the internet, signed in with icloud in both devices, ticked automatic upload of photos, photo sharing, etc. Now where do I find the images? are they automatically imported NO and if I enter icloud from the internet can I see my images NO!
    and if i followed the easy steps to import them using iphoto, it just says something stupid like "import the photos" yeah...how???!!

    I have an Ipad2 and a Macbook pro, latest software versions downloaded today
    Which software versions exactly? "latest" may depend on your hardware. MacOS X10.9.1)? iPhoto 9.5.1?.
    Othe fact is when i go to the icloud.com the photos are not there either. I made an album on the ipad and "shared" manually the photos for icloud and nope, it doesnt work.
    How did you share the album?
    You can share to a shared Photo Stream and publish that stream as a public webpage on your iCloud webpage. Is taht what you have done? Then you need to use exactly the url, that is given, when you publish the webpage. It is not linked on your iCloud page.
    If I wanted download manually the photos to iphoto I cant I cant because the icloud icon doesnt appear in the left menu of iphoto like the one you are showing, it doesnt display either a shared button like the one you have in your screen and it doesnt explain at all how to import images.
    Let's compare the settings on your Mac:
    In System Preferences - you say you are signed into iCloud, o.k.
    Did you enable the options for "Photos"?
    Check, if bot "My Photo Stream" and "Photo Sharing" are enabled.
    Otherwise iPhoto will not show the iCloud options.
    In iPhoto you should see the iCloud panel I posted as a Tab in the iPhoto Preferences panel.
    (My screenshots are done in iPhoto 9.5.1 and MacOS X 10.9.1)
    iCloud: Using and troubleshooting Shared Photo Streams
    Mac with OS X Mavericks v10.9 or later and either iPhoto 9.5 or Aperture 3.5

  • Lightroom 5 Darkens Photos after Importing Images Used with Different Camera [NOT SHOOTING IN RAW NOR B

    I seriously need help, my whole entire catalog of photos just got darkened for some reason after importing photos used with a different camera. What happened is that I imported photos taken with a different camera (Canon EOS 60D) and when I did that, it darkened all the rest of my photos (taken with Canon EOS Rebel T3). Why did this happen? This is making my photos insanely hard to edit.

    If you always want Camera Neutral picture style to be applied, then open one of your images that you have imported and have changed nothing else in Lightroom.  Set the camera profile to Camera Neutral and save new camera default settings.  Then whenever you import that setting will be applied to all of your images.
    If you don't always want that style, you could save a preset that applies the Camera Neutral picture style, and then you could choose to use that preset during the import process.
    It is simply a matter of determining your workflow and then setting things the way you want them to work.

  • [CS4 Win] - Import Image using kImportAndPlaceCmdBoss

    Hi,<br /><br />I am trying to import an image using kImportAndPlaceCmdBoss in CS4 Windows.<br />After settings all the values, InDesign crashes when I process the command.<br />Below is the source code which I am using - <br /><br />InterfacePtr<ICommand> importFileCmd(CmdUtils::CreateCommand(kImportAndPlaceCmdBoss));<br />if (importFileCmd == nil)<br />   break;<br /><br />InterfacePtr<IImportResourceCmdData> data(importFileCmd, IID_IIMPORTRESOURCECMDDATA);<br />if (data == nil)<br /> break;<br />     <br />IDFile myfile(PMString("C:\\1.jpg"));<br /><br />Utils<IURIUtils>()->IDFileToURI(myfile, fileURI);<br />          <br />data->Set(frame.GetDataBase(), fileURI, K2::kSuppressUI);<br /><br />InterfacePtr<IPlacePIData> placeData(importFileCmd, IID_IPLACEPIDATA);<br />if (placeData == nil)<br />     break;<br /><br />placeData->Set(frame, nil, kFalse);<br />          <br />err = CmdUtils::ProcessCommand(importFileCmd);<br /><br />I would really appreciate if anybody can help me on this ?<br /><br />Thanks in advance.<br /><br />Regards,<br />Rahul Rastogi

    I suspect the crash is coming from your nil PMPointList in IPlacePIData::Set. Try setting to something other than nil.
    For example use the bounds of the page item...
    PMPointList pointList(2);
    pointList.push_back(topLeft);
    pointList.push_back(rightBottom);
    placeData->Set(frame, &pointList, kFalse);
    I believe these would be bounds int he parent coordinates.
    I hope this helps!
    Heath Lynn

  • Getting an ORA-01003 error importing images using Apex import options

    I took an export of the images from my application (would be nice if this was included in the applicatoin export options)
    When I try to import, I get the following error
    Execution of the statement was unsuccessful. ORA-01003: no statement parsed
    begin wwv_flow.g_import_in_progress := true; end;
    ORA-01003: no statement parsed
    This worked for me on apex.oracle.com.. can't do it on any of my apex instances.
    I am able to import applications without a problem
    Any suggestions?

    Anyone have any ideas?

  • Import Image using AS3

    Hello,
    I am trying to figure out an easy way to load an image, from
    my machine, into a flash app. It is for a scrap booking website and
    customers need to be able to upload their own images or photos.
    Thanks!

    It would be a swf that launches from the website, then once
    in the swf, users can upload images from their local machines? Any
    advice?

  • Needed help in: how to import image in InDesign Server using Java Code

    New to InDesign Server.
    I am not been able to import image to document.
    I tried to import image using the sample snippets "PlaceTextFileInFrame.java".
    modified the line:
    String placefilepath = "C:\\placeFile.txt";
    to
    String placefilepath = "C:\\Image.jpg";
    myTextFrame.place(placefilepath);
    Is this the correct way to import image or there is another solution.
    1.The image gets imported but i am getting blur image(Zoomed image).
    2.The image gets imported to its original image width & height.
    3.I need to know how to set the image width & size.

    My Requirement is-- I ve to connect to msn search page in order retrieve the result set from msn search. The same code which I do pasted below is working for GOOGLE n YAHOO with minor changes.But not for MSN.., Can any one help me.
    I've pasted the code for msn..,
    import java.io.*;
    import java.net.*;
    public class File {
    public static void main(String[] args) throws IOException {
    Socket s = new Socket("search.live.com", 80);
    String query = "java";
    PrintStream p = new PrintStream(s.getOutputStream());
    p.print("GET /results.aspx?q=" + query);
    p.print("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0\r\n");
    p.print("Connection: close\r\n\r\n");
    InputStreamReader in = new InputStreamReader(s.getInputStream());
    BufferedReader buffer = new BufferedReader(in);
    String line;
    while ((line = buffer.readLine()) != null) {
    System.out.println(line);
    Edited by: Lijo_Java on Jul 13, 2008 9:03 PM

  • Why there is no function to send images using Bluetooth ?

    Well I was very much annoyed with my iphone when there were necessities of sending important images using bluetooth and transferring files, Well they should make something similar to it, Is there any solution well i think there might no .....
                                                                                         happy republic day 2015 and happy holi 2015

    Bluetooth and WiFi Settings are moving to a top-level Setting in iOS 6.
    You could just leave Bluetooth turned on. When not in use it has a negligible effect on battery life.

  • Way to verify if newly imported images ARE NOT already in database?

    i keep my images in Aperture on v3.4.5 on my Mac Pro and in the past have simply imported images using USB. after starting to use Photo Stream over the last two years it has seemed to me (just from a kind of naive look) that some of my images from my iPhone get imported to the MBP into Photo Stream (Aperture v3.5.1), some to the Mac Pro, and (i assume) some to both.
    it also appears to me that if you /change/ your settings for Do Not Import Duplicates from Yes to No, or from No to Yes, (i.e. check or uncheck this option) that it is very easy to ALSO end up (say for instance on my Mac Pro where all my images are supposed to be neatly stored) with /some/ of your images ONLY in the PhotoStream project /and/ also to have some other images in BOTH the Photo Stream projects /and/ in the "non-Photo Stream projects" (i.e. in "regular" projects).
    just having this latter issue basically makes a total mess of your database (since you have /some/ of your images /only/ in the Photo Stream projects) but if you add the former issue (some images only in the MBP database and some only in the Mac Pro database) then things are almost truly wrecked.
    so - what i would like to know is if i EXPORT images from my MacBook Pro and i then IMPORT them into the Mac Pro database should Aperture pick up duplicates if i have Do Not Import Duplicates checked? also, i would like to know if it is possible to VERIFY through some method whether the newly imported images are, or are not, already in the database.
    i am currently exporting images from the monthly dated Photo Stream projects on my MacBook Pro and then importing the images into the respective Photo Stream projects on my Mac Pro - and it does in fact seem to me that these photos do NOT exist in the Photo Stream projects on my Mac Pro. i say this since the new images get added to the Photo Stream project for that month with the next chronological number in that month (at least on my first month i have tested). they also do not seem to exist already in the Photo Stream database in, for instance, the next month which is where i would logically look for them. this then would mean that there is a very large amount of image loss in my database which is a problem.
    so what i would like to do is /check/ somehow to see if the images may in fact be already in the database but happen to have not made it into the Photo Stream project for the month (i.e. they /only/ exist somewhere else in the non-Photo Stream projects).
    note: for instance can i manually search somehow for "IMG_6789", which just came in with 250+ images in from "Feb 2013 Photo Stream" on my MBP and is now in "Feb 2013 Photo Stream" on my Mac Pro to verify whether this already exists or has been newly added?
    please not that i cannot visually search for anything because the database is too large and i do not know where this image may reside without searching or finding it through a Aperture command.
    THANKS

    hi leonie. thank you for this help.
    first can you please tell me if setting Photo Stream on my Mac Pro to ON and turning Do Not Import Duplicates to CHECKED/ON (say if i start new with Photo Stream) has the consequence of ONLY importing images to my PS projects via WiFI and that any time i hook up my phone via USB (as i /had/ been doing) Aperture will then only import anything that has NOT already been imported to PS projects and it will put this in a "non-Photo Stream project"? i mean, i have realized recently that turning this ON may have completely changed the way i import images and done so in a way that puts some images from Camera Roll in one place and some images in another place.
    i will divide up the rest into two parts:
    1. can you please tell me what the actual difference is between exporting images as Kind Versions and Kind Originals? i am (unfortunately) already doing this as Kind Versions and it appears to be working at least visually - by which i mean when i import photos in this manner to the Mac Pro that these images come into the monthly projects with images and file numbers that do not currently exist in this album. this means that these images (so far ALL of them) were in the laptop database but not on the desktop database (at least as far as Photo Stream is concerned which is all i can figure out right now).
    i think it is in fact possible that these images may exist elsewhere in the database (and that Aperture is not picking up the fact that these are duplicates for some reason) but unless i am missing something won't this simply mean that i have a FULL SET of images in the Photo Stream database? anyway, i am not sure which is better - to catch these coming in as duplicates and to not import them or to import them into the Photo Stream projects, have them all in the database in these projects, and to deal with how they exist out of the Photo Stream projects by putting them where they belong and then running a de-duplication routine.
    2. the issue that i have been able to understand (with your help) is that when i turned Photo Stream ON, that this Do Not Import Duplicates setting was somewhere buried in my UI independent of Photo Stream settings (which has it's own poorly explained and poorly understood settings) and that this was set to ON or it was set to OFF. if it was CHECKED/ON then i was /ONLY/ importing images to my PS projects which was a total 180 degree change from my normal Aperture methodology and simply put images into PS projects and NOTHING went into my normal projects to sort later as i had been doing. then to compound the issue - when i hooked up my iPhone it would ONLY import images that did /not/ get synced to Aperture and get uploaded to the PS projects and it would tell me how many were already imported and how many were new and APERTURE WOULD SPLIT THESE UP INTO non-PS projects and PS projects which basically makes a total mess of my database.
    i mean, what you were able to show me is that i DON'T KNOW what i had set originally but i think i had this setting set to OFF which would give me images both in the PS projects and in the non-PS projects as duplicates (assuming there weren't other issues) but i would ideally like to have had PS projects as just a kind of appendage or an unimportant piece of my database for reference only and to keep importing images via USB as i had done in the past and if this is what i had wanted (and if Photo Stream was implemented in an intuitive way that i as an intelligent computer person could understand) - well i would have set the do not import duplicates to OFF so that the PS images were duplicates of my normal USB imports.
    but this - as i write - makes me realize that it has the unintended consequence of letting me import CAMERA ROLL images that were not deleted into my "non-Photo Stream projects" which as you indicate i don't want so this setting seems like it sets up a classic catch 22.

  • Does illustrator list the images used in a particular file. I want to know the file names of the images used.

    Does illustrator CS5 list the images used in a particular document.
    By this I mean does it tell you the name of the actual images.

    But if the file has been embedded, the file name is lost.

  • Import Image tether plugin

    Lightroom by default comes up with Canon Tether plugin. Does it provide any SDK, using which we can build our own tether plugin that selectively takes files from an external source (server/folder)?
    I could find none on google search.
    Primarily, what I am looking for is building a plugin using which I can import files from a folder, once an image is added to the folder. It is the same as tether for camera, just that the image is taken from a folder rather than the camera. Thanks

    purijatin wrote:
    Primarily, what I am looking for is building a plugin using which I can import files from a folder, once an image is added to the folder. It is the same as tether for camera, just that the image is taken from a folder rather than the camera. Thanks
    It sounds like what you are looking for can already be done by either the File -> Auto Import menu item of Jeffrey Friedl's Folder Watch plugin.
    If you still want to build a plugin, there is no publicly available Tethering SDK so you can't directly mimic the Canon tethering plugin's approach to importing. You can import images using the main Lightroom SDK so you could still implement something like Jeffrey's plugin if you wish.
    Matt

  • Delete Document Level Script Using JavaScript?

    Hello all.
    Is there a way for a document level script to delete itself? I am running Adobe Acrobat Professional 11.
    My situation is that I am currently analysing data using a Java application. The Java application taylors a script to suit each specific PDF, and then inserts it into the PDF automatically. When the PDF is opened, the script runs once and then is no longer needed.
    As the script is no longer needed it would be preferred if the script could automatically be deleted. Is it possible the script has access to the field in which it is stored (e.g. doc.javascriptField = "";)? Or by some miracle, a delete function already exists?
    I think that due to the lack of need for such a function by general and advanced users I won't get the answer I am hoping for. But it is worth a shot. In the mean time, I am inserting a flag into the KeyWord field so that the script does not run twice. It works, but it is not exactly clean.
    Any help would be greatly appreciated.
    Thanks
    Jonny O

    My original idea of...
    stamper.addJavaScript("this.addScript("oneTimeScript", "app.alert('Annoying Popup')")");
    Did not work.
    However, while debugging I did come across the name given to a script added via iText (Java library). The default is "000000000000000". With any added scripts being incremented by 1. So the this.removeScript("ScriptName") function works perfectly.
    Thanks
    Jonny O

  • Document sizes vs. imported image sizes

    I have to export images and text from InDesign to Pages. The InDesign document is set at 64po 85p4 which is roughly 8.5 x 11.00 inches.
    I have my Pages doc set to 8.5 x 11.00 and my plan was to import the iInDesign pages as images and place on the Pages document so when I add text and images I can go by the images , follow?
    I figured that once I saved and hit Choose in Pages and import each image of each page from InDesign those would be the exact size of the document size in Pages 8.5 x 11.00 but it is not. If I manually change the imported images size to that It is way too big.
    So I also made an image in Photoshop  @ 8.5 x 11.00 and tried to import tp Pages, same thing happened so I need to know how I can export images that are 8.5 x 11.00  into a Pages document which is the same size.
    Anyone
    I hope I'm clear.
    RD

    John Mensinger wrote:
    Ctrl-Click the layer thumbnail in the Layers panel to load the layer's opaque pixels as a selection. Look at the Info panel to see the selection size.
    That will show where the layer has pixels not necessary the size and the info will show the canvas size. Free Transform is more likely to show the layers bounds.  Photoshop supports layer of any size. Layers in a document can be larger then smaller the and equal to canvas size a layer can be partially over the canvas and even completely off canvas.
    The web does not support layered image file formats and Photoshop ships with a plug-in "Fit Image" that can fit any image into an area for the web.  It can downsize|upsize image to fit within an area and maintain the documents canvas aspect ratio.  So you need not worry about layers all you need to to decide the area size you want to use on web pages and fit the your images to that area size.

  • HELP: How do I use iPhoto 08 to import images onto my iPhone 3G?

    Hi,
    I was wondering how best to import images into my iPhone 3G for viewing.
    Most of my image files are large high quality 2 -4 MB files.
    Is there an easy way to downsize the files for viewing on the iPhone 3G? Does iPhoto have a setting specific for import/export use with the iPhone?
    How do I set a specific photo as the phone's wallpaper and does it have to be specifically sized to use as wallpaper?
    I have read the iPhone 3G manual but it was less than helpful just saying "Use iPhoto to import photos onto your iPhone"...

    here is a thread with lots of discussion of this topic - http://discussions.apple.com/thread.jspa?threadID=1618079&tstart=105
    In general you make album(s) of the photos you want on the iPhone and sync the album(s)
    LN

Maybe you are looking for

  • How do you get your music to come up on another computer

    Ineedhelp

  • Does Oracle 10g express edition supports UTL_SMTP

    Currently i'm using ORacle 10g Express edition, is it possible to send an automatic email once a value updates a table. Does 10gExpress edition supports UTL_SMTP or UTL_MAIL. If supports let me know how to configure in 10gExpress edition .

  • IPhoto hangs when attempting to import certain CR2 files

    Hi everyone. After 3 months of owning and using my MacBook, I have finally found that iPhoto isn't a bad software at all, and I want to start using it. So of course the first thing I did was to import some recent photos I made. By now I have successf

  • Streaming result of cfpdf merge to browser, NOT file on server

    Hi guys, as my title suggests...I have a PDF document that was created with cfdocument...I then have used cfpdf to merge the results of that PDF with 2 other PDF's to make a final document...my question is, how to do get this resulting PDF to open in

  • Update statement issues.

    Hi there I have written this code, the idea is that it does the update only on a certain requirement.  However I can not get the update to run.  The value I get is still null in the column.  Even though I ask for it to be changed. If I run the update