Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


How to place web link URL image into indesign graphic page item

Explorer ,
Jan 29, 2018 Jan 29, 2018

Copy link to clipboard

Copied

Hello All,

          I am trying to place simple web link url image into indesign graphic page item.The version SDK is CC 2017 on Mac. Steps are below

1.First I have converted web url into indesign URI (Note : I am using web browser preview jpeg link.)

2.From indesign URI I have created link resource UID.

3.With help of link resource UID and page item UID I have created bidirectional lik type.

4.Finally I have attached link.

5.I have tried to place file by kImportAndPlaceGunCmdBoss and SDKLayoutHelper to place the file by using created link resource but unable to see the image on document.

Problem: Its creating and linking page item successfully but unable to see image in frame. Also it showing "Macintosh HD" before http  url link.

              Is it required to download the web url image to relink?

Code is as below

        URI httpURI;    

        IDFile idFilehttp;

        PMString shttpFile("https://googlechrome.github.io/samples/picture-element/images/butterfly.jpg ");       

        FileUtils::PMStringToIDFile(shttpFile, idFilehttp);

       

       ObjectUtils objNew;

        UIDList objectUIDList = objNew.GetPageItemListNew(document);

        UID objectUID = objectUIDList[0];

        if (objectUID != kInvalidUID)

        {

            CAlert::WarningAlert("objectUID != kInvalidUID");

        }

             

        Utils<IURIUtils>()->IDFileToURI(idFilehttp,httpURI);

               

        UID resourceUID = kInvalidUID;

        PMString formatType("import");

        ErrorCode Err1 = Utils<Facade::ILinkFacade>()->CreateResource(db,httpURI,kIDLinkClientID,PMString(),resourceUID);

        if (Err1 == kSuccess)

        {

            CAlert::WarningAlert("Err1 == kSuccess");

        }

       

        if (resourceUID != kInvalidUID)

        {

            CAlert::WarningAlert("resourceUID != kInvalidUID");

        }

        UID linkUID = kInvalidUID;

        ErrorCode Err2 = Utils<Facade::ILinkFacade>()->CreateLink(db,

                             ILink::kBidirectional,kIDLinkClientID,

                             objectUID,resourceUID,kFalse,linkUID);

        if (Err2 == kSuccess)

        {

            CAlert::WarningAlert("Err2 == kSuccess");

           

            UIDRef ItemUIDRef(db,objectUID);

            InterfacePtr<IHierarchy> iHierarchy(ItemUIDRef,UseDefaultIID());

            for(int32 i=iHierarchy->GetChildCount(); i>0; i--)

            {

                UID iChildUID = iHierarchy->GetChildUID(i);

                Utils<Facade::ILinkFacade>()->AttachLink(UIDRef(db,iChildUID), linkUID);

            }

        }

       

//Case 1: Tried to place file

        InterfacePtr<IGeometry> pageGeometry (parentUIDRef, IID_IGEOMETRY);

        if (pageGeometry == nil)

            return;

        PMRect compareBox = pageGeometry->GetStrokeBoundingBox();       

        SDKLayoutHelper obj;

        UID uidPreview = kInvalidUID;

        UIDRef itemRef = obj.PlaceFileInFrame(idFilehttp,parentUIDRef,compareBox,kSuppressUI,kFalse,kFalse,kFalse,uidPreview);

        if (itemRef != UIDRef::gNull)

            CAlert::WarningAlert("itemRef != UIDRef::gNull");

Let me know if any one can help on this.

Thanks & Regards

Qamar

TOPICS
SDK

Views

1.9K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 25, 2021 Oct 25, 2021

Copy link to clipboard

Copied

Has anyone come up with a solution for this? I am having the same issue. I keep getting a kFileDoesNotExistError returned, but the url returns a valid image file.

Thanks!

Gregory

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 25, 2021 Oct 25, 2021

Copy link to clipboard

Copied

InDesign Links have to be on the local network. You can’t link to a URL—you would have to download the JPG or PNG and link to the local copy.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 25, 2021 Oct 25, 2021

Copy link to clipboard

Copied

Thanks Rob!

 

Can you post a simple example of how to download the image to the local drive?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 25, 2021 Oct 25, 2021

Copy link to clipboard

Copied

Don’t think there is a way to do it via scripting—not sure if there is a way to do it via the SDK.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 26, 2021 Oct 26, 2021

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 26, 2021 Oct 26, 2021

Copy link to clipboard

Copied

Thanks for the replies. We are actually do this with the SDK within a plugin, so I will have to figure out how to do this without scripting.

Thanks again!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 26, 2021 Oct 26, 2021

Copy link to clipboard

Copied

LATEST

I have tried to use the following code, but it always returns a null connection. Does anyone have any suggestions?

 

InterfacePtr<IHTTPLinkResourceConnection> connection = Utils<IHTTPLinkUtils>()->GetHTTPLinkResourceConnection(serverURI);

 

The value I am using for the serverURI is a valid URL whick I can hit without any issues.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines