(NET) NET (2015 год)

Merge page by PdfSharp. PdfInspector.

Merge page by PdfSharp.

This code use package PdfSharp. Workable template you can see below.


   1:  Imports PdfSharp.Pdf
   2:  Imports PdfSharp.Pdf.IO
   3:   
   4:  Module PDFsharp_NET
   5:      Public Sub MergePDF(InputPdf As List(Of String), OutPdfFile As String)
   6:          Dim OutputDocument As PdfDocument = New PdfDocument()
   7:          For i As Integer = 0 To InputPdf.Count - 1
   8:              Dim OneFile As String = InputPdf(i)
   9:              Dim InputDocument As PdfDocument = PdfReader.Open(OneFile, PdfDocumentOpenMode.Import)
  10:              Dim PageCount As Integer = InputDocument.PageCount
  11:              For j As Integer = 0 To PageCount - 1
  12:                  Dim page As PdfPage = InputDocument.Pages(j)
  13:                  OutputDocument.AddPage(page)
  14:              Next
  15:          Next
  16:          OutputDocument.Save(OutPdfFile)
  17:          OutputDocument.Close()
  18:      End Sub
  19:  End Module

Calling pattern.


   1:  Module TempDirectory
   2:      Function GetTempDirectory() As String
   3:          Dim LocalTmpPath As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
   4:          Dim TempAppDirectory As String = IO.Path.Combine(LocalTmpPath, Application.ProductName)
   5:          If Not My.Computer.FileSystem.DirectoryExists(TempAppDirectory) Then
   6:              My.Computer.FileSystem.CreateDirectory(TempAppDirectory)
   7:          End If
   8:          Return IO.Path.Combine(TempAppDirectory)
   9:      End Function
  10:  End Module


PdfInspector.

This is old, but helpful utility you can download from http://pdfedit.cz/en/pdfedit_windows.html.



At the beginning of my project to inspect and show PDF document structure I try to start my own implementation of this utility bu PdfSharp, but gave up, because eventually I was found easy way to processing PDF - convert it to SVG and inspect document as SVG by https://inkscape.org/.





Comments ( )
<00>  <01>  <02>  <03>  <04>  <05>  <06>  <07>  <08>  <09>  <10>  <11>  <12>  <13>  <14>  <15>  <16>  <17>  <18>  <19
Link to this page: http://www.vb-net.com/PdfSharp/index.htm
<SITEMAP>  <MVC>  <ASP>  <NET>  <DATA>  <KIOSK>  <FLEX>  <SQL>  <NOTES>  <LINUX>  <MONO>  <FREEWARE>  <DOCS>  <ENG>  <MAIL ME>  <ABOUT ME>  < THANKS ME>