将Rdlc转换为受保护的PDF

时间:2014-10-27 16:59:08

标签: vb.net

我正在做一个我需要转换pdf报告rdlc的项目,我做了那个部分,但是我希望将其转换为受保护的,这意味着它只能被读取,它不能修改或用acrobat打开。 ..提前感谢你的答案....我在这里留下我正在使用的功能,我希望你能告诉我,我失踪了,或者我是否应该这样做:

Public Function CreatePDF() As Boolean

    Dim reportType As String = "PDF"
    Dim mimeType As String = Nothing
    Dim encoding As String = Nothing
    Dim deviceInfo As String = "<DeviceInfo><OutputFormat>PDF</OutputFormat>" & _
                               "<PageWidth>.0in</PageWidth><PageHeight>1in</PageHeight><MarginTop>0.5in</MarginTop><MarginLeft>1in</MarginLeft><MarginRight>1in</MarginRight><MarginBottom>0.5in</MarginBottom></DeviceInfo>"
    Dim warnings As Warning() = Nothing
    Dim renderedBytes As Byte()
    Try
        Reporteview.RefreshReport()
        If File.Exists("C:\account_status.pdf") Then
            File.Delete("C:\account_status.pdf")
        End If
        renderedBytes = Reporteview.LocalReport.Render("PDF", Nothing, mimeType, Nothing, ".PDF", Nothing, warnings)
        Dim fs As FileStream = System.IO.File.Create("c:\account_status.pdf", 1, FileOptions.WriteThrough)
        fs.Write(renderedBytes, 0, renderedBytes.Length)
        fs.Close()
        Return True
    Catch ex As AccessViolationException
        Return False
    End Try
End Function

0 个答案:

没有答案