PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)-VBForums
Results 1 to 25 of 25

Thread: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

  1. #1

    Thread Starter
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,292

    Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Hello all,
    A while ago I posted a little demo project that merges pdf files and adds bookmarks to the merged output file using PDFBox (see this thread http://www.vbforums.com/showthread.php?t=462929 ). However, when I recently started to use iTextSharp for manipulating Pdfs, I found a better way of merging pdfs and adding bookmarks to it using iTextSharp. These are a few advantages I found:
    1. iTextSharp.dll is small (only 2.3 MB vs PDFBox's 16MB)
    2. iTextSharp is significantly faster for manipulating pdf documents
    3. Can add bookmarks while merging using itextSharp (with PDFBox, I first had to merge the files to a temp location, then reopen it to add bookmarks, then save it to the final location, then delete the temp file... pheeewww, too much work!)
    4. You can fill in from here
    5. ???
    6. ???

    All in all, I highly recommend using iTextSharp over PDFBox.

    And here it is, the pdf merging function that utilizes iTextSharp libray. Just remember to add a reference to itextsharp.dll in your project if you this function. (You can google for download locations of iTextSharp if you don't already have it)

    vb Code:
    1. Public Function MergePdfFiles(ByVal pdfFiles() As String, ByVal outputPath As String) As Boolean
    2.         Dim result As Boolean = False
    3.         Dim pdfCount As Integer = 0     'total input pdf file count
    4.         Dim f As Integer = 0            'pointer to current input pdf file
    5.         Dim fileName As String = String.Empty   'current input pdf filename
    6.         Dim reader As iTextSharp.text.pdf.PdfReader = Nothing
    7.         Dim pageCount As Integer = 0    'cureent input pdf page count
    8.         Dim pdfDoc As iTextSharp.text.Document = Nothing    'the output pdf document
    9.         Dim writer As PdfWriter = Nothing
    10.         Dim cb As PdfContentByte = Nothing
    11.         'Declare a variable to hold the imported pages
    12.         Dim page As PdfImportedPage = Nothing
    13.         Dim rotation As Integer = 0
    14.         'Declare a font to used for the bookmarks
    15.         Dim bookmarkFont As iTextSharp.text.Font = iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, _
    16.                                                                   12, iTextSharp.text.Font.BOLD, iTextSharp.text.Color.BLUE)
    17.         Try
    18.             pdfCount = pdfFiles.Length
    19.             If pdfCount > 1 Then
    20.                 'Open the 1st pad using PdfReader object
    21.                 fileName = pdfFiles(f)
    22.                 reader = New iTextSharp.text.pdf.PdfReader(fileName)
    23.                 'Get page count
    24.                 pageCount = reader.NumberOfPages
    25.                 'Instantiate an new instance of pdf document and set its margins. This will be the output pdf.
    26.                 'NOTE: bookmarks will be added at the 1st page of very original pdf file using its filename. The location
    27.                 'of this bookmark will be placed at the upper left hand corner of the document. So you'll need to adjust
    28.                 'the margin left and margin top values such that the bookmark won't overlay on the merged pdf page. The
    29.                 'unit used is "points" (72 points = 1 inch), thus in this example, the bookmarks' location is at 1/4 inch from
    30.                 'left and 1/4 inch from top of the page.
    31.                 pdfDoc = New iTextSharp.text.Document(reader.GetPageSizeWithRotation(1), 18, 18, 18, 18)
    32.                 'Instantiate a PdfWriter that listens to the pdf document
    33.                 writer = PdfWriter.GetInstance(pdfDoc, New IO.FileStream(outputPath, IO.FileMode.Create))
    34.                 'Set metadata and open the document
    35.                 With pdfDoc
    36.                     .AddAuthor("Your name here")
    37.                     .AddCreationDate()
    38.                     .AddCreator("Your program name here")
    39.                     .AddSubject("Whatever subject you want to give it")
    40.                     'Use the filename as the title... You can give it any title of course.
    41.                     .AddTitle(IO.Path.GetFileNameWithoutExtension(outputPath))
    42.                     'Add keywords, whatever keywords you want to attach to it
    43.                     .AddKeywords("Report, Merged PDF, " & IO.Path.GetFileName(outputPath))
    44.                     .Open()
    45.                 End With
    46.                 'Instantiate a PdfContentByte object
    47.                 cb = writer.DirectContent
    48.                 'Now loop thru the input pdfs
    49.                 While f < pdfCount
    50.                     'Declare a page counter variable
    51.                     Dim i As Integer = 0
    52.                     'Loop thru the current input pdf's pages starting at page 1
    53.                     While i < pageCount
    54.                         i += 1
    55.                         'Get the input page size
    56.                         pdfDoc.SetPageSize(reader.GetPageSizeWithRotation(i))
    57.                         'Create a new page on the output document
    58.                         pdfDoc.NewPage()
    59.                         'If it is the 1st page, we add bookmarks to the page
    60.                         If i = 1 Then
    61.                             'First create a paragraph using the filename as the heading
    62.                             Dim para As New iTextSharp.text.Paragraph(IO.Path.GetFileName(fileName).ToUpper(), bookmarkFont)
    63.                             'Then create a chapter from the above paragraph
    64.                             Dim chpter As New iTextSharp.text.Chapter(para, f + 1)
    65.                             'Finally add the chapter to the document
    66.                             pdfDoc.Add(chpter)
    67.                         End If
    68.                         'Now we get the imported page
    69.                         page = writer.GetImportedPage(reader, i)
    70.                         'Read the imported page's rotation
    71.                         rotation = reader.GetPageRotation(i)
    72.                         'Then add the imported page to the PdfContentByte object as a template based on the page's rotation
    73.                         If rotation = 90 Then
    74.                             cb.AddTemplate(page, 0, -1.0F, 1.0F, 0, 0, reader.GetPageSizeWithRotation(i).Height)
    75.                         ElseIf rotation = 270 Then
    76.                             cb.AddTemplate(page, 0, 1.0F, -1.0F, 0, reader.GetPageSizeWithRotation(i).Width + 60, -30)
    77.                         Else
    78.                             cb.AddTemplate(page, 1.0F, 0, 0, 1.0F, 0, 0)
    79.                         End If
    80.                     End While
    81.                     'Increment f and read the next input pdf file
    82.                     f += 1
    83.                     If f < pdfCount Then
    84.                         fileName = pdfFiles(f)
    85.                         reader = New iTextSharp.text.pdf.PdfReader(fileName)
    86.                         pageCount = reader.NumberOfPages
    87.                     End If
    88.                 End While
    89.                 'When all done, we close the documwent so that the pdfwriter object can write it to the output file
    90.                 pdfDoc.Close()
    91.                 result = True
    92.             End If
    93.         Catch ex As Exception
    94.             Throw New Exception(ex.Message)
    95.         End Try    
    96.         Return result
    97.     End Function

  2. #2
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    413

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Thanks for the code. Works great.
    Visual Studio .NET 2005/.NET Framework 2.0

  3. #3
    New Member
    Join Date
    Aug 2008
    Location
    Belgium
    Posts
    4

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Hi,

    I tried your code, it seems to run well but unfortunately, it doesn't create the output file.
    Should the output pdf file exists before running the program?
    Here is my code:
    Dim y(1) As String
    y(0) = MyPath & "Report1.pdf"
    y(1) = MyPath & "Report2.pdf"

    x = MergePdfFiles(y, MyPath & "me.pdf")

    in the function, I have copied exactly your code.

    Help

    Mia

  4. #4
    New Member
    Join Date
    Aug 2008
    Location
    Belgium
    Posts
    4

    Question Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Hi,

    I tried your code, it seems to run well but unfortunately, it doesn't create the output file.
    Should the output pdf file exists before running the program?
    Here is my code:
    Dim y(1) As String
    y(0) = MyPath & "Report1.pdf"
    y(1) = MyPath & "Report2.pdf"

    x = MergePdfFiles(y, MyPath & "me.pdf")

    in the function, I have copied exactly your code.

    Help

    Mia

  5. #5
    New Member
    Join Date
    Dec 2008
    Posts
    1

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Code worked great got me off the ground with a running start!!! Thank You.

  6. #6
    New Member
    Join Date
    Jan 2009
    Posts
    2

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Does .NET version of iTextSharp support converting html to pdf? if not, how can i convert html output of a text editor from browser, to xml that is compatible with iTextSharp?

  7. #7

    Thread Starter
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,292

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    As I just answered to a member earlier (maybe you?) that iTextSharp is not the best tool for html to pdf conversion. It can only do every simple web pages (pages with only plain text, no css, no tables, no images...) You need to use other tools that is designed for html to pdf conversion. Have a look at HtmlDoc or ICEBrowser. There are also free web services out there that you can use, but this approach obviously requires you have Internet connection whenever your application is running.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  8. #8
    New Member
    Join Date
    Jan 2009
    Posts
    2

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Thanks! application is going to run in online mode. please let me know a good web service to convert html to pdf.

  9. #9
    Member
    Join Date
    Mar 2007
    Posts
    34

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    hello -

    Sorry I am an extreme newbie at this vb.net - but i copy your code and am curious where is the output?

  10. #10

    Thread Starter
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,292

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Quote Originally Posted by cthai View Post
    hello -

    Sorry I am an extreme newbie at this vb.net - but i copy your code and am curious where is the output?
    Do you know how to call a function or a sub?
    If you copied that function as is, you see that it takes 2 parameters. The first one is an array of string which contains the paths to the pdf files you wish to merge. The 2nd parameter is a string that you specify the path of the output (merged) pdf file. For example, if you have the following pdf files:
    c:\1.pdf, c:\2.pdf, c:\3.pdf and you want to merge them all to a file called merged.pdf in the c:\ drive. You would set it up like this:
    Code:
    Dim input() as string = {"c:\1.pdf", "c:\2.pdf", "c:\3.pdf"}
    Dim output as string = "c:\merged.pdf"
    'Then call the function to merge the files
    If MergePdfFiles(input, output) = True Then
          MessageBox.Show("Files successfully merged.")
    Else
          MessageBox.Show("Files did not merged successfully")
    End If
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  11. #11
    Member
    Join Date
    Mar 2007
    Posts
    34

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Quote Originally Posted by stanav View Post
    Do you know how to call a function or a sub?
    If you copied that function as is, you see that it takes 2 parameters. The first one is an array of string which contains the paths to the pdf files you wish to merge. The 2nd parameter is a string that you specify the path of the output (merged) pdf file. For example, if you have the following pdf files:
    c:\1.pdf, c:\2.pdf, c:\3.pdf and you want to merge them all to a file called merged.pdf in the c:\ drive. You would set it up like this:
    Code:
    Dim input() as string = {"c:\1.pdf", "c:\2.pdf", "c:\3.pdf"}
    Dim output as string = "c:\merged.pdf"
    'Then call the function to merge the files
    If MergePdfFiles(input, output) = True Then
          MessageBox.Show("Files successfully merged.")
    Else
          MessageBox.Show("Files did not merged successfully")
    End If
    Thank you for your guidance =) it work now

  12. #12
    New Member
    Join Date
    Apr 2009
    Posts
    2

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    I'm stumped. How do you get the paragraph text to be on top of the original pdf. And also how can I take the numbers off of the chapters. Thanks!

  13. #13
    New Member
    Join Date
    Apr 2009
    Posts
    2

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    I figured out how to take the numbers off of the chapters...
    chpter.NumberDepth = 0

    Still can't figure out how to get it on top of the original pdf though...

  14. #14
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Hi stanav,

    After merging the PDF, the links in the input PDF has disabled in the output(Merged) PDF.Is there any way to Keep the link as it is.
    Visual Studio.net 2010
    If this post is useful, rate it


  15. #15

    Thread Starter
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,292

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Quote Originally Posted by vijy View Post
    Hi stanav,

    After merging the PDF, the links in the input PDF has disabled in the output(Merged) PDF.Is there any way to Keep the link as it is.
    Are you talking about hyperlinks or bookmark links?
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  16. #16
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Quote Originally Posted by stanav View Post
    Are you talking about hyperlinks or bookmark links?
    am talking about hyperlinks..
    Visual Studio.net 2010
    If this post is useful, rate it


  17. #17
    Member
    Join Date
    Sep 2007
    Posts
    36

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Hi everyone,

    I am trying to find a way to convert html code to pdf. I have been seeing many references to iTextSharp and that it is a good tool to convert html to pdf. But I notice that Stanov specifically says it only converts very simple html. I am looking into HTMLDoc and ICEBrowser currently but was wondering if anyone had any examples of how to convert html using one of these tools?

  18. #18
    New Member
    Join Date
    Sep 2010
    Posts
    1

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    I used the code and it works great. What I would like to do is add a table of contents to my merged-pdf-files document. Would that be possible, e.g. based on bookmarks or chapters?

  19. #19
    Hyperactive Member koolprasad2003's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    443

    Question Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Hey thanks for great code.

    can i read the Hyperlink in PDF file. ?

    if yes please provide me code ...

    thanks in advance
    koolprasad2003
    MCP, MCTS, Microsoft MVP [Asp.Net/IIS]

    For more .NET development tips visit .NET Tips

    If the post is useful then please Rate it

  20. #20
    New Member
    Join Date
    Feb 2011
    Posts
    1

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Thanks a lot. It works perfectly

    For those that use VB 2010, at declaring the bookmark just write 12 instead of _12 and use BaseColor instad of Color.

  21. #21
    New Member
    Join Date
    Aug 2011
    Posts
    1

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Hi All,

    The code "MergePdfFiles" works fine for me to merge pdf. But it is required for me that the output pdf should be page numbered consecutively throughout the file.

    Please help.

    Thanks


    sxia



    Quote Originally Posted by stanav View Post
    Hello all,
    A while ago I posted a little demo project that merges pdf files and adds bookmarks to the merged output file using PDFBox (see this thread http://www.vbforums.com/showthread.php?t=462929 ). However, when I recently started to use iTextSharp for manipulating Pdfs, I found a better way of merging pdfs and adding bookmarks to it using iTextSharp. These are a few advantages I found:
    1. iTextSharp.dll is small (only 2.3 MB vs PDFBox's 16MB)
    2. iTextSharp is significantly faster for manipulating pdf documents
    3. Can add bookmarks while merging using itextSharp (with PDFBox, I first had to merge the files to a temp location, then reopen it to add bookmarks, then save it to the final location, then delete the temp file... pheeewww, too much work!)
    4. You can fill in from here
    5. ???
    6. ???

    All in all, I highly recommend using iTextSharp over PDFBox.

    And here it is, the pdf merging function that utilizes iTextSharp libray. Just remember to add a reference to itextsharp.dll in your project if you this function. (You can google for download locations of iTextSharp if you don't already have it)

    vb Code:
    1. Public Function MergePdfFiles(ByVal pdfFiles() As String, ByVal outputPath As String) As Boolean
    2.         Dim result As Boolean = False
    3.         Dim pdfCount As Integer = 0     'total input pdf file count
    4.         Dim f As Integer = 0            'pointer to current input pdf file
    5.         Dim fileName As String = String.Empty   'current input pdf filename
    6.         Dim reader As iTextSharp.text.pdf.PdfReader = Nothing
    7.         Dim pageCount As Integer = 0    'cureent input pdf page count
    8.         Dim pdfDoc As iTextSharp.text.Document = Nothing    'the output pdf document
    9.         Dim writer As PdfWriter = Nothing
    10.         Dim cb As PdfContentByte = Nothing
    11.         'Declare a variable to hold the imported pages
    12.         Dim page As PdfImportedPage = Nothing
    13.         Dim rotation As Integer = 0
    14.         'Declare a font to used for the bookmarks
    15.         Dim bookmarkFont As iTextSharp.text.Font = iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, _
    16.                                                                   12, iTextSharp.text.Font.BOLD, iTextSharp.text.Color.BLUE)
    17.         Try
    18.             pdfCount = pdfFiles.Length
    19.             If pdfCount > 1 Then
    20.                 'Open the 1st pad using PdfReader object
    21.                 fileName = pdfFiles(f)
    22.                 reader = New iTextSharp.text.pdf.PdfReader(fileName)
    23.                 'Get page count
    24.                 pageCount = reader.NumberOfPages
    25.                 'Instantiate an new instance of pdf document and set its margins. This will be the output pdf.
    26.                 'NOTE: bookmarks will be added at the 1st page of very original pdf file using its filename. The location
    27.                 'of this bookmark will be placed at the upper left hand corner of the document. So you'll need to adjust
    28.                 'the margin left and margin top values such that the bookmark won't overlay on the merged pdf page. The
    29.                 'unit used is "points" (72 points = 1 inch), thus in this example, the bookmarks' location is at 1/4 inch from
    30.                 'left and 1/4 inch from top of the page.
    31.                 pdfDoc = New iTextSharp.text.Document(reader.GetPageSizeWithRotation(1), 18, 18, 18, 18)
    32.                 'Instantiate a PdfWriter that listens to the pdf document
    33.                 writer = PdfWriter.GetInstance(pdfDoc, New IO.FileStream(outputPath, IO.FileMode.Create))
    34.                 'Set metadata and open the document
    35.                 With pdfDoc
    36.                     .AddAuthor("Your name here")
    37.                     .AddCreationDate()
    38.                     .AddCreator("Your program name here")
    39.                     .AddSubject("Whatever subject you want to give it")
    40.                     'Use the filename as the title... You can give it any title of course.
    41.                     .AddTitle(IO.Path.GetFileNameWithoutExtension(outputPath))
    42.                     'Add keywords, whatever keywords you want to attach to it
    43.                     .AddKeywords("Report, Merged PDF, " & IO.Path.GetFileName(outputPath))
    44.                     .Open()
    45.                 End With
    46.                 'Instantiate a PdfContentByte object
    47.                 cb = writer.DirectContent
    48.                 'Now loop thru the input pdfs
    49.                 While f < pdfCount
    50.                     'Declare a page counter variable
    51.                     Dim i As Integer = 0
    52.                     'Loop thru the current input pdf's pages starting at page 1
    53.                     While i < pageCount
    54.                         i += 1
    55.                         'Get the input page size
    56.                         pdfDoc.SetPageSize(reader.GetPageSizeWithRotation(i))
    57.                         'Create a new page on the output document
    58.                         pdfDoc.NewPage()
    59.                         'If it is the 1st page, we add bookmarks to the page
    60.                         If i = 1 Then
    61.                             'First create a paragraph using the filename as the heading
    62.                             Dim para As New iTextSharp.text.Paragraph(IO.Path.GetFileName(fileName).ToUpper(), bookmarkFont)
    63.                             'Then create a chapter from the above paragraph
    64.                             Dim chpter As New iTextSharp.text.Chapter(para, f + 1)
    65.                             'Finally add the chapter to the document
    66.                             pdfDoc.Add(chpter)
    67.                         End If
    68.                         'Now we get the imported page
    69.                         page = writer.GetImportedPage(reader, i)
    70.                         'Read the imported page's rotation
    71.                         rotation = reader.GetPageRotation(i)
    72.                         'Then add the imported page to the PdfContentByte object as a template based on the page's rotation
    73.                         If rotation = 90 Then
    74.                             cb.AddTemplate(page, 0, -1.0F, 1.0F, 0, 0, reader.GetPageSizeWithRotation(i).Height)
    75.                         ElseIf rotation = 270 Then
    76.                             cb.AddTemplate(page, 0, 1.0F, -1.0F, 0, reader.GetPageSizeWithRotation(i).Width + 60, -30)
    77.                         Else
    78.                             cb.AddTemplate(page, 1.0F, 0, 0, 1.0F, 0, 0)
    79.                         End If
    80.                     End While
    81.                     'Increment f and read the next input pdf file
    82.                     f += 1
    83.                     If f < pdfCount Then
    84.                         fileName = pdfFiles(f)
    85.                         reader = New iTextSharp.text.pdf.PdfReader(fileName)
    86.                         pageCount = reader.NumberOfPages
    87.                     End If
    88.                 End While
    89.                 'When all done, we close the documwent so that the pdfwriter object can write it to the output file
    90.                 pdfDoc.Close()
    91.                 result = True
    92.             End If
    93.         Catch ex As Exception
    94.             Throw New Exception(ex.Message)
    95.         End Try    
    96.         Return result
    97.     End Function

  22. #22
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Hi Stanav,
    is it possible to merge multiple images to single pdf using iTextSharp?
    Visual Studio.net 2010
    If this post is useful, rate it


  23. #23

    Thread Starter
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,292

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Quote Originally Posted by vijy View Post
    Hi Stanav,
    is it possible to merge multiple images to single pdf using iTextSharp?
    Yes. You create a new pdf file and add the images to the page on the fly...
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  24. #24
    New Member
    Join Date
    Dec 2013
    Posts
    1

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    I have registered at this forum just to say thank you.

  25. #25
    New Member
    Join Date
    May 2018
    Posts
    1

    Re: Merge Pdf Files and Add Bookmarks to It (Using iTextSharp)

    Is it possible to Merge multiple PDF files from folder and merge into one file per folder name and create hierarchical bookmarking of given document type and name of the doc(filename) itself..
    example

    Folder A
    file1
    A.pdf
    B.pdf
    C.pdf
    file2
    A.pdf
    B.pdf
    C.pdf

    file3
    A.pdf
    B.pdf
    C.pdf


    out put would be file1.pdf
    file2pdf
    and file3 pdf

    the bookmarking would be given document type as parent bookmark
    and then A (#of pages)
    B(#of pages)

    and so on...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width