Hi
I need to join several word document generated by aspose word in a pdf single document and then provide an index with link. Can I use word bookmark for the index? I tried to do that but the bookmark do not appear in the pdf document (created with aspose pdf)
Tanks,
Lorenzo
If you have local hyperlinks inside a document, then they will be exported to PDF okay as clickable links and bookmarks.
I’m not so sure about the way you want to create the index. You can try to use DocumentBuilder to create bookmarks and hyperlinks to those bookmarks and these will be exported to PDF okay as I said above.
If you want more help, send me more detailed explanation or a sample of what you want you build.
Tanks,
In my project I have to create several document (each document is a sub process). At the and I have to join all the document (the entire process) and create a full index.
For doing that I create all the Document with Aspose Word and put all the document in a ArrayList. And then I join all the document directly join the xml section in a single xml. At the end I create the PDF with Aspose PDF.
So the bookmarks are not inside the index document during the creation of the Word document.
Can I put the bookmark and the hyperlinks directly in the full xml document?
Lorenzo.
PS. Sorry for my English
You should be able to. Here is some pseudocode and ideas that should get you started:
DocumentBuilder builder = new DocumentBuilder(dstDoc);
for each document you want to joing
{
builder.MoveToDocumentEnd();
builder.InsertBookmark(document name or whatever);
AppendDoc(dstDoc, srcDoc);
}
builder.MoveToDocumentStart(); //or where you want to insert the index
for each document in your list
{
builder.InsertHyperlink(name of the bookmark you inserted above);
builder.Writeln();
}
See sample code for DocumentBuilder.InsertHyperlink in the API documentation.
Hello,
I try with this test code where docArray contanin all the documents and the first is the index:
IEnumerator docEnum = docArray.GetEnumerator();
docEnum.MoveNext();
indice = (Document)docEnum.Current;
DocumentBuilder indexBuilder = new DocumentBuilder(indice);
indexBuilder.MoveToDocumentEnd();
int i = 1;
while (docEnum.MoveNext())
{
DocumentBuilder docBuilder = new DocumentBuilder((Document)docEnum.Current);
docBuilder.MoveToDocumentStart();
docBuilder.StartBookmark("bookmark" + i);
docBuilder.Writeln("bookmark" + i);
docBuilder.EndBookmark("bookmark" + i);
indexBuilder.Writeln("–");
indexBuilder.InsertHyperlink("link" + i, "bookmark" + i, true);
i++;
}
But opening the result PDF file Acrobat show the error:
“There was an error processing a page. There was a problem reading this document (110).”
Using the value “fase” as last parameter of the call:
The PDF file is correct but the link don’t wor.
Lorenzo
Hi,
If this is all your code, then there is something missing. You need to append contents of the chapter documents to the main document. You need to use Sections and Section to copy or move sections between documents.
You probably can use only one document builder too, but your approach could be okay too.