PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Sep 06, 2024 11:19 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Apr 05, 2013 6:50 pm 
Offline

Joined: Fri Apr 05, 2013 6:42 pm
Posts: 10
Ok, so I'm having an issue.

I create my document with MigraDoc. Define headerfooter, content and etc.
Throughout the content I'm adding paragraphs with local/bookmark links. Also
adding a AddPageRefLink().
Then I call DocumentRenderer.RenderDocument() after assigning its Document property.

Then I loop through some attachments and add them to the document with DocumentRenderer.PdfDocument.AddPage()
I also add an outline to that imported document (pdf) with:
DocumentRenderer.PdfDocument.Outlines.Add()

The problem is, that when I call RenderDocument, its only rendering the MigraDoc content that was added. So out beside the local/bookmark links it says "Bookmark 'x' is not defined within the document."

How can I define book mark links in the MigraDoc document I create to work globally after I've added external pdf pages to it?

Thanks,

Justin


Last edited by MonkFox on Wed Apr 17, 2013 4:48 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 08, 2013 9:17 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3109
Location: Cologne, Germany
You can add pages to your MigraDoc document using AddImage. Use "sample.pdf#17" to get page 17 from a PDF file.
For "invisible" bookmarks, I used a hack: the bookmark text was white and had font size 0.01 points.

Use AddPageBreak(), AddParagraph(), AddImage(), and AddPageBreak(). You can set the absolute position of the image to have it fill the whole page (with "invisible" bookmark) or draw the image within the page margins with a visible paragraph for the bookmark.

This way, all pages will be created by MigraDoc and all links will work.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 17, 2013 4:47 pm 
Offline

Joined: Fri Apr 05, 2013 6:42 pm
Posts: 10
Thanks for the reply. The only problem is that these attachments are almost always PDF documents. I couldn't find a way to get the pdf to an image to add to the document.

I just created the document, got the page count, created list of page ranges for the documents going to be added, created the document again with the page range text and then added the attachments with a bookmark that was exactly the same as the page range text in the original document.

That way as they are scrolling through the document, they can see the corresponding bookmark in the outline browser and click on it.

Thanks again!

Justin


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 29 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