Re: saving pdf's to the database
Re: saving pdf's to the database
- Subject: Re: saving pdf's to the database
- From: Tim Worman <email@hidden>
- Date: Wed, 23 Sep 2009 13:28:07 -0700
I'm going to try and do the same as I am doing with my other component
and have these open in a new window.
Tim
On Sep 23, 2009, at 10:16 AM, John & Kim Larson wrote:
That's all I do. Are you embedding the file in the page or having
the response download the file as an attachment?
John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104
Sent from my iPhone
On Sep 23, 2009, at 11:24 AM, Tim Worman <email@hidden> wrote:
John:
Thanks for the response. In our case the files will always be pdf
since we are requiring that as the format of the originating user's
submission. I can definitely see the file size concern if the pdf
is a big ole glorified image. Hopefully, most of the users will
produce their pdf's by printing to pdf in mac os x (or acrobat on
Windoze).
I already had a component class that takes plain text blobs (logs)
from the database, converts them to pdf, and presents them in a
browser window. That class doesn't work on the blobs where the file
was originated as pdf. So, I got concerned that maybe I was missing
something saving the NSData. My database saves blobs to the file
system so I tried reading one as a pdf and couldn't. Hence my
question.
I've assumed that I should just be able create a response that
simply returns my NSData object and set the proper content-type. Am
I on the right track?
Thanks for your help.
Tim
On Sep 23, 2009, at 9:02 AM, John & Kim Larson wrote:
Hi Tim,
We do this all the time with receiving reports, prints, etc. Since
the component I use for upload handles any file type ( Word,
images, PDF) I keep track of the file extension that the file was
uploaded with in an attribute of my File entity. I then use that
information to reconstitute the mime type when either embedding or
downloading the file. There's not too much magic there, just a
bunch of if elses to get the mime type from the extension. I can
try to help you if that isn't enough info.
Another gotcha is to make sure that your file size doesn't exceed
the blob capacity. PDFs from text are fine, but if someone uploads
a high res scanned file as a PDF, you will get an error either
upon committing the change or upon trying to view the file.
JAL
John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104
Sent from my iPhone
On Sep 23, 2009, at 10:45 AM, Tim Worman <email@hidden> wrote:
WO'ers:
I am writing an application where users can upload pdf files -
which my app saves to the database. I also need to have
mechanisms in place where a "reviewer" can browse the documents
that have been uploaded. The upload and saving to the database
seems to be working. This is modeled as 'blob' and the class type
is 'NSData.' The files are uploaded via AjaxFileUpload.
I have saved plain text files to the database before but I'm
concerned that there is something more I need to do to save the
pdf files. Are there special considerations for maintaining the
mime type, continuity, etc. of these files before I save them as
NSData to the database? Also, I am not sure how to present the
files to the reviewer. I have converted text to pdf for viewing
before but I'm stuck on reconstituting a pdf for display.
If anyone has any pointers or code examples that would really
help me as I'm under a serious time crunch.
Tim
UCLA GSE&IS
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden