PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 6:03 pm

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
PostPosted: Wed Jul 24, 2013 9:00 am 
Offline

Joined: Fri Jan 25, 2013 7:20 am
Posts: 9
Hi there,

i still try to combine pdf files (all includes bookmarks created using a OutlineLevel in migraDoc) to a single file.
I followed your post http://forum.pdfsharp.net/viewtopic.php?f=2&t=2304 and took a copy of the first file and add then all other pages to it.
But the single pdf file includes at least only the bookmark of the first pdf file (which i copied at begin).
It seems that using the option 'PdfReader.Open(pdfTempPath, PdfDocumentOpenMode.Import))' looses the bookmarks from that files.

Here's the code I'm using:
Code:
List<string> tempPDFFilePathes = new List<string>(Directory.GetFiles("D:\PDFsharp\PDFfiles\"));
string fullFilePathOfSinglePdfFile = "D:\PDFsharp\PDFfiles\CompletePDFFile";
//we must! take a copy of first pdf to get all bookmarks imported! we can't create a new document
File.Copy(tempPDFFilePathes[0], fullFilePathOfSinglePdfFile, true);
//after we copied it, remove it from tempArray!
tempPDFFilePathes.RemoveAt(0);
// Open an existing document for editing and loop through its pages
PdfDocument doc = PdfReader.Open(fullFilePathOfSinglePdfFile);
foreach (string pdfTempPath in tempPDFFilePathes)
{
   cts.ThrowIfCancellationRequested(); //abort if cancel requested!
   //in 'using' to free the imported pdfDoc after reading it!
   using (PdfDocument inputDocument = PdfReader.Open(pdfTempPath, PdfDocumentOpenMode.Import))
   {
      foreach (PdfPage page in inputDocument.Pages)
      {
         cts.ThrowIfCancellationRequested(); //abort if cancel requested!
         doc.AddPage(page);
      }
      inputDocument.Dispose();
   }
}


I tried to attached the temp pfd files and the combined pdf file but get the error 'The file is too big, maximum allowed size is 256 KiB.'
I uploaded it to my server, please download it from there...its valid three days https://www.inpro.de/sendfile/?get=xszXQT

Hope you can help.. :roll:


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: No registered users and 119 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