Solved

API for merging PDFs

Posted on 2012-04-02
3
495 Views
Last Modified: 2012-04-04
I need to create a single PDF and merge in other child-PDFs.   I will also be using bookmarks, and I need a bookmark to the page(s) where the child-PDFs are inserted.   I need a product with an API.  I will be using .NET (VB.NET)

I need a clean, straight forward of creating a single PDF, which will include text and other PDF's, and I need the ability to add a bookmark whose target is anywhere in the PDF, including the child PDFs that are inserted.

Any suggestions?
0
Comment
Question by:HLRosenberger
3 Comments
 
LVL 14

Accepted Solution

by:
binaryevo earned 250 total points
Comment Utility
Try iTextSharp its open source and adopted from the java library.
0
 
LVL 9

Assisted Solution

by:wasiftoor
wasiftoor earned 250 total points
Comment Utility
PDFSharp www.pdfsharp.net is one of the most widely used PDF processing libararies for .NET.

It has both the merging and bookmarking features that you are looking for.

For Bookmarking, the following sample code can be helpful:

----------------------------------------------------------------------------------------------------

// Create a new PDF document
PdfDocument document = new PdfDocument();
 
// Create a font
XFont font = new XFont("Verdana", 16);
 
// Create first page
PdfPage page = document.AddPage();
XGraphics gfx = XGraphics.FromPdfPage(page);
gfx.DrawString("Page 1", font, XBrushes.Black, 20, 50, XStringFormats.Default);
 
// Create the root <B class=searchkeyword>bookmark</B>. You can set the style and the color.
PdfOutline outline = document.Outlines.Add("Root", page, true, PdfOutlineStyle.Bold, XColors.Red);
 
// Create some more pages
for (int idx = 2; idx <= 5; idx++)
{
  page = document.AddPage();
  gfx = XGraphics.FromPdfPage(page);
 
  string text = "Page " + idx;
  gfx.DrawString(text, font, XBrushes.Black, 20, 50, XStringFormats.Default);
 
  // Create a sub <B class=searchkeyword>bookmark</B>
  outline.Outlines.Add(text, page, true);
}
 
// Save the document...
const string filename = "<B class=searchkeyword>Bookmark</B>s_tempfile.pdf";
document.Save(filename);
// ...and start a viewer.
Process.Start(filename);


----------------------------------------------------------------------------------------------------

Good Luck.
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
Comment Utility
Thanks
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now