----------------------------------------------------------- New Message on BDOTNET
----------------------------------------------------------- From: vinniesn_syd_oz Message 1 in Discussion I want to embed pdf file content within crystal report. I have succssfully embed the image using XML schema file. It works fine. If I use the same technique for importing pdf file, it comes with blank screen. I have followed the following procedure. 1. Created xml schema file, <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="RevsCert"> <xs:complexType> <xs:sequence> <xs:element name="Id" /> <xs:element name="pdf" type="xs:base64Binary" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> 2. Included schema file using database export. 3. Created new subreport within main report and link to dataset created using step 2. 4. Dynamically passing the datastram to the datarow of the dataset. Code snippets for this as below: Private Sub EmbedFile(ByVal sSubReport As String, _ ByVal sFileName As String, _ ByVal sSource As String, _ ByVal sSchemaFile As String) Dim xmlFile As String = Server.MapPath(sXmlPath & sSchemaFile) Dim ds As New DataSet ds.ReadXml(xmlFile) Dim dc As DataColumn = New DataColumn(sSource, GetType(Byte())) ds.Tables(0).Columns.Add(dc) Dim fs As New FileStream(sFileName, FileMode.Open) ' create a file stream Dim br As New BinaryReader(fs) ' create binary reader For Each dr As DataRow In ds.Tables(0).Rows dr(sSource) = br.ReadBytes(br.BaseStream.Length) Next reportDocument.OpenSubreport(sSubReport).SetDataSource(ds) fs.Close() End Sub Calling above method as below: strFileName = Server.MapPath("../revcert/revcert_sample.pdf") EmbedFile("RevsCert", strFileName, "pdf", "revscert.xml") When I run the report, it show blank. If i change the pdf to some jpg or bmp file, It comes with image, but not work for PDF file. Any Idea? I appreciate someone help me to fix it. Thank you for your time. ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/BDOTNET/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
