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

What version to use when merging documents?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=297
Page 1 of 1

Author:  cvanling [ Fri Jan 11, 2008 7:17 pm ]
Post subject:  What version to use when merging documents?

Hi,

I've used PdfSharp to create a splitter/merge tool. I am quite happy with the results, it is quite compatible with most files, and vert fast as well. Great work!

A few questions on various things:

1) When creating a merged document from several input documents, what PDF version should be used for the output document? My current logic is that if the input document has a higher version than the output document I increase the version of the output document to match. Is this correct or should the output document remain at version 1.4?

2) I've written some utilities for importing bookmarks which I was thinking of contributing to the community. Is there a place to post user contributed code?

3) I found that the PDFreader will not open files that have multiple documents contained within (example is the PDF 1.7 reference from the adobe web site). Is there a way to make this work?

4) Is there a way to get the current page number from a PdfPage object? I needed this to get the actual page number the bookmark is pointing to.
I came up with this, but it seems like a hard way to do it:

Code:
// convert page from a bookmark to offset
// pref is from the page pointed to from the bookmark
int page_offset = -1;
for (int x = 0; x < inputDocument.Pages.Count; ++x)
{
    PdfReference PageRef = (PdfReference) 
    inputDocument.Pages.PagesArray.Elements[x];
    if (PageRef == pref)
         {
         page_offset = x;
         break;
         }
}

Author:  Thomas Hoevel [ Mon Feb 18, 2008 8:07 am ]
Post subject: 

Hi!

Re 1:
I'd do the same (I dunno what'll happen if post-1.4 features are used in a 1.4 file).

Re 2:
You can send them to empira for review and possible inclusion in the samples folder.
Or you can post the URL of your site here (as soon as you have 5 posts on this forum (a SPAM prevention scheme we cannot turn off)).

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