Copy link to clipboard
Copied
I require to create a FrameMaker book by adding 3000 files to it. What are the different properties to be set to create a book when it contains a large number of files ?
I am currently using the F_ApiNewSeriesObject(bookId, FO_BookComponent, 0) and F_ApiSetString to add the component files to the book. However after adding 300 files, the process begins to get slower.
Thanks,
Asha Rayakar
Asha,
It's simple, just step through the FO_BookComponents of the book and set the FP_Name property. Once you set that to a file path, that component becomes a chapter that points to that file.
For example, assume that you use an F_StringsT list to store the list of files for the book. You could do something like the following (warning, I didn't test this at all, just typing quickly into this forum page):
F_StringsT paths;
F_ObjHandleT bookId, compId, nextCompId;
UIntT i;
/* Need code here to populate
...Copy link to clipboard
Copied
Asha,
Have you tried saving the book every ten book components or so?
Another option would be to create the book as a MIF file (assuming no other interaction with FrameMaker is needed), and then open this MIF file.
- Michael
Copy link to clipboard
Copied
Hi Asha,
I was able to duplicate this behavior. I tried saving the book periodically as Michael suggests and it seemed to help some, but things did still slow down a lot.
I found a trick, though. Rather than regenerate a 3000-file book every time, just do it once and use it as a template for all future books. That is, use whatever means necessary to create a book with 3000 components, save it somewhere, then later open that file and simply reset the FP_Name properties on the FO_BookComponents as necessary. Using this method, I was able to create a new 1000-file book in a second or two. As long as you save the template and keep it handy, you should never need to generate a book from scratch again.
If you don't know the exact number of files you need, just make sure the template book has more than enough, then delete the extra components afterwards, This adds a little bit of time, but not much.
Russ
Copy link to clipboard
Copied
Hi Russ,
How do we iterate through the FO_BookComponents of the template book to reset the FP_Name ?
Thanks,
Asha Rayakar
Copy link to clipboard
Copied
Asha,
It's simple, just step through the FO_BookComponents of the book and set the FP_Name property. Once you set that to a file path, that component becomes a chapter that points to that file.
For example, assume that you use an F_StringsT list to store the list of files for the book. You could do something like the following (warning, I didn't test this at all, just typing quickly into this forum page):
F_StringsT paths;
F_ObjHandleT bookId, compId, nextCompId;
UIntT i;
/* Need code here to populate paths and open up the book */
/* Afterwards, we can turn those file paths into book chapters */
compId = F_ApiGetId(FV_SessionId, bookId, FP_FirstComponentInBook);
for(i = 0; i < paths.len; i++)
{
if(compId)
{
F_ApiSetString(bookId, compId, FP_Name, paths.val);
compId = F_ApiGetId(bookId, compId, FP_NextComponentInBook);
}
}
/* Now, if there are any extra "dummy" chapters left over in the book, delete them */
while(compId)
{
nextCompId = F_ApiGetId(bookId, compId, FP_NextComponentInBook);
F_ApiDelete(bookId, compId);
compId = nextCompId;
}
F_ApiDeallocateStrings(&paths);