Skip to content

Commit ac70817

Browse files
Modified the sample for Rename-PDF-Bookmarks-From-Word
1 parent c9a9a6e commit ac70817

File tree

1 file changed

+2
-3
lines changed
  • Word-to-PDF-Conversion/Rename-PDF-Bookmarks-From-Word/.NET/Rename-PDF-Bookmarks-From-Word

1 file changed

+2
-3
lines changed

Word-to-PDF-Conversion/Rename-PDF-Bookmarks-From-Word/.NET/Rename-PDF-Bookmarks-From-Word/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ static void Main(string[] args)
3535
//Load the PDF document.
3636
using (PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(stream))
3737
{
38-
int i = 1;
3938
//Get each bookmark and changes the title of the bookmark.
40-
foreach (PdfBookmark pdfBookmark in pdfLoadedDocument.Bookmarks)
39+
for (int i = 0; i < pdfLoadedDocument.Bookmarks.Count; i++)
4140
{
42-
pdfBookmark.Title = "PdfBookMark" + i++;
41+
pdfLoadedDocument.Bookmarks[i].Title = "PdfBookMark" + (i+1);
4342
}
4443
//Saves the PDF file to file system.
4544
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"../../../WordToPDF.pdf"), FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))

0 commit comments

Comments
 (0)