I current store several pdfs in a SQL Server table (in a binary column). To display the file, i use a standard stream and output it to the browser. However, I'd like to use Merger, because I have several related pdfs that i'd like to merge into one for the user.
Here is the code to display the one that is currently used to display the one file:
DataSet ds = new DataSet();
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["PedigreeSS"].ConnectionString);
using (conn) {
using (SqlCommand cmd = new SqlCommand("dbo.spGetPedigreeFile", conn)) {
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("FileID", Request["FileId"]);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(ds, "FileData");
}
}
Response.Clear();
Response.ContentType = "application/pdf";
Response.OutputStream.Write(ds.Tables["FileData"].Rows[0]["FileData"] as Byte[], 0, int.Parse(ds.Tables["FileData"].Rows[0]["FileSize"].ToString()));
Response.End();
with the small window, word wrapping looks bad...
Thanks,
Mike
Database stored pdfs
Re: Database stored pdfs
Support · Dec 11, 2007Hello Mike,
Are you using our product to generate the PDF document? The code you have sent does not have any thing from our product. What exact problem are you having? Please send over the output PDF and the code you are using to generate the PDF to our [^a|mailto:support@cete.com|Support Team^] so that they can take a look at it.
Thanks,
ceTe Software Support Team.
Re: Database stored pdfs
Forum member · Dec 11, 2007I figured it out...
I have to use the PdfDocument object
pd = new PdfDocument(ds.Tables["FileData"].Rows[0]["FileData"] as Byte[]);
md.Append(pd);
Thanks...
Re: Database stored pdfs
Forum member · Dec 11, 2007as an FYI, i was not using your product to generate the pdf. the pdf is sent to us from our vendors, and I have to display that information to our customers. Sometimes there are multiple pdf documents per item. By using the PdfDocument object to create a pdf from the datacolumn, I can then append those items together using the merge tool.
Thanks again for the great product.