Frequently Asked Question:
Load PDF from blog field in SQL Server 2008
I have stored a pdf file in a blob field in SQL Server 2008 table. How I can load this file using the quick PDF Library DLL edition. I have tried to use the QuickPDFLoadFromFile or QuickPDFLoadFromString but I cannot.
The following functions should be of assistance to you:
char * QuickPDFCreateBuffer(int InstanceID, int BufferLength)
int QuickPDFAddToBuffer(int InstanceID, char * Buffer, char * Source, int SourceLength)
int QuickPDFLoadFromString(int InstanceID, char * Source)
int QuickPDFReleaseBuffer(int InstanceID, char * Buffer)
Here are the steps to follow:
- Read the PDF data from the database into a block of memory.
- Call QuickPDFCreateBuffer to ask Quick PDF Library to make an internal buffer the same size as the data you read from the database. The function will return a 32-bit pointer to the start of the buffer.
- Call QuickPDFAddToBuffer to add the data from the database into the Quick PDF Library buffer.
- Call QuickPDFLoadFromString, passing it the pointer you got from step 2, to load the PDF.
- Call QuickPDFReleaseBuffer to release the memory.