PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Mar 19, 2024 2:40 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Jun 22, 2021 5:17 pm 
Offline

Joined: Sun Jun 20, 2021 6:35 pm
Posts: 4
The following exception appears when I add a bookmark to an existing PDF (see the image) using PDFSharp-gdi version 1.50.5147

Here is the link to the PDF I am trying to add outlines:
https://we.tl/t-yVUeVKIG1h

Code:
using System;
using PdfSharp;
using PdfSharp.Drawing;
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
using PdfSharp.Fonts;
using System.Diagnostics;

namespace Bookmarks
{
    class Program
    {
        static void Main(string[] args)
        {
         
            string file = "C:\\temp\\1\\A101.pdf";
            string accountNumber = "001234";

            using (PdfDocument doc = PdfReader.Open(file, PdfDocumentOpenMode.Modify))
            {
                PdfPage page = doc.Pages[0];
                doc.Outlines.Add(accountNumber, page);
                doc.Save(file);
            }

        }
    }
}


Attachments:
bookmarks.png
bookmarks.png [ 111.38 KiB | Viewed 4785 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 24, 2021 7:44 am 
Offline

Joined: Sat Jan 09, 2021 7:09 am
Posts: 18
Can't reproduce the exception with your code and pdf file. The name of the pdf file to download is different than what's in your code. Are these two the same file?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group