PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Apr 25, 2018 1:07 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Text annotation contents
PostPosted: Thu Apr 12, 2018 4:36 pm 
Offline

Joined: Thu Apr 12, 2018 4:25 pm
Posts: 1
I am using PDFSharp to replace some placeholder text in a template PDF with some values I gather from a user.

The text I replace is all within text annotation objects, however I am finding that if I update the "contents" it does not actually update the displayed text. If I delete the /AP key it works in Bluebeam but not for Adobe.

Code:
foreach (PdfSharp.Pdf.Annotations.PdfAnnotation anno in tempPDF.Pages[0].Annotations)
            {
                foreach (var wordToReplace in replacements)
                {
                    anno.Contents = anno.Contents.Replace(wordToReplace.Key, wordToReplace.Value);
                }
                anno.Elements.Remove("/AP");
            }


Can anyone shed any light on how I can resolve this? I've read that PDF's have multiple internal dictionaries that control text display - is there a way I can manipulate these to solve my issues?


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

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] 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:  
Powered by phpBB® Forum Software © phpBB Group