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;
}
}