Skip to main content
Known Participant
December 13, 2006
Question

How to paste a specific image in a specific page?

  • December 13, 2006
  • 12 replies
  • 1114 views
This topic has been closed for replies.

12 replies

Known Participant
December 19, 2006
Hai Oscar,

I have learned to place the any images in any page...

thanks for ur support....

Now the next step i want to do is...

i have to import a html file into document...

how shall i do it...

plzz give me idea to import a html file into the document..

thanks...

senthil
Known Participant
December 18, 2006
Hi senthil

"if i want to paste only fourth image in the database have to split the row...

How shall i split it? "

Can you be a little more specific?

Oscar.
Known Participant
December 18, 2006
Hi Oscar,

I found how to paste the specific image in the specific
page...

Thanks for ur help...

i had pasted the images directly to the 2nd page...

Without ur help i cant do it...

But i have to paste first 3 images in the 1st page...

And when the fourth image is in fetching, i have to paste
the fouth image in the 2nd page..

My database is mysql database...

the images are in the first row...

if i want to paste only fourth image in the database
i have to split the row...

How shall i split it?

plzz help me...

Us support and guidance will be very useful for me...

Or anybody else plzz help me..

Thanks..
senthil
Known Participant
December 16, 2006
Hai Bill,

Ya i'm trying to put the image in the 2nd page of 2nd spread...

But i dont know about facing pages... what is that?

ya i tried the above codes by using the index_training.html...

Do u know about pasting the image in the 2nd page of 2nd spread?

Plzz explain me...

And also about facing pages...

thanks for ur reply..

