PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

merge files in vb.net
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4248
Page 1 of 1

Author:  joomy78 [ Fri Apr 23, 2021 4:28 pm ]
Post subject:  merge files in vb.net

Hello,
is it possible to use pdfsharp with vb.net language?
I would just like to merge 2 PDF files but I cannot find samples in this language
thank you

Author:  rsoeung [ Sun Apr 25, 2021 12:26 pm ]
Post subject:  Re: merge files in vb.net

PdfSharp is written in .Net so I'm 110% sure it can be used with VB.Net or any .Net language for that matter. Simply use a C# to VB.Net converter https://converter.telerik.com/ if you find a sample in C# that fits your needs.

Author:  joomy78 [ Tue Apr 27, 2021 10:18 am ]
Post subject:  Re: merge files in vb.net

Thank you for helping
we can use pdfsharp with VB.NET

Author:  CHL [ Tue May 18, 2021 3:04 am ]
Post subject:  Re: merge files in vb.net

Code:
Private Sub MergeMultiplePDFIntoSinglePDF(ByVal outputFilePath As String, ByVal pdfFiles As String())
        Dim document As PdfDocument = New PdfDocument()

        For Each pdfFile As String In pdfFiles
            Dim inputPDFDocument As PdfDocument = PdfReader.Open(pdfFile, PdfDocumentOpenMode.Import)
            document.Version = inputPDFDocument.Version

            For Each page As PdfPage In inputPDFDocument.Pages
                document.AddPage(page)
            Next
            'System.IO.File.Delete(pdfFile) '被防毒軟體擋下來,以後再改
        Next

        document.Options.CompressContentStreams = True
        document.Options.NoCompression = False
        document.Save(outputFilePath)
    End Sub

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/