Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Retrieve pdf from db column and stream to browser |
Post Reply |
Author | |
tallen14218
Beginner Joined: 25 Jan 06 Location: United States Status: Offline Points: 9 |
Post Options
Thanks(0)
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
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store