Wednesday, March 20, 2013

Merge Pdf using pdftorn

static void MergePDF(PDFDoc new_doc, string filename) 

   using (PDFDoc in_doc = new PDFDoc(filename))  
      ArrayList copy_pages = new ArrayList(); 
      for (PageIterator itr = in_doc.GetPageIterator(); itr.HasNext();itr.Next())

   ArrayList imported_pages = new_doc.ImportPages(copy_pages); 
   for (int i=0; i!=imported_pages.Count; ++i) 
      new_doc.PagePushBack((Page)imported_pages[i]); // Order pages in reverse order. 

The following snippet shows now to merge multiple PDF documents: 
private void CallMeregPDF()
using (PDFDoc new_doc = new PDFDoc()) 

MergePDF(new_doc, @"c:\mypdfs\1.pdf"); 
MergePDF(new_doc, @"c:\mypdfs\2.pdf"); 
MergePDF(new_doc, @"c:\mypdfs\3.pdf"); 
new_doc.Save("merged.pdf", , SDFDoc.SaveOptions.e_linearized); 


Tuesday, March 12, 2013

IntelliSense is not working in C++

If the no compile browser (.ncb) file located at the root of your project directory is read-only or becomes corrupt in some manner, IntelliSense information will no longer be available. To fix this, do the following:
  1. Close the solution.
  2. Delete the .ncb file.
  3. Reopen the solution.