February 23, 2015 at 12:18 pm
I have pdf files stored in my sql db and would like to extract them to a folder. I have a script that will list them all but don't know how to actually write them to the folder. Can someone help me finish this up?
declare @path varchar(100)= 'c:\images\'
Select [CreatedDate], subject, @path+ltrim(subject)+'_'+filename as path
from pdftable where subcategory='Finished Goods Certification' and (CreatedDate >= CONVERT(DATETIME, '2014-08-01 00:00:00', 102))
order by CreatedDate
thanks
February 23, 2015 at 12:31 pm
certainly possible, but you probably need a bit more information.
this example here, you could adapt, and is assuming there is an identity/primary key to the table.
If you can install CLR on a database, i personally use a version of Elliot Witlows Common Language Runtime example he published here:
http://nclsqlclrfile.codeplex.com/
--MSPSaveFileImage
-- Parameters: @FilePath,@FileName,@FileBytes
-- purpose: given an varbinary image column in a table, write that image to disk
-- usage:
--assumes table and the file from the example above for dbo.MFGetFileImage exists already.
declare @myfile varbinary(max)
SELECT @myfile = rawimage FROM myImages WHERE id = 1
EXEC dbo.MSPSaveFileImage 'C:\Data','spinning.gif',@myfile
Lowell
February 14, 2016 at 12:13 am
Hi, Mark.
Thanks for sharing your problem. When it comes to pdf processing, I have another question to ask you. I wonder whether text extraction from pdf files[/url] is much simpler than pdf to text conversion[/url] process. Thre's something wrong with my pdf viewer. I want to look for a method to help with the relevant process. Any suggestion will be appreciated. Thanks in advance.
Best regards,
Pan
January 29, 2020 at 12:29 am
So I am new to SQL forums, so please bear with me. I have a similar issue. I have PDF's and JPG's stored within a table. Each record is associated with a session number as the number of PDF or JPG files per "session" can vary. I would like to export the files using the filename within the record for each file in a directory named using the session number. Any ideas/concerns?
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy