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

Export as pdf, causing random crash

$
0
0

I have a template document, I have modify the document from some other piece of code & tried to export template as pdf
My code is

 

bool16 ExportAsPDF(PMString pdfPath, UIDRef docRef)

{

     bool16 result = kFalse;

     do

     {

          std::cout << "Export As PDF" << std::endl;

          InterfacePtr<IDocument> doc(docRef, UseDefaultIID());

          ASSERT(doc);

          if(!doc)

               break;

 

          InterfacePtr<IWorkspace> workspace(GetExecutionContextSession()->QueryWorkspace());

          if( !workspace )

               break;

 

          InterfacePtr<IPDFExptStyleListMgr> listPDFStyles(workspace, UseDefaultIID());

          if( !listPDFStyles )

               break;

 

          // Get style index

          int32 styleIndex = listPDFStyles->GetStyleIndexByName("[PDF/X-1a:2001]");

          UIDRef styleRef = listPDFStyles->GetNthStyleRef(styleIndex);

 

          InterfacePtr<IPDFExportPrefs> appExportPrefs(styleRef, UseDefaultIID());

          if(!appExportPrefs)

               break;

 

          // Create pdf export cmd

          InterfacePtr<ICommand> pdfExportCmd(CmdUtils::CreateCommand(kPDFExportCmdBoss));

          if(!pdfExportCmd)

               break;

 

          InterfacePtr<IPDFExportPrefs> cmdExportPrefs(pdfExportCmd, UseDefaultIID());

          if(!cmdExportPrefs)

               break;

 

          cmdExportPrefs->CopyPrefs(appExportPrefs);

 

          InterfacePtr<ISysFileData> cmdSysFileData(pdfExportCmd, UseDefaultIID());

          if(!cmdSysFileData)

               break;

 

          cmdSysFileData->Set(FileUtils::PMStringToSysFile(pdfPath));

 

          InterfacePtr<IUIFlagData> cmdUIFlagData(pdfExportCmd, UseDefaultIID());

          if(!cmdUIFlagData)

               break;

 

          cmdUIFlagData->Set(kSuppressUI);

 

          UIDList outputList(::GetDataBase(doc));

 

          if(cmdExportPrefs->GetPDFExReaderSpreads() != IPDFExportPrefs::kExportReaderSpreadsON)

          {

               InterfacePtr<IPageList> pageList(doc, UseDefaultIID());

               for( int32 i = 0; i < pageList->GetPageCount(); ++i )

               outputList.Append(pageList->GetNthPageUID(i));

          }

          else

          {

               InterfacePtr<ISpreadList> spreadList(doc, UseDefaultIID());

               for(int32 i = 0; i < spreadList->GetSpreadCount(); ++i)

               outputList.Append(spreadList->GetNthSpreadUID(i));

          }

 

          InterfacePtr<IOutputPages> cmdOutputPages(pdfExportCmd, UseDefaultIID());

          if(!cmdOutputPages)

          break;

 

          cmdOutputPages->Clear();

          cmdOutputPages->SetMasterDataBase(::GetDataBase(doc));

          cmdOutputPages->SetIsSpreads(kFalse);

          cmdOutputPages->InitializeFrom(outputList, kFalse);

 

          UIDRef docRef = ::GetUIDRef(doc);

 

          ErrorCode errCode = CmdUtils::ProcessCommand(pdfExportCmd);

          if (errCode != kSuccess)

          {

               ErrorUtils::PMSetGlobalErrorCode( kSuccess );

          }

          else

          result = kTrue;

     }while(false);

     return result;

}

 

It is crashing randomly for some documents. I can't figure out the problem.

 

If some one can suggest some other way of exporting the document ( other than using service registry, I have that also) please tell

Or if  someone can point me out for my mistake in this code please tell.

Please help


Programatically determine installation location for InDesign CS3, CS4, CS5, AND CS5.5 (Windows)

$
0
0

We build plug-ins for all versions of InDesign from CS3 and later, for Windows and Mac.

 

To deploy our plug-in(s) on Windows, we use InstallShield, which has a somewhat complicated mechanism to locate InDesign.exe and determine its version so we know which plug-in(s) to install, but basically, the location is determined (via the RegLocator table in InstallShield) based on this registry setting:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\InDesign.exe

 

This has been working fine for all versions of InDesign since CS2.  However, that location is apparently no longer set by the InDesign CS5.5 installer.  So, we need to find some other way of programatically locating InDesign CS5.5 with our installer.

 

I've searched the registry of a machine with InDesign CS5.5  installed, and there are other registry entries related to InDesign, but those  entries are not set by earlier versions of the InDesign installer.  Ideally, there would be a registry setting, or some other reliable marker we can use to locate the InDesign installation, which is consistent across all versions of InDesign (at least back to CS3).

 

Using the registry setting is something we came up with on our own via  trial-and-error, since, as far as I know, there is no documented way to  locate the InDesign  installation folder.  (Our Mac installer uses a simpler mechanism to locate InDesign by the application name and version number.)

 

I find the apparent lack of documentation on this a bit ironic, since just about every other aspect of the SDK and the methods for creating InDesign plug-ins is extremely well documented, expect for the last final bit one needs to know to get to the promised land of actually deploying a carefully crafted plug-in to customers' machines.  (This seems to be true of the Acrobat SDK as well.)  However, I could have just missed the relevant documentation, in which case, please point me to it.

 

So, is there a recommended way to programatically  locate the InDesign installation location on Windows?  How are other people doing this in their installers?

Return value from ITransform::GetItemRotationAngle() and ITransform::GetItemSkewAngle()

$
0
0

Hi,

 

To figure out the ratation and skew angle of a page item, I used the ITransform interface on the page item, and call GetItemRatationAngle() and GetItemSkewAngle().

 

InterfacePtr<ITransform> itransform(pageItemUIDRef, UseDefaultIID());

PMReal rotation = itransform->GetItemRatationAngle();

PMReal skew = itransform->GetItemSkewAngle();

 

However, these API calls are not returning the values I expect. For example, if I make these calls on a box rotated by 30 degrees and then skewed by 10 degree, Instead of 30 and 10, the GetItemRatationAngle() returns 330, and the GetItemSkewAngle() returns -10.

 

Can someone confirm this and offer an explanation on this behavior?

 

Thanks,

 

Mingjian Song

Indesign Plugin Creation (advice needed)

$
0
0

Hi all,

 

We are now stepping in creation of plugin for indesign.

Before stepping in, I would like to clarify some doubts.

 

1. We are planning to create plugin for MAC and PC. (what are the software need to create plugin for MAC and PC)

2. Presently we have C++ and JAVA programmers (any other programmers needed)

3. Do I need to have membership in Adobe for creating plugin. (or we can do it with "Indesign CS6 Plugin SDK" itself)

 

Please advice.

 

Shaji

How to get current Table's parent textframe?

$
0
0

Hi all

 

I have ITableModel and got ITextModel via ITableTextContainer; thru textmodel i can get iframelist. But my question is how can get the exact parent textframe of the current table?

Pls suggest on this.

CS6 Eve Dialog & resize

$
0
0

Hi,

 

I'm looking at converting dialogs to EVE, I've got what seems a simple dialog - a table based list box, 2 buttons and the ability to resize.  The only way I've found to allow re-size is by having a DialogWindowSizeBoxWidget as before eve, I've got what seems sensible binding on the EVEGenericPanelWidgets all the rest has moved into, got kBindAll on the dialog, etc.  Result - the dialog resizes but the panels don't :-(

 

The dialog and widgets re-sized correctly in the old way...

 

Anyone able to help?

 

Ian

kLinkEmbedCmdBoss

$
0
0

Hello;

 

How to use the kLinkEmbedCmdBoss since it's not documented in the sdk

 

regards.

not able to run idletask instantly

$
0
0

Hi,

 

i created an idletask in following way-

InterfacePtr<TestIdleTask> test_task((TestIdleTask*)::CreateObject(kTestIdleTask,IID_ITestIdleTask));

if(test_task)

                              {

 

 

                                        test_task->UninstallTask();

                                        test_task->InstallTask(0);                    

}

 

 

its running properly, but issue is that it doesn't start instantly. its starts only after current running thread finishing. i.e i started the idle-task on before opening the document, and it starts running when documnt is fully opened. (i am doing some processing on documnt opening) and task is not able to run during this document opening process. how can I free the cycle for idle task?

 

please let me know if anyone faced such issues in past or have any idea about this?

 

Regards,

Harsh


In how many ways we can create new document and how to implements this ways?

$
0
0

I found that we can create new document by 3 ways

 

1)by using session object of application ,document list as follow

InterfacePtr<IApplication> firstdoc(GetExecutionContextSession()->QueryApplication());

          InterfacePtr<IDocumentList> docList(firstdoc->QueryDocumentList());

  docList->NewDoc(25089,IDataBase::ProtectionLevel.kProtectSave, nil);

but in this case i am not getting how to use newdoc method i.e which parameter we have to pass(not even clear from API reference )

 

2)by using command

InterfacePtr<IApplication> firstdoc(GetExecutionContextSession()->QueryApplication());

          InterfacePtr<IDocumentList> docList(firstdoc->QueryDocumentList());

  InterfacePtr<ICommand> new1(CmdUtils::CreateCommand(kNewDocCmdBoss));

          UIDList asd(docList);

          new1->SetItemList(asd);

          CmdUtils::ProcessCommand(new1);

 

3)bu using some util or facade interface

Utils<IDocumentCommands>()->New( . . .)

in this case also  i am not geeting how to use new method 

 

I try all this method but none of them working .i knew i am doing some mistake  in all these method so please correct me where i am wrong .

Main problem is in the first parameter of newdoc method i.e what is class id how to use them 

CS4 InDesign persistent data changes getting lost

$
0
0

Hi, We have some CS4 InDesign documents that lose the latest changes to persistent data once the odcument is closed. It appears as though the write to persistent data is reverted to previoue version once the file is opened again.......... appreciate any thought on why this is happening!

Thanks in advance!

InDesign crash while applying character style

$
0
0

Hi all,

 

 

A)I have problem with applying character style to selected text.

 

 

when character style is applied to selected text indesign get crashes.

 

 

my code snippet is as follow

 

 

input parameters

1.RangeData paraRange // start and end index of paragraph

2.storyUIDRef // uidref of current story

 

 

          code snippet

          // valid text model

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

          if (!textModel)

   break;

          //wax strand

          InterfacePtr<IWaxStrand> waxStrand(((IWaxStrand*)textModel->QueryStrand(kFrameListBoss, IID_IWAXSTRAND)));

          if (waxStrand == nil)

   break;

          //WaxIterator

          K2::scoped_ptr<IWaxIterator> waxIterator(waxStrand->NewWaxIterator());

          if (waxIterator == nil)

    break;

          //first wax line of paragraph

          IWaxLine* waxLine = waxIterator->GetFirstWaxLine(paraRange.Start(nil));

          //iterate each waxline

          while (waxLine != nil && (waxLine->TextOrigin() < paraRange.End()))

          {

    //Iterate for all runs

   K2::scoped_ptr<IWaxRunIterator> waxRunIter( waxLine->QueryWaxRunIterator() ) ;

   IWaxRun * waxRun = waxRunIter->GetFirstRun();

   while (waxRun)

                    {

   int32 startPos  = waxRun->TextOrigin();

   int32 endPos = startPos + waxRun->GetCharCount();

   RangeData textRange(startPos ,endPos);

   ISelectionManager* selMgr = m_activeContext->GetContextSelection();

   if(!selMgr)

    break;

   //get valid textselection suite

  InterfacePtr<ITextSelectionSuite> suite(selMgr, UseDefaultIID());

                              if (!suite)

   break;

                              //select  text

  suite->SetTextSelection(storyRef, textRange, Selection::kScrollIntoView, nil);

                              //created style from selection using  " SnpManipulate::TextStyleCreateStyleFromSelection" method.

                    }

          }

 

my code get crashed at highlighted text( int32 startPos  = waxRun->TextOrigin();).

 

 

B)my next question is how to get textstyle ranges of a selected paragraph.

 

please help me.

 

Thanks

Tahir

PDAnnot and CosObj

$
0
0

Hello,

 

Am I correct in thnking that if I want to acess these PDF structures I will need to have the PDFLib SDK.

 

P.

help on parsing InDesign file in java

$
0
0

Hello,

I am trying to parse a InDesign (indd) file in a Java class.

Is there any way how to do it.

 

Please help.

 

Thank You.

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 place a Xml in selected text frame?

$
0
0

When i set default text frame below code working fine, if i not mention the default text frame is not placing

 

do {

 

  // +precondition

                    InterfacePtr<IDocument> document(documentUIDRef, UseDefaultIID());

                    ASSERT(document);

                    if(!document) {

  break;

                    }

  // -precondition

 

  InterfacePtr<ICommand> importCmd(CmdUtils::CreateCommand(kImportXMLFileCmdBoss));

                    ASSERT(importCmd);

  InterfacePtr<IImportXMLData> importXMLData(CreateObject2<IImportXMLData>(kImportXMLDataBoss));

                    ASSERT(importXMLData);

                    if(!importXMLData) {

  break;

                    }

                    importXMLData->Set(documentUIDRef.GetDataBase(), contentFile, xmlReferenceWhere, kSuppressUI);

  InterfacePtr<IXMLImportOptions> docXMLOptions( document->GetDocWorkSpace(), UseDefaultIID() );

                    ASSERT(docXMLOptions);

                    if(!docXMLOptions) {

  break;

                    }

  InterfacePtr<IXMLImportOptions> importXMLOptions(importXMLData, UseDefaultIID());

                    ASSERT(importXMLOptions);

                    if(!importXMLOptions) {

  break;

                    }

                    importXMLOptions->Copy(docXMLOptions);

 

 

  InterfacePtr<IPMUnknownData> pmUnknownData(importCmd, UseDefaultIID());

                    ASSERT(pmUnknownData);

                    if(!pmUnknownData)

                    {

  break;

                    }

                    pmUnknownData->SetPMUnknown(importXMLData);

 

                    CmdUtils::ProcessCommand(importCmd);

                    ASSERT(err==kSuccess);

          } while(kFalse);

 

 

I need to mention frameUIDRef to flow the text in above code.

 

Please suggest any soluction or idea.


How to run a Plugin, without opening Adobe indesign

$
0
0

Hi,

 

Does anyone know how to run a plugin as a service or something like that...

 

What i want to do is,

 

    I have written a plugin that can read texts from indd files & save them as .txt files.

now i want to put indd files in to a folder & once a new file comes to the folder, read that new file automatically  and save as txt.

for that I want to run the plugin, without opening the indd file.

 

I hope CS6 SDK support to do that.

 

Please let me know if anyone has any idea...

 

Thanks.

Gettling linker error:LNK2001 while porting InDesign CS6 plugin code to InDesign CC plugin

$
0
0

Hello,

 

I am working on porting our existing InDesign CS6 plugin code to support InDesign CC plugin (client plugin on Windows platform)

 

The plugin code gets compiled successfully after makeing neccessory code (API) changes but now gettling following linker error

 

StackListBoxTVWidgetMgr.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: long __thiscall NodeID::GetNodeType(void)const " (__imp_?GetNodeType@NodeID@@QBEJXZ)

 

IBClientPluginDialogController.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall DVHostedWidgetEH::AddRef(void)const " (?AddRef@DVHostedWidgetEH@@UBEXXZ)

 

 

I have checked every configuration setting, all the paths to include headers and static libraries are pointing to InDesign CC SDK.

 

Note : Getting these linker errors in all the UI component class objects where following interfaces are inherited :

 

CTreeViewWidgetMgr

CIDEditBoxEventHandler

etc.

 

Build Environment :  Windows 7 ultimate + Visual Studio 2010 SP1 + InDesign CC Products SDK Build 244

Does the InDesign SDK support Xcode Unit Testing?

$
0
0

Hi All,

 

I'm looking to integrate a unit testing system with our two InDesign CC plugins within Xcode 4. 

 

Ideally, there would be a test target in each Xcode project that could run after each build and place the results in the Log Navigator.

 

I found that I could add a new Build Target using a Cocoa Unit Testing Bundle template for the project. When I included any of the headers from the InDesign CC SDK, however, I would get the following compilation error:

 

#include "IPMUnknown.h"

@implementation Debug_Cocoa64_UnitTest

- (void)setUp{
    [super setUp];
}

- (void)tearDown{
    [super tearDown];
}

- (void)testExample{
          STAssertTrue(false, @"Test Failed intentionally");
}

@end

 

Error: "Unknown type name 'PMIID'"     source/public/interfaces/architecture/IPMUnknown.h     source/public/interfaces/architecture/IPMUnknown.h:57:37: Unknown type name 'PMIID'     In file included from Debug_Cocoa64_UnitTest.mm

 

I checked my header paths of the new target, and the only thing that's independent of the Debug_Cocoa64 target is my Prefix Header.

 

Has anyone had any success pursuing the built in Xcode unit testing? I could also pursue an open source testing kit like GoogleTest or CppUnit, but I was looking for more integration with Xcode to have a build actually fail if the unit tests didn't pass.

 

I appreciate any suggestions or tips for this better coding practice.

 

Thanks,

 

Matt

Getting multiple panels in one extension

$
0
0

Hi,

I'm having trouble setting up multiple panels in my extension. I've seen similar posts on here but what fixed it for them doesn't seem to solve it for me!

My first panel appears fine, but clicking the menu option for the second one does nothing.

 

I have a WidgetBoss for each:

 

          Class

          {

                    kPanelAWidgetBoss,

                    kPalettePanelWidgetBoss,

                    {

                  IID_IPANELMENUDATA, kCPanelMenuDataImpl,

                    }

          },

 

          Class

          {

                    kPanelBWidgetBoss,

                    kPalettePanelWidgetBoss,

                    {

                  IID_IPANELMENUDATA, kCPanelMenuDataImpl,

                    }

          },

 

ALocaleIndex for each:

 

resource LocaleIndex (kPanelAResourceID)

{

          kViewRsrcType,

          {

                    kWildFS, k_Wild,           kPanelAResourceID + index_enUS

          }

};

 

resource LocaleIndex (kPanelBResourceID)

{

          kViewRsrcType,

          {

                    kWildFS, k_Wild,           kPanelBResourceID + index_enUS

          }

};

 

A separate PanelList for each:

 

resource PanelList (kPanelAResourceID)

{

          {

                    // 1st panel in the list

                    kPanelAResourceID,

                    kPluginID,

                    kNotResizable,

                    kPanelAWidgetActionID,

                    "",

                    kPanelAMenuPath,

                    kPanelAMenuItemPosition,

                    0,0,

                    c_Panel,

          }

};

 

resource PanelList (kPanelBResourceID)

{

          {

                    // 2nd panel in the list

                    kPanelBResourceID,

                    kPluginID,

                    kNotResizable,

                    kPanelBWidgetActionID,

                    "",

                    kPanelBMenuPath,

                    kPanelBMenuItemPosition,

                    0,0,

                    c_Panel

          }

};

 

A type definition:

 

type PanelAWidget(kViewRsrcType) : PalettePanelWidget(ClassID = kPanelAWidgetBoss)

{

          CPanelMenuData;

};

type PanelBWidget(kViewRsrcType) : PalettePanelWidget(ClassID = kPanelBWidgetBoss)

{

          CPanelMenuData;

};

 

And a definition for the resource itself:

 

resource PanelAWidget(kPanelAResourceID + index_enUS)

{

          __FILE__, __LINE__,                                                  // Localization macro

          kPanelAWidgetID,                                        // WidgetID

          kPMRsrcID_None,                                                            // RsrcID

          kBindNone,                                                                      // Binding (0=none)

          0, 0, 207, 95,                                                            // Frame: left, top, right, bottom.

          kTrue, kTrue,                                                            // Visible, Enabled

          kFalse,                                                                                // Erase background

          kInterfacePaletteFill,                                        // Erase to color

          kFalse,                                                                                // Draw dropshadow

          kPanelATitleKey,                                        // Panel name

          {

          }

 

          kInternalPopupMenuNameKey                    // Popup menu name (internal)

};

resource PanelBWidget(kPanelBResourceID + index_enUS)

{

          __FILE__, __LINE__,                                                  // Localization macro

          kPanelBWidgetID,                                        // WidgetID

          kPMRsrcID_None,                                                            // RsrcID

          kBindNone,                                                                      // Binding (0=none)

          0, 0, 207, 95,                                                            // Frame: left, top, right, bottom.

          kTrue, kTrue,                                                            // Visible, Enabled

          kFalse,                                                                                // Erase background

          kInterfacePaletteFill,                                        // Erase to color

          kFalse,                                                                                // Draw dropshadow

          kPanelBTitleKey,                                        // Panel name

          {

          }

 

          kInternalPopupMenuNameKey                    // Popup menu name (internal)

};

 

PanelB is nowhere to be seen.

I guess I'm missing something obvious. Can anyone help?

Thanks

Liz

(Windows) InDesign CS3 and CS4 plugins

$
0
0

Hello everyone:

 

   I have a number of plugins that must be maintained for IDCS3 and IDCS4--we still have customers that send in work for those versions.  Their projects compile and the results test out just fine in Windows XP, but if I port the projects over to Win7 the plugins don't even show up under the Plugins dropdown.

 

   In the past that has usually meant a resource issue.  I've checked the resources and they seem fine. 

 

   In the past I could ignore the problem and continue to maintain them on XP, but with the official demise of that stalwart OS coming screaming toward us, that is no longer an option.  I need to resolve this matter.  Does anyone have any thoughts on why CS3/4 Win plugins will not correctly compile on Win7 computers--or what the real problem may be (including a PEBKAC    )?

Viewing all 78596 articles
Browse latest View live


Latest Images