Link to home
Start Free TrialLog in
Avatar of sbornstein2
sbornstein2

asked on

.Net - web service sending Binary PDF files, basic question

Hello all,

I need to send via a web service from a provider PDF files in binary format.  This may be a stupid question but do I create these files in binary format somehow and then they are stored in the database table or does the actual PDF file have to live in a file directory on the server etc.  Is there any software I need to use to handle this?  Right now I have an access database that the report exists as a access based report not PDF right now.  So trying to figure out what I am going to need to gear up for to create these files in a loop to a table and or directory.

Thanks for any information so I have my ducks in a row.
Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

This depends on the database software - most of the major databases support BLOB (binary large object) data types that allow you to store binary objects right inside a database record.  Even access allows this, see http://www.codeproject.com/KB/database/AccessBlob.aspx

However, storing the filename in the database and keeping the file in a directory is a common way to handle this - keep in mind you need to keep them in synch, though.
Avatar of sbornstein2
sbornstein2

ASKER

okay but what I am wondering is if a web service accepts a binary file, do I have to actually physically create the PDF document or is there away to just store the binary format?
do I need something specific in my .Net application to create it as a stream or something to the web service if the client is telling me they accept the PDF in binary format?

This is what they said they accept:

bytDocument As Byte() – Actual binary PDF document. (ex: File.ReadAllBytes)
All you need is a Byte array, which you can get by reading a file with ReadAllBytes, or by other methods....how are you proposing to GENERATE the .PDF file in the first place?
Good question jensfiederer, I think I may have ABCPdf or something I can use on the client.  So I see what your saying maybe loop and create the PDF files and then when passing it I can use the read into a byte array and then pass it along as a binary stream I guess if that makes sense.
ASKER CERTIFIED SOLUTION
Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
great thank you.