Quantcast
Channel: Adobe Community : Popular Discussions - InDesign SDK
Viewing all 78596 articles
Browse latest View live

How to display missing plugin and plugin used in a document?

$
0
0

Hi,

 

I need to write a plugin to display missing plugin and plugin used in a document using IContentMgr.

 

Please help proceed further.....


How to change position of inline objects

$
0
0

Hello All,

 

I am trying to create an inline image frame within a text frame. and then I am trying to position the inline Image frame with Aboveline option.

But it doesn't work. I am able to sucessfully create the inline frame with help available in Snippet project. But when I try to set the position it fails not sure why. This is in InDesign CS6.

 

I am trying to do the following:

 

InterfacePtr<ITextModel> textModel(storyUIDRef, UseDefaultIID());
if(!textModel)

{
   break;
}
InterfacePtr<IGeometry> pageItemGeometry(frameUIDRef, UseDefaultIID());
if (pageItemGeometry == nil) {
        break;
}

 

  // Insert character in text flow to anchor the inline.
boost::shared_ptr<WideString> insertMe(new WideString);

insertMe->Append(kTextChar_Inline);
InterfacePtr<ITextModelCmds> textModelCmds(textModel, UseDefaultIID());
InterfacePtr<ICommand> insertTextCmd(textModelCmds->InsertCmd(whereTextIndex, insertMe));
status = CmdUtils::ProcessCommand(insertTextCmd);
if(status != kSuccess) {
        break;
  }

  // Change the page item into an inline.
InterfacePtr<ICommand> changeILGCmd(CmdUtils::CreateCommand(kChangeILGCmdBoss));
if (changeILGCmd == nil) {
        break;
}
InterfacePtr<IRangeData> rangeData(changeILGCmd, UseDefaultIID());
if (rangeData == nil) {
        break;
}
rangeData->Set(whereTextIndex, whereTextIndex);
InterfacePtr<IUIDData> ilgUIDData(changeILGCmd, UseDefaultIID());
if (ilgUIDData == nil) {
        break;
}
ilgUIDData->Set(frameUIDRef);
changeILGCmd->SetItemList(UIDList(textModel));
status = CmdUtils::ProcessCommand(changeILGCmd);

InterfacePtr<ITextModel> textModel(storyUIDRef, UseDefaultIID());
if(!textModel) {
        break;
}
InterfacePtr<IGeometry> pageItemGeometry(frameUIDRef, UseDefaultIID());
if (pageItemGeometry == nil) {
        break;
}

// Insert character in text flow to anchor the inline.
boost::shared_ptr<WideString> insertMe(new WideString);

insertMe->Append(kTextChar_Inline);
InterfacePtr<ITextModelCmds> textModelCmds(textModel, UseDefaultIID());
InterfacePtr<ICommand> insertTextCmd(textModelCmds->InsertCmd(whereTextIndex, insertMe));
status = CmdUtils::ProcessCommand(insertTextCmd);
if(status != kSuccess) {
        break;
}

// Change the page item into an inline.
InterfacePtr<ICommand> changeILGCmd(CmdUtils::CreateCommand(kChangeILGCmdBoss));
if (changeILGCmd == nil) {
       break;
}
InterfacePtr<IRangeData> rangeData(changeILGCmd, UseDefaultIID());
if (rangeData == nil) {
        break;
}
rangeData->Set(whereTextIndex, whereTextIndex);
InterfacePtr<IUIDData> ilgUIDData(changeILGCmd, UseDefaultIID());
if (ilgUIDData == nil) {
        break;
}
ilgUIDData->Set(frameUIDRef);
changeILGCmd->SetItemList(UIDList(textModel));
status = CmdUtils::ProcessCommand(changeILGCmd);

 

//this created an Inline frame

 

UIDList newList;

newList = changeILGCmd->GetItemListReference();

 

// trying to set the position through newList

 

In the snippet its with active selection which i don't have here. Thus am trying to use the newList. I also tried IAnchoredObjectData command with the newList. Even that is not successful.

 

Is there something wrong what i am doing.

 

If someone has already tried this before please do let me know.

 

Thanks all in Advance.

 

Regards

Farzana.

Accessing Image Data 'directly'

$
0
0

Hi,

 

