Hello,
I need to use Hyperlink to bookmark in my document. I use Aspose Word to create the document and Aspose PDF to convert the document into PDF format. I have some issues with the Hyperlinks.
For example, executing this test code, the testout.doc seems correct, but opening the testout.pdf file with Acrobat, I get an error: “There was an error processing a page. There was a problem reading this document (110)”. (the soruce.doc document is an empty document).
public void Test()
{
Document wordDoc = null;
wordDoc = new Document(@"D:\source.doc");
DocumentBuilder docBuilder = new DocumentBuilder(wordDoc);
docBuilder.Writeln("--");
docBuilder.InsertHyperlink("link", "testbookmark", true);
docBuilder.Writeln("--");
docBuilder.StartBookmark("testbookmark");
docBuilder.Writeln("test bookmark");
docBuilder.EndBookmark("testbookmark");
wordDoc.Save(@"D:\testout.doc");
MemoryStream stream1 = new MemoryStream();
wordDoc.Save(stream1, SaveFormat.FormatAsposePdf);
stream1.Seek(0, SeekOrigin.Begin);
XmlDocument xmlDoc1 = new XmlDocument();
xmlDoc1.Load(stream1);
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.IsImagesInXmlDeleteNeeded = true;
pdf.BindXML(xmlDoc1, null);
pdf.Save(@"D:\testout.pdf");
}
I have posted this problem in the Aspose.Word Forum, but now I think it’s an Aspose.Word problem.
I also checked the content of XML in the stream, but it seems correct.
<Segment FontName="Times New Roman" Color="rgb 0 0 0" IsTrueTypeFontBold="true" FontSize="12" LinkType="Local" TargetID="testbookmark">link</Segment>
<Segment FontName="Times New Roman" Color="rgb 0 0 0" IsTrueTypeFontBold="true" FontSize="12">--</Segment>
<Text MarginBottom="3" IsSpaced="true" LineSpacing="1" ID="testbookmark">
<Segment FontName="Times New Roman" Color="rgb 0 0 0" IsTrueTypeFontBold="true" FontSize="12">test bookmark</Segment>
Thanks,
Lorenzo