Fügen Sie PDF Lesezeichen mit benannten Zielen hinzu

Mögliche Nutzungsszenarien

Benannte Ziele sind spezielle Arten von Lesezeichen oder Links in PDF, die nicht von PDF-Seiten abhängen. Das bedeutet, wenn Seiten von PDF hinzugefügt oder gelöscht werden, können Lesezeichen ungültig werden, aber benannte Ziele bleiben intakt. Um ein benanntes Ziel zu erstellen, stellen Sie bitte das einPdfLesezeichenEintrag.ZielnameEigentum.

Fügen Sie PDF Lesezeichen mit benannten Zielen hinzu

Bitte sehen Sie sich den folgenden Beispielcode an, itsExcel-Quelldatei , und seinAusgabedatei PDF. Der Screenshot zeigt die Lesezeichen und benannten Ziele in der Ausgabe PDF. Der Screenshot beschreibt auch, wie benannte Ziele angezeigt werden und dass Sie die Professional-Version von Acrobat Reader benötigen.

todo: Bild_alt_Text

Beispielcode

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Load source Excel file
Workbook wb = new Workbook(sourceDir + "samplePdfBookmarkEntry_DestinationName.xlsx");
//Access first worksheet
Worksheet ws = wb.Worksheets[0];
//Access cell C5
Cell cell = ws.Cells["C5"];
//Create Bookmark and Destination for this cell
PdfBookmarkEntry bookmarkEntry = new PdfBookmarkEntry();
bookmarkEntry.Text = "Text";
bookmarkEntry.Destination = cell;
bookmarkEntry.DestinationName = "AsposeCells--" + cell.Name;
//Access cell G56
cell = ws.Cells["G56"];
//Create Sub-Bookmark and Destination for this cell
PdfBookmarkEntry subbookmarkEntry1 = new PdfBookmarkEntry();
subbookmarkEntry1.Text = "Text1";
subbookmarkEntry1.Destination = cell;
subbookmarkEntry1.DestinationName = "AsposeCells--" + cell.Name;
//Access cell L4
cell = ws.Cells["L4"];
//Create Sub-Bookmark and Destination for this cell
PdfBookmarkEntry subbookmarkEntry2 = new PdfBookmarkEntry();
subbookmarkEntry2.Text = "Text2";
subbookmarkEntry2.Destination = cell;
subbookmarkEntry2.DestinationName = "AsposeCells--" + cell.Name;
//Add Sub-Bookmarks in list
ArrayList list = new ArrayList();
list.Add(subbookmarkEntry1);
list.Add(subbookmarkEntry2);
//Assign Sub-Bookmarks list to Bookmark Sub-Entry
bookmarkEntry.SubEntry = list;
//Create PdfSaveOptions and assign Bookmark to it
PdfSaveOptions opts = new PdfSaveOptions();
opts.Bookmark = bookmarkEntry;
//Save the workbook in Pdf format with given pdf save options
wb.Save(outputDir + "outputPdfBookmarkEntry_DestinationName.pdf", opts);