Currently I'm using StreamUtil::CreatePointerStreamWrite in conjunction with the SnapshotUtils Export-function to fill a buffer of char* with encoded image data (TIFF) for further processing in memory. It works but I need some guidance to improve performance. A couple of questions:

 

1) Is there a way to directly address the raw, unencoded image data stored in some kind of multi-array representation like WxHxColorCh?

Maybe with the help of an own 'format class?

 

2) How can you determine the number of chars / bytes written to the buffer by ExportImageToTIFF() for example?

 

3) Images differ very much in size. Is there a clever way to pre-allocate the char* buffer?

 

3) I implemented SnapshotUtils (like in one of the sdk sample) not SnapshotUtilsEx because the latter doesn't honor the overprinting flag during testing  it seems (file export in low quality). SnapshotUtils (without Ex) isn't mentioned in the sdk's docu. Reason? Obsolete?

 

I appreciate any advice to get things into the right direction. Thanks.

InDesign Plugin File Drag & Drop

$
0
0

If the text file drag and drop on the frame in Document, text is put the frame.

At that time, can I know the frames uid or story of uid which is inside?

(I didn't drag and drop where frame is not exist)

Installer for plug-in that supports different InDesign versions on Windows

$
0
0

Hi!

 

We are producer and vendor of an InDesign plug-in that is available from CS6 to CC2015. We would like to build an installer for the plug-ins that installs it on Windows machines. (We already have a Mac version (and have been using Extension Manager for both platforms in the past).)

 

Does somebody have example code on how to do detect the InDesign version on the customer system? We are not yet fixed on an installer platform - so anything (e.g. WIX, NSIS, Inno Setup) would be welcome.

 

Thanks!
Etienne

How get Underline Type of Character?

$
0
0

This is function get attribute of TextRange:

template <class TextAttrType, class _Val_Type>

ErrorCode GetTextScriptProvider::GetTextAttribute(const InDesign::TextRange& textRange,

    const ClassID& attrClassID,

    _Val_Type& value)

{

  // Assume failure.

  value=0;

  ErrorCode status = kFailure;

  do

  {

  // Check if the text range is valid.

  if (textRange.IsValid() == kFalse)

  {

  //SNIPLOG("textRange is invalid - you must have some text selected first.");

  break;

  }

  // Query the text model and get the range data,

  InterfacePtr<ITextModel> textModel(textRange.QueryModel());

  RangeData rangeData = textRange.GetRange();

 

  // Query the compose scanner to access text attributes

  InterfacePtr<IComposeScanner> composeScanner(textModel, UseDefaultIID());

  if (composeScanner == nil)

  {

  ASSERT(composeScanner); break;

  }

   // Query attribute report interface

  int32 attrLen = 0;

  InterfacePtr<const IAttrReport> attrReport(composeScanner->QueryAttributeAt(rangeData, attrClassID, &attrLen));

  if (attrReport == nil)

  {

  //SNIPLOG("Could not find text attribute with Class ID 0x%X on the selected text!", attrClassID.Get());

  break;

  }

 

  // Query the attribute interface

  InterfacePtr<TextAttrType> attr(attrReport, TextAttrType::kDefaultIID);

  if (attr == nil)

  {

  //SNIPLOG("attr is nil! (Class ID 0x%X)", attrClassID.Get());

  break;

  }

 

  // Get the attribute value.

  const _Val_Type tempValue = attr->Get();

  value = tempValue;

  status = kSuccess;

  } while (false);

 

 

  return status;

}

 

This is my code get underline type, but it no working:

int16 underlineType;

res=GetTextAttribute<ITextAttrInt16, ITextAttrInt16::ValueType>(oCharRange, kTextAttrCharUnderlineTypeBoss,underlineType);

 

How get Underline Type of Character?

Linker command failed with exit code 1

$
0
0

I am working on Xcode 8.2.1 @, to build a indesign plugin .

Can anyone suggest which library i need to link , for below SnapshotUtilsEx.

I am calling SnapshotUtilsEX::Draw() method in HTTPHelper.cpp file.

Below is the linker error trace which i get , when I try to build my project.

 

 

Undefined symbols for architecture x86_64:

"SnapshotUtilsEx::Draw(int, unsigned int, PMReal const&, unsigned int, SnapshotUtils::Transparencies, IdleTimer*, std::__1::map<IDType<ClassID_tag>, PMReal, std::__1::less<IDType<ClassID_tag> >, std::__1::allocator<std::__1::pair<IDType<ClassID_tag> const, PMReal> > >*, unsigned int)", referenced from:

      HTTPHelper::ExportLayout(IDocument*, PMString, PMString) in HTTPHelper.o

 

 

Below is the code snippet where i am making a call to the method.

 

 

SnapshotUtilsEx snapshot(pageUIDRef, 1.0, 1.0, desiredRes, 16.0, bleedAmount, SnapshotUtilsEx::kCsRGB, kFalse);

     int errorCode = snapshot.Draw(IShape::kNoFlags, quality == SnapshotUtils::kSSJPEGGreatQuality&& desiredRes > 16.0 ? kTrue : kFalse, 1.0, desiredRes > 16.0 ? kTrue : kFalse, desiredRes > 16.0 ? SnapshotUtils::kXPHigh : SnapshotUtils::kXPLow);

 

Get the page number on which a resource link is

$
0
0

Hello,

 

I can iterate over an IPageList and I can iterate over the links in a ILinkManager.

But how can i know which link is on which page (page number)?

 

I'm not familiar with the UID and UIDRef system from InDesign.

Is there an interface overview somewhere to know which interface works with which together?

 

Thanks in advance

 

Regards


How to get the UIDRef Of Table Frame when I have UIDRef of rectangle which is in that table cell?

$
0
0

I have a Rectangle Frame in selection, I need the UIDRef of the Table frame(Text Frame) or the iTableModel. Please refer the image Below.

Rect.PNG

How to get iTabelModel, when I have UIDRef of a Rectangle which is inside that table Cell

$
0
0

I have the UIDRef of the Rectangle which is in selection. That rectangle is basically in Cell, and when user selects that Rectangle or the cell, I need UIDRef of container text Frame and iTableModel. When i queryParent() the rectangle the Object that i get is invalid.

ADOBE-FORUMS-01.PNG

Please refer the image placed above. Kindly help.

@dirk

Determine Image Position within it's containing graphic frame.

$
0
0
Hi,<br /><br />I am trying to obtain the offset of an image item within it's containing frame. i.e. if I set the top left co-ordiante to be x:10pt , y:10pt<br />I need to obtain this programatically.<br /><br />I have tried using Both the ITransformSuite and ITransformFacade without much luck. The values I am getting are not what I expect.<br /><br />I.e.<br /><br />>K2Vector<PMReal> i_x;<br />K2Vector<PMReal> i_y;<br /><br />>Utils<Facade::ITransformFacade>()->GetItemsTranslation( UIDList( imageRef ), Transform::InnerCoordinates(), &i_x, &i_y );<br /><br />always gives me 0,0 ( as you would expect ).<br /><br />>Transform::ParentCoordinates()<br /><br />Gives me a value but it doesn't seem to be relative to the top left of the containing image item.<br /><br />The strange thing is that if I create 2 image frames and import the same image, I get different values for the positions within the parent ( even if the positions of the images within their respective frames are the same in the InDesign"Control" panel  ).<br />But if I create a box and duplicate it and then import the images, I get the same values for the offsets ( although they are still not what I expect ).<br />This difference seems to be related to the original position a box is drawn with on the spread.<br /><br />Ultimately, I would like to obtain the scale, rotation, skew and offset of an image and then apply those same criteria to another image ( possibly on another document ).<br /><br />TIA,<br /><br />Mike.

How to Create an InterfacePtr from UIDRef??

$
0
0
Hi..

i have an UIDRef of an object. I want to create an Interface from that UIDRef. Someone please demonstrate me with a snippet..

thanks.

spread's IGeometry..confusion?

$
0
0
Hello All,

I am using
PMRect rect = IGeometry->GetStrokeBoudningBox() for all spreads one by one inside a document.
and I am printing the left,top,right and bottom values of it.I always get 0,1,0,1 for the above values recpectively.
i.e left and top are 0 and right and bottom are 1.

Why is it so? I was expecting values of kind 0,-396,612,396(refering to PG figure 51).As the rect coordinates are in the inner COS of the spread.And the origin of this COS is at the center of the spread.

Am I doing anything wrong while calculating or interpreting the geometry of the spread.?

Thanks and Regards,
Yopangjo.

How to get Image Coordinates in a Frame

$
0
0
Hi,

I want to retrieve Image Coordinates contained in a Frame.

I am able to get the frame coordinates through IGeometry but not the images.

Any help will be highly appreciated.

Regards,
Rahul Rastogi

problem in Getting Child Count And Child Reference of a Group [CS3/WIN]

$
0
0
Hi All,<br /><br />I have Created a group For Some pageItems using kGroupCmdBoss<br /><br />InterfacePtr<ICommand>groupItemsCmd(CmdUtils::CreateCommand(kGroupCmdBoss));<br />InterfacePtr<IGroupCmdData> groupCmdData ( groupItemsCmd, UseDefaultIID());<br />UIDList*list=new UIDList(grpList);//grplist contains UID of all items to be grouped<br />groupCmdData->Set(list);<br />ErrorCode status = CmdUtils::ProcessCommand(groupItemsCmd);<br /><br />Till here every thing is working fine.<br />But when i want to traverse through all group item using IHierarchy every time its giving child count as one.<br /><br />InterfacePtr<IHierarchy> child( groupRef,  UseDefaultIID() ); <br /><br />int32 grpchildCount = child->GetChildCount(); //always 1<br /><br />I am not getting why its  always return child count as 1. But the same code is working fine when i am creating group using click on Group In UI. <br /><br />Can any one tell me How Top Iterate through group in above case.???<br /><br />I think when i am executing Group command some document hierarchy is changing becoz of that i am getting issue??<br />any idea??

[CS3] How to get the parent spread of a page?

$
0
0
Hallo!

I have the page UID.

How to get the spread of this page?

Thanks,
Alois Blaimer

Getting correct coordinates for a rotated frame

$
0
0

Hi All,

 

I am trying to get the four coordinates(PMPoint) of a rotated image frame.

InterfacePtr<IGeometry> pGeometry (itemList.GetRef(iCOUNT) , IID_IGEOMETRY);
PMMatrix matrix = ::InnerToParentMatrix(pGeometry);
PMRect rPageItemBoxRect = pGeometry->GetStrokeBoundingBox(matrix);

 

When I use LeftTop() on rPageItemBoxRect, I was expecting to get the true X & Y values at that point as are visible on the Info palette.

The  LeftTop() .X() is ok but the LeftTop() .Y() is not the Y value at that point. It is the topmost Y of the frame which is actually the Y value for the RightTop corner.
Similarly all the values I am getting are wrong.
The X() gives the leftmost value of the frame for both LeftTop() and LeftBottom() , when they are different for the rotated frame.
And the X() gives the rightmost value for the frame for both RightTop() and RighBottom(),
Y() gives the topmost value for the frame for both LeftTop() and RightTop() and so on.

 

How can I get the actual box coordinates and not the bounding box coordinates, so that I get the correct X,Y values for all the four corners of my rotated frame as I can see them on the Info palette.

 

 

Regards,
Jasmine Shaikh

 

CC 2017 support not being recognised at submission time

$
0
0

I have a plugin which supports InDesign CS 5.5 through to CC 2017 on Mac and Windows.

Since adding support for CC 2015, I submit the zxp file to the add-ons website for installation.

 

I'm trying to add support for CC 2017 and running into problems at submission time.

When I upload the zxp and it has undergone analysis, the listed compatibility only goes up to CC 2015, not 2017 (on both windows and mac).

Clicking on Compatibility "Important Info" however shows support up to version 12.9, which is CC 2017.

When submitted, it comes back as rejected, saying it won't install to CC 2017.

 

The .InDesignPlugin and .pln files packaged into the zxp work fine with CC 2017 on all the mac and windows machines I've tried.

My mxi file lists 12.9 as the maximum version and copies the 2017 files to the application for 12.0 to 12.9.

I've tried removing the maxversion specification in the mxi to make it open ended and the same thing happens.

 

I don't know of a way to try the installation process my end as ExtensionManager only supports up to CC 2014.

I'm at a loss as to why 2017 is not being recognised. Can anyone help?

I want to create a simple docuement with 2 pages?

$
0
0

I want to my plugin to create a simple document as soon as My Plugin is loaded in Indesign. I have derived my class IStartupShutdownService  so that it's called in startup.

But this is failing at line 23 below.

What else do I need to include in my .fr file?

 

 

class LTestStartupShutdownServiceImpl : public CPMUnknown<IStartupShutdownService>
{
public:    LTestStartupShutdownServiceImpl(IPMUnknown* boss);    virtual ~LTestStartupShutdownServiceImpl();    virtual void Startup();    virtual void Shutdown();
};


CREATE_PMINTERFACE(LTestStartupShutdownServiceImpl, kLTestStartupShutdownServiceImpl)


LTestStartupShutdownServiceImpl::LTestStartupShutdownServiceImpl(IPMUnknown *boss):CPMUnknown<IStartupShutdownService>(boss)
{    do    {        const PMReal width=612, height=792;        const int32 numPages=5, numPagesPerSpread=1;        // Create the command.        InterfacePtr<ICommand> newDocCmd(Utils<IDocumentCommands>()->CreateNewCommand());  //<-----this is coming null and failing        ASSERT(newDocCmd);        if (newDocCmd == nil)            break;        // Set the command's parameterised data.        InterfacePtr<INewDocCmdData> newDocCmdData(newDocCmd, UseDefaultIID());        ASSERT(newDocCmdData);        if (newDocCmdData == nil)            break;        newDocCmdData->SetCreateBasicDocument(kFalse); // Override the following defaults.        PMPageSize pageSize( width, height);        newDocCmdData->SetNewDocumentPageSize(pageSize);        bool16 bWide = kTrue; // landscape orientation.        newDocCmdData->SetWideOrientation(bWide);        // Size margin proportional to document width and height.        PMReal horMargin = width / 20;        PMReal verMargin = height / 20;        newDocCmdData->SetMargins(horMargin, verMargin, horMargin, verMargin);        newDocCmdData->SetNumPages(numPages);        newDocCmdData->SetPagesPerSpread(numPagesPerSpread);        // Create the new document.        CmdUtils::ProcessCommand(newDocCmd);    }    while (false);
}


LTestStartupShutdownServiceImpl::~LTestStartupShutdownServiceImpl()
{}
void LTestStartupShutdownServiceImpl::Startup()
{}
void LTestStartupShutdownServiceImpl::Shutdown()
{}

 

Below is the .fr file:

/*
 * Boss class definitions.
 */
resource ClassDescriptionTable(kSDKDefClassDescriptionTableResourceID)
{{{


 Class
  {  kLTestStartupShutdownServiceBoss,  kInvalidClass,  {  // Implementation of IStartupShutdownService  IID_ISTARTUPSHUTDOWN, kLTestStartupShutdownServiceImpl,  // Implementation to IK2ServiceProvider to identify the service type as startup-shutdown  IID_IK2SERVICEPROVIDER, kLTestStartupShutdownServiceImpl,  }  };
}}};

long to int32 conversion issues in Xcode 5.0.2 when building plugin for Indesign CC 2014

$
0
0

Hi, I am trying to build one of the sample plugin WriteFishPrice from the SDK on mac System

I am using Xcode 5.0.2 as per the documentation, but I am encountering the below errors during compilation.

 

In UnicodeSavvyString.h

 

template <class FwdIterator>
inline void UnicodeSavvyString::assign_impl(FwdIterator b, FwdIterator e, size_type nCodePoints, std::forward_iterator_tag)
{  const difference_type nCodeValues = std::distance(b, e);  ASSERT(nCodeValues >= 0);

 // Make room for the chars
  code_value* buffer = GetBufferForWriting(nCodeValues);  // <----Implicit conversion loses integer precision long to int

 // Copy them into the buffer
  std::copy(b, e, buffer);

 // Ensure terminating null
  buffer[nCodeValues] = code_value();  fUTF16BufferLength = nCodeValues;                         // <----Implicit conversion loses integer precision long to int

 // Calculate how many code points we will have at the end
  if (nCodePoints == 0 && nCodeValues)  {  fNumChars = CountCharsUtil(buffer, nCodeValues);          // <----Implicit conversion loses integer precision long to int           }
 else  {  ASSERT((size_type)CountCharsUtil(buffer, nCodeValues) == nCodePoints);  fNumChars = nCodePoints;  }
}

 

And similar errors are coming in WideString.h.

 

Can some one tell me what is wrong with the new SDK? Or if I need to make some changes in these files which surely is not advisable.

Viewing all 78596 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>