Sorry I lost my self there.
What I wanted to say is.
When you convert the page write it to binary
And on the page with no HTML Page load event you say Response.BinaryWrite()
Then it will display the PDF File in the browser.
Printable View
Sorry I lost my self there.
What I wanted to say is.
When you convert the page write it to binary
And on the page with no HTML Page load event you say Response.BinaryWrite()
Then it will display the PDF File in the browser.
Still I couldn't get you?
can you provide sample example for what you are saying?
Attached you will find a Example Zip File.
protected ReportDocument rptDocument;
private void Page_Load(object sender, System.EventArgs e)
{
rptDocument = new ReportDocument();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.BinaryWrite(ReportConvert(CreateDataSource()));
}
private DataSet CreateDataSource()
{
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand("select top 10 * from dbo.syscolumns");
SqlConnection connection = new SqlConnection(@"");
cmd.Connection = connection;
SqlDataAdapter sqlAdapter = new SqlDataAdapter(cmd);
sqlAdapter.Fill(ds);
return ds;
}
public byte[] ReportConvert(DataSet ds)
{
try
{
this.rptDocument.Load(Server.MapPath(@"Report.rpt"));
this.rptDocument.SetDataSource(ds);
return this.ExportToPDF();
}
catch(Exception ex)
{
throw (ex);
}
}
protected byte[] ExportToPDF()
{
ExportOptions exportOptions;
System.IO.Stream st;
exportOptions = this.rptDocument.ExportOptions;
exportOptions.FormatOptions = new PdfRtfWordFormatOptions();
exportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
ExportRequestContext expRequest = new ExportRequestContext();
expRequest.ExportInfo = exportOptions;
st = this.rptDocument.FormatEngine.ExportToStream(expRequest);
byte[] returnValue = new Byte[int.Parse(st.Length.ToString())];
st.Read(returnValue, 0, int.Parse(st.Length.ToString()));
return returnValue;
}
Hi Neildw,
Can it be done without the use of crystal reports?
Or, suppose we don't want to send it to client, but we want to save it on the server?
Yes I think you can..
Haven’t tried it but I think you can.
The reason why I didn’t try it. Cause the company I do development for are very fussy on security so we are not allowed to save stuff to the server. Only in a DB'
have a look at that site.
im busy downloading it as we speak..
to have a look
I'm in the same issue using asp/asp.net.
Would you please suggest an ActiveX control that can convert a HTML file to PDF like this:
oPDF.Convert("d:\test\src.html","d:\test\dest.pdf")
I have tried to use Acrobat Distiller printer but always face with user permission problem.
Things went smootly when I use the Distiller printer in VB, but not with ASP, although I tried use the same code directly in ASP page or move the print feature to COM.
If I set Internet user as Administrator, I could do it smoothly but I don't dare do the same thing on live server.
------------------------------------------
Save me if you can
Hi
Try HtmlDoc , it is free. and run it as a process in C# and commmand line arguments are needed
you can download it from
http://mamboforge.net/frs/?group_id=227&release_id=625
and htmldoc home page is
http://www.htmldoc.org/index.php
If you need any more help getback to me
with regards
Krishnan