Solved

API for merging PDFs

Posted on 2012-04-02
3
501 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
ID: 37797077
Try iTextSharp its open source and adopted from the java library.
0
 
LVL 9

Assisted Solution

by:wasiftoor
wasiftoor earned 250 total points
ID: 37797155
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
ID: 37809379
Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

730 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