senthil.
Participating Frequently
December 15, 2006
I may be wrong here but I'm assuming that GetNthSpreadUID(1) is spread 2 and GetNthPageUID(1) is page 2. So from the code that you showed, it seems that you are trying to put the image in page 2 of spread 2 which is page 3 of the document if you are using facing pages.<br /><br />>UIDRef parentUIDRef(iDataBase,iSpreadList->GetNthSpreadUID(1)); <br />InterfacePtr <ISpread> iSpread (parentUIDRef,IID_ISPREAD); <br />int32 numOfPagesInSpread= iSpread->GetNumPages(); <br />UID pageUID=iSpread->GetNthPageUID(1); <br /><br />senthil, you might want to consider opening a developer support case.<br />Have you went through the InDesign/InCopy CS/CS2 online training content?<br />http://partners.adobe.com/public/developer/indesign/index_training.html
Known Participant
December 15, 2006
Hi Oscar,<br />i cleared the above errors....<br />But didnt get the output correctly...<br />the image is still pasting in the 1st page....<br />But i want to paste the image in the 2nd page...<br />But the image is pasting in differnt coordinates in the 1st page<br />after applying your codings...<br /><br />Here the codings i have used for importing an image in the 2nd page...<br />plzz tell me whatz wrong in this...<br />Itz too hard for a beginner like me..<br />plzz explain...<br /><br />while ((row = mysql_fetch_row(res_set)) != NULL){ <br /> tempfilename=row[0]; <br />target = "/";<br />replace = "\\" ;<br />s.Replace(tempfilename,target,replace); <br /> IDocument *iDocument =myContext->GetContextDocument();<br />IDataBase *iDatabase = ::GetUIDRef(iDocument).GetDataBase();<br />if (iDataBase == nil){<br /> ASSERT(iDataBase);<br /> break;<br /> } <br />ILayoutControlData *layoutControlData = Utils<ILayoutUIUtils>()->QueryFrontLayoutData();<br />InterfacePtr<IHierarchy> activeSpreadLayerHierarchy(layoutControlData->QueryActiveLayer());<br />ASSERT(activeSpreadLayerHierarchy != nil);<br />if (activeSpreadLayerHierarchy == nil) {<br />break;<br />}<br />InterfacePtr<ISpreadList> iSpreadList(iDocument, IID_ISPREADLIST); <br />int32 numSpreads = iSpreadList->GetSpreadCount(); <br />UIDRef parentUIDRef(iDataBase,iSpreadList->GetNthSpreadUID(1)); <br />InterfacePtr <ISpread> iSpread (parentUIDRef,IID_ISPREAD); <br />int32 numOfPagesInSpread= iSpread->GetNumPages(); <br />UID pageUID=iSpread->GetNthPageUID(1); <br />UIDRef pageUIDRef(iDataBase,pageUID); <br />UIDRef placeUIDRef = layoutHelper.GetActiveSpreadLayerRef(parentUIDRef,kFalse); <br />InterfacePtr<IGeometry> pasteGeometry(parentUIDRef, UseDefaultIID()); <br />//Transform the bounds of the frame from page co-ordinates<br />//into the parent co-ordinates, i.e. the spread.<br />PMRect boundsInPageCoords(k,j,l,m);// hard wire for now.<br />PMRect boundsInParentCoords = layoutHelper.PageToSpread(pageUIDRef, boundsInPageCoords); <br />UIDRef boxUIDRef = ::GetUIDRef(activeSpreadLayerHierarchy);<br />UIDRef frameref=layoutHelper.CreateRectangleFrame(boxUIDRef,boundsInParentCoords);<br />ISelectionManager *SelectionManager=myContext->GetContextSelection();<br />InterfacePtr<IGraphicFrameData> graphicFrameData(frameref , UseDefaultIID());<br />ASSERT(graphicFrameData);<br /> if (!graphicFrameData) {<br /> break;<br /> }<br />UIDRef storyUIDRef = layoutHelper.GetTextModelRef(graphicFrameData); <br />IDFile idFile;<br />idFile.SetFileName(tempfilename); <br />// import the file <br />IDataBase* db = frameref.GetDataBase(); <br />InterfacePtr<ICommand> importCmd(CmdUtils::CreateCommand(kImportFileCmdBoss));<br />ASSERT(importCmd);<br />if (!importCmd) {<br /> break;<br /> }<br />InterfacePtr<IImportFileCmdData> importCmdData(importCmd, IID_IIMPORTFILECMDDATA); <br /> ASSERT(importCmd);<br />if (!importCmd) {<br /> break;<br /> }<br />importCmdData->Set(db, idFile, kSuppressUI); <br /> CmdUtils::ProcessCommand(importCmd);<br /> //the UIDRef of the imported item <br /> UIDRef imageRef = importCmd->GetItemListReference().GetRef(0);<br />// place the imported item in the frame <br />InterfacePtr<ICommand> placeItemCmd(CmdUtils::CreateCommand(kPlaceItemInGraphicFrameCmdBoss)); <br />ASSERT(placeItemCmd);<br /> if (!placeItemCmd) {<br /> break;<br /> }<br />InterfacePtr<IPlacePIData> placePIData(placeItemCmd, UseDefaultIID()); <br />ASSERT(placePIData);<br /> if (!placePIData) {<br /> break;<br /> }<br />PMPointList pointList(1);<br />pointList.reserve(0); <br />pointList.push_back(PMPoint(1,1)); <br />placePIData->Set(frameref, &pointList, kFalse); <br />placeItemCmd->SetItemList(imageRef); <br />CmdUtils::ProcessCommand(placeItemCmd);<br />InterfacePtr<ICommand> cmd(CmdUtils::CreateCommand(kFitContentPropCmdBoss));<br /> ASSERT(cmd);<br /> if (!cmd) {<br /> break;<br /> }<br />cmd->SetItemList(imageRef);<br />CmdUtils::ProcessCommand(cmd);<br />j+=250 ;//left <br />m+=250 ;//bottom<br />}<br />mysql_close(conn);<br /> }while(kFalse);<br /><br />And also i'm not using PlaceFileInFrame to import an image file..<br />Bcoz it is not working for import multiple images from a single<br />database... Thats y i'm using the above codings for<br />importing multiple images...<br /><br />ok plzz tell me to import the image files from the database<br />directly to the 2nd page....<br /><br />Or any one plzz help me...<br /><br />thanks...<br />senthil...
Known Participant
December 15, 2006
Hi Oscar,

Thanks for ur helpful reply....

Ur support will be very useful for the beginners like me...

I dont know How to declare for the following errors...

error C2065: 'doc' : undeclared identifier
error C2065: 'dataBase' : undeclared identifier
error C3861: 'dataBase': identifier not found, even with argument-dependent lookup

I declared the following codings for the 'doc' and 'database'
keywords....

IDocument *doc =myContext->GetContextDocument();
IDataBase *dataBase = ::GetUIDRef(iDocument).GetDataBase();
if (dataBase == nil){
ASSERT(dataBase);
break;
}

If i declared like this, the above errors were occured...

How shall i declare for those two keywords?

Is there any special declarations available for those two keywords?

Plzz explain me....

thanks..
senthil
Known Participant
December 14, 2006
Hi, senthil<br />If not a complete piece of working code, it will give yo some hints.<br />As you can see here you choose spread and page.<br /><br />InterfacePtr<ISpreadList> iSpreadList(doc, IID_ISPREADLIST);<br /> int32 numSpreads = iSpreadList->GetSpreadCount();<br /> UIDRef parentUIDRef(database,iSpreadList->GetNthSpreadUID(whatspread));<br /> InterfacePtr <ISpread> iSpread (parentUIDRef,IID_ISPREAD) ;<br /> int32 numPages=iSpread->GetNumPages();<br /> UID pageUID=iSpread->GetNthPageUID(whatpage) ;<br /> UIDRef pageUIDRef(database,pageUID) ;<br /> <br /> UIDRef placeUIDRef = layoutHelper.GetActiveSpreadLayerRef(parentUIDRef,kFalse);<br /> <br /> InterfacePtr<IGeometry> pasteGeometry(parentUIDRef, UseDefaultIID());<br /> PMRect boundsInPageCoords(x,y,z,t);<br /> PMRect boundsInParentCoords = layoutHelper.PageToSpread(pageUIDRef, boundsInPageCoords);<br /> <br /> UIFlags uiFlags = K2::kMinimalUI;<br /> UIDRef ref = layoutHelper.PlaceFileInFrame(chFile,<br /> placeUIDRef,<br /> boundsInParentCoords,<br /> uiFlags, <br /> kFalse,<br /> kFalse, <br /> kFalse);<br /><br />Regards.<br />Oscar.
Known Participant
December 14, 2006
Hai Oscar,
How shall i get the reference for the 2nd page?
Can any one plzz tell me about this...
plzzz.........
i'm beginner for creating Adobe indesign plugins..
so plzz give ur support and guidance...

Expecting reply...
senthil..
Known Participant
December 14, 2006
Hi Oscar,

Thanks for ur reply....

Ya i know to place a file in frame...

But i dont know how to paste a specific image in a specific page..

i'm having 6 images in the database...

i have to paste only 3 images in the first page...

i had done it..

But when the fouth image is in fetching, automatically a new page will
be created... i had done it also...

But i dont know how to paste the fourth image in the 2nd page..

how shall i is do this?

Is there any parameters available for pasting the files in the 2nd page?

Plzz reply me..

i'm very kind of u..

thanks..
senthil