Print Page | Close Window

Retrieve pdf from db column and stream to browser

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1066
Printed Date: 25 Jun 25 at 5:57PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Retrieve pdf from db column and stream to browser
Posted By: tallen14218
Subject: Retrieve pdf from db column and stream to browser
Date Posted: 21 Apr 09 at 5:47PM
Hi folks,
 
I was wondering if anyone has been able to do something like this before. I have an ASP page that retrieves a PDF from a SQL Server table (stored in an image column). I can Response.BinaryWrite that to the browser, but I need to be able to add a logo to the PDF before I stream it to the browser.
 
My thought was to read the PDF into a memory variable and then use the LoadFromString or LoadFromVariant functions to get the PDF into an object, and then add the logo and then output the modified PDF.
 
However, I can't seem to get the binary PDF data from the database loaded using either function. What am I missing?
 
Code sample:
 
sContent = rsPDF.Fields("Contents")
nRC = pdf.LoadFromString(sContent, Len(sContent))
pdf.DrawText 1, 1, nRC
Response.BinaryWrite pdf.SaveToVariant()
Thanks,
 
Tom
 


-------------
Tom



Replies:
Posted By: Ingo
Date Posted: 22 Apr 09 at 2:30AM
Hi Tom!

DrawText is for the visible textcontent of a pdf-document - not for the unvisible code behind a pdf-document.
LoadFromString needs the complete code of your future pdf-document you want to create or examine.

So the question is what's in your variable "sContent"?
Is there something beginning with "%PDF-1. ..."? It should be 'cause this are the first bytes of each pdf-file.

If you want to create a new pdf with sContent you should use pdf.SaveToFile (that's the complete code) instead of pdf.DrawText (that's only the text).

Cheers and good luck!
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk