PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Bookmarks created working improperly in scrolling view only
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3094
Page 1 of 1

Author:  argee [ Thu Apr 23, 2015 2:47 am ]
Post subject:  Bookmarks created working improperly in scrolling view only

I have an VB.Net application that uses PDFsharp to compile PDF files together that are in layered folders and creates bookmarks and title pages for various sections and/or files. Bookmarks have always worked properly for me using the "outlines.add" method.

At the request of a user, I have been trying to add the functionality of automatically inserting PDF files found in the main (root) folder and adding bookmarks for each file found there. The files are inserted and the bookmarks are created, but the some of the bookmarks are exhibiting strange behavior. If I enable page scrolling, they sometimes move the view to the right page, but more often they move to the wrong page much further down the document. If I disable page scrolling view, they work properly every time. It's only these main folder file bookmarks that do this, any other ones I am creating in the application work fine.

My code for adding the bookmarks looks like this:
Code:
      AddPage = MainFilePDF.Pages(0)
      MainFilePage = document.AddPage(AddPage)
      outline = document.Outlines.Add(strParseName, MainFilePage, False, PdfOutlineStyle.Regular, XColors.Black)
      For j As Integer = 1 To MainFilePDF.Pages.Count - 1
         AddPage = MainFilePDF.Pages(j)
         MainFilePage = document.AddPage(AddPage)
      Next

and as I stated, the files do get inserted in the right place and the bookmarks get added.

As it's only some of the main folder files that are involved, I've been trying to figure out if it's something about the PDF version of the files that I'm inserting that's causing this, but thus far I can't see anything consistent in the file formats that are causing the issue.

Has anyone else ever seen this behavior? Unfortunately I can't post a sample file as they contain confidential material.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/