在从程序导出之前如何合并PDF

时间:2015-04-25 01:56:07

标签: vb.net merge

如何将此报告中的PDF文件合并为一个PDF ..

 Private Sub btnShowReport_Click(sender As Object, e As EventArgs) Handles btnShowReport.Click

        Dim t = (From a In db.TransHdrs Where a.AccountCode.ToString = "110102994" Select a)
        Try

            If t.Count > 0 Then
                For Each x In t
                    Dim crdoc As New repTransBulk
                    Dim supcrdoc As New repTransBulk
                    Dim ds As New DSTrans
                    Dim dap As New DSTransTableAdapters.SP_TransPrintTableAdapter
                    dap.Fill(ds.SP_TransPrint, x.ID, x.RegGroupID, x.RegUserID, 0)
              Dim crExportOptions As ExportOptions
                    Dim crDiskFileDestionationOptionas As New DiskFileDestinationOptions
                    Dim crFormatTypeOptions As New PdfRtfWordFormatOptions
                    Dim strFolder As String = "c:\Temp\" & x.PatientFileNum
                    If Not Directory.Exists(strFolder) Then
                        Directory.CreateDirectory(strFolder)
                    End If
                    crDoc.SetDataSource(ds)
                    crDiskFileDestionationOptionas.DiskFileName = strFolder & "\" & x.TransNum & ".PDF"
                    crExportOptions = crdoc.ExportOptions
                    With crExportOptions
                        .ExportDestinationType = ExportDestinationType.DiskFile
                        .ExportFormatType = ExportFormatType.PortableDocFormat
                        .ExportDestinationOptions = crDiskFileDestionationOptionas
                        .FormatOptions = crFormatTypeOptions
                    End With
                    crdoc.Export()
                    '        MsgBox("Done")
                Next
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub

0 个答案:

没有答案