Re: saving pdf's to the database
Tim, I don't know if you got this working yet, but I'm just trying to stick with you on this. The reason I skipped the db encoding path was that I assumed you were using the same system for db storage as your previously mentioned capability, namely storing PDFs generated with iText. If you can store those PDFs I assumed you could store any PDF. This made me think that perhaps your handoff of data somewhere between eof and the components, or perhaps just the components, was erroneous. To the end of isolating the problem, and forgive me if you have already, can you make the thing work by skipping the db and just hold the data in an instance variable in your eo instance when debugging? Specifically, if you skip the takestoredvalueforkey and just keep the data in an nsdata field does it work? This won't persist across sessions or object stores, but if you use the same eo while debugging can you get the file to display? 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 4:47 PM, Tim Worman li...@thetimmy.com wrote: On Sep 23, 2009, at 2:43 PM, Chuck Hill wrote: On Sep 23, 2009, at 2:28 PM, Tim Worman wrote: 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. How does it present the converted files? It implements iText but at some point I will be moving to PDFKit. I present the text as a PDF in a new window. The same thing should work with the PDF in a database. Right, but since it should already be a PDF, I don't need any translation or need for my iText implementation, correct? Yeah, just the present the text as a PDF in a new window part. 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. That might be an artifact of your database (adding extra info). It could also be that there is some encoding/re- encoding happening that is scrambling the contents of the file. Which database are you using? I'm using OpenBase and I suspect what you're saying is right. It does cause some worry though since I don't have the review portion working yet. :-) You are certain it is a BLOB not a CLOB? How is the attribute modeled? I've modeled it as a blob, with the external type 'object.' OpenBase has a 'binary' type but it seems 'object' should be correct. I attached a screenshot. I don't think you did. :-) I am not sure which type is correct, or if both are. Chuck Damnit, I hate it when you're right even more than normal. Screenshot attached. Screen shot 2009-09-23 at 2.24.24 PM.png Tim 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? That is what I have always done in the past. It _should_ be simple and straightforward. Chuck 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 li...@thetimmy.com 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
Re: saving pdf's to the database
John: I really appreciate you following up about this. This is an awesome community. I actually did get this to work and luckily it is as easy as it should be. Instead of using my existing iText component I just had to make a new one and set up the WOResponse with the pdf data straight from the database. The iText related component is taking text logs and converting them to pdf's. Since the raw data should already be PDF I realized that the existing component was probably breaking things and luckily I was right. In essence I got myself all worked up and worried and as usual the problem was me. Thanks so much for your help - it definitely got me headed in the right direction. Tim UCLA GSEIS On Sep 24, 2009, at 8:05 AM, John Kim Larson wrote: Tim, I don't know if you got this working yet, but I'm just trying to stick with you on this. The reason I skipped the db encoding path was that I assumed you were using the same system for db storage as your previously mentioned capability, namely storing PDFs generated with iText. If you can store those PDFs I assumed you could store any PDF. This made me think that perhaps your handoff of data somewhere between eof and the components, or perhaps just the components, was erroneous. To the end of isolating the problem, and forgive me if you have already, can you make the thing work by skipping the db and just hold the data in an instance variable in your eo instance when debugging? Specifically, if you skip the takestoredvalueforkey and just keep the data in an nsdata field does it work? This won't persist across sessions or object stores, but if you use the same eo while debugging can you get the file to display? 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 4:47 PM, Tim Worman li...@thetimmy.com wrote: On Sep 23, 2009, at 2:43 PM, Chuck Hill wrote: On Sep 23, 2009, at 2:28 PM, Tim Worman wrote: 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. How does it present the converted files? It implements iText but at some point I will be moving to PDFKit. I present the text as a PDF in a new window. The same thing should work with the PDF in a database. Right, but since it should already be a PDF, I don't need any translation or need for my iText implementation, correct? Yeah, just the present the text as a PDF in a new window part. 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. That might be an artifact of your database (adding extra info). It could also be that there is some encoding/re- encoding happening that is scrambling the contents of the file. Which database are you using? I'm using OpenBase and I suspect what you're saying is right. It does cause some worry though since I don't have the review portion working yet. :-) You are certain it is a BLOB not a CLOB? How is the attribute modeled? I've modeled it as a blob, with the external type 'object.' OpenBase has a 'binary' type but it seems 'object' should be correct. I attached a screenshot. I don't think you did. :-) I am not sure which type is correct, or if both are. Chuck Damnit, I hate it when you're right even more than normal. Screenshot attached. Screen shot 2009-09-23 at 2.24.24 PM.png Tim 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? That is what I have always done in the past. It _should_ be simple and straightforward. Chuck 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
Re: saving pdf's to the database
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 li...@thetimmy.com 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 GSEIS ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com This email sent to the_lars...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: saving pdf's to the database
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 li...@thetimmy.com 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 GSEIS ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com This email sent to the_lars...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: saving pdf's to the database
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 li...@thetimmy.com 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 li...@thetimmy.com 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 GSEIS ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com This email sent to the_lars...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: saving pdf's to the database
Here's another do'oh question: are you sure the data is making it to the db from the upload? 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 li...@thetimmy.com 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 li...@thetimmy.com 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 GSEIS ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com This email sent to the_lars...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: saving pdf's to the database
Hi Tim, Have you looked at ERAttachment? It has been designed to do exactly what you are attempting and optionally ties into the AjaxFileUpload component. The framework provide a single unified set of components and models that can allow the storage of attachments on your local filesystem, served through your webserver; on your local filesystem served through a custom request handler; in your database, served through a custom request handler; and on Amazon's S3 service, served directly from S3. The intent of the framework is to make it very simple to control how the attachments are stored and served by simple adjusting some configuration properties. It also has attachment viewer components. Save yourself some time, use ERAttachment. http://webobjects.mdimension.com/hudson/job/Wonder53/javadoc/er/ attachment/package-summary.html David On 23-Sep-09, at 9:24 AM, Tim Worman 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 li...@thetimmy.com 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 GSEIS ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/the_larsons% 40mac.com This email sent to the_lars...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/programmingosx %40mac.com This email sent to programming...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: saving pdf's to the database
On Sep 23, 2009, at 10:15 AM, Chuck Hill wrote: Hi Tim, On Sep 23, 2009, at 9:24 AM, Tim Worman 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. How does it present the converted files? It implements iText but at some point I will be moving to PDFKit. I present the text as a PDF in a new window. 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. That might be an artifact of your database (adding extra info). It could also be that there is some encoding/re-encoding happening that is scrambling the contents of the file. Which database are you using? I'm using OpenBase and I suspect what you're saying is right. It does cause some worry though since I don't have the review portion working yet. :-) 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? That is what I have always done in the past. It _should_ be simple and straightforward. Chuck 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 li...@thetimmy.com 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 GSEIS ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com This email sent to the_lars...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net This email sent to ch...@global-village.net -- Chuck Hill Senior Consultant / VP Development Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: saving pdf's to the database
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 li...@thetimmy.com 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 li...@thetimmy.com 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 GSEIS ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com This email sent to the_lars...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: saving pdf's to the database
On Sep 23, 2009, at 1:27 PM, Tim Worman wrote: On Sep 23, 2009, at 10:15 AM, Chuck Hill wrote: Hi Tim, On Sep 23, 2009, at 9:24 AM, Tim Worman 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. How does it present the converted files? It implements iText but at some point I will be moving to PDFKit. I present the text as a PDF in a new window. The same thing should work with the PDF in a database. 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. That might be an artifact of your database (adding extra info). It could also be that there is some encoding/re-encoding happening that is scrambling the contents of the file. Which database are you using? I'm using OpenBase and I suspect what you're saying is right. It does cause some worry though since I don't have the review portion working yet. :-) You are certain it is a BLOB not a CLOB? How is the attribute modeled? Chuck 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? That is what I have always done in the past. It _should_ be simple and straightforward. Chuck 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 li...@thetimmy.com 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 GSEIS ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com This email sent to the_lars...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net This email sent to ch...@global-village.net -- Chuck Hill Senior Consultant / VP Development Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects -- Chuck Hill Senior Consultant / VP Development Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who
Re: saving pdf's to the database
Yeah, there is definitely data being stored. My only concern is that I don't have proof yet that I can read what I've written to the database. So, I was concerned but I expect that Chuck is right that the database probably manipulates file it stores. Tim On Sep 23, 2009, at 10:26 AM, John Kim Larson wrote: Here's another do'oh question: are you sure the data is making it to the db from the upload? 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 li...@thetimmy.com 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 li...@thetimmy.com 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 GSEIS ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com This email sent to the_lars...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: saving pdf's to the database
On Sep 23, 2009, at 1:41 PM, Chuck Hill wrote: On Sep 23, 2009, at 1:27 PM, Tim Worman wrote: On Sep 23, 2009, at 10:15 AM, Chuck Hill wrote: Hi Tim, On Sep 23, 2009, at 9:24 AM, Tim Worman 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. How does it present the converted files? It implements iText but at some point I will be moving to PDFKit. I present the text as a PDF in a new window. The same thing should work with the PDF in a database. Right, but since it should already be a PDF, I don't need any translation or need for my iText implementation, correct? 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. That might be an artifact of your database (adding extra info). It could also be that there is some encoding/re-encoding happening that is scrambling the contents of the file. Which database are you using? I'm using OpenBase and I suspect what you're saying is right. It does cause some worry though since I don't have the review portion working yet. :-) You are certain it is a BLOB not a CLOB? How is the attribute modeled? I've modeled it as a blob, with the external type 'object.' OpenBase has a 'binary' type but it seems 'object' should be correct. I attached a screenshot. Tim Chuck 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? That is what I have always done in the past. It _should_ be simple and straightforward. Chuck 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 li...@thetimmy.com 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 GSEIS ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com This email sent to the_lars...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net This email sent to ch...@global-village.net -- Chuck Hill Senior Consultant / VP Development Practical WebObjects - for developers who
Re: saving pdf's to the database
On Sep 23, 2009, at 2:28 PM, Tim Worman wrote: 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. How does it present the converted files? It implements iText but at some point I will be moving to PDFKit. I present the text as a PDF in a new window. The same thing should work with the PDF in a database. Right, but since it should already be a PDF, I don't need any translation or need for my iText implementation, correct? Yeah, just the present the text as a PDF in a new window part. 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. That might be an artifact of your database (adding extra info). It could also be that there is some encoding/re-encoding happening that is scrambling the contents of the file. Which database are you using? I'm using OpenBase and I suspect what you're saying is right. It does cause some worry though since I don't have the review portion working yet. :-) You are certain it is a BLOB not a CLOB? How is the attribute modeled? I've modeled it as a blob, with the external type 'object.' OpenBase has a 'binary' type but it seems 'object' should be correct. I attached a screenshot. I don't think you did. :-) I am not sure which type is correct, or if both are. Chuck 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? That is what I have always done in the past. It _should_ be simple and straightforward. Chuck 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 li...@thetimmy.com 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 GSEIS ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects- d...@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com This email sent to the_lars...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net This email sent to ch...@global-village.net -- Chuck Hill Senior Consultant / VP Development Practical WebObjects - for developers who want to increase
Re: saving pdf's to the database
On Sep 23, 2009, at 2:43 PM, Chuck Hill wrote: On Sep 23, 2009, at 2:28 PM, Tim Worman wrote: 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. How does it present the converted files? It implements iText but at some point I will be moving to PDFKit. I present the text as a PDF in a new window. The same thing should work with the PDF in a database. Right, but since it should already be a PDF, I don't need any translation or need for my iText implementation, correct? Yeah, just the present the text as a PDF in a new window part. 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. That might be an artifact of your database (adding extra info). It could also be that there is some encoding/re-encoding happening that is scrambling the contents of the file. Which database are you using? I'm using OpenBase and I suspect what you're saying is right. It does cause some worry though since I don't have the review portion working yet. :-) You are certain it is a BLOB not a CLOB? How is the attribute modeled? I've modeled it as a blob, with the external type 'object.' OpenBase has a 'binary' type but it seems 'object' should be correct. I attached a screenshot. I don't think you did. :-) I am not sure which type is correct, or if both are. Chuck Damnit, I hate it when you're right even more than normal. Screenshot attached. inline: Screen shot 2009-09-23 at 2.24.24 PM.png Tim 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? That is what I have always done in the past. It _should_ be simple and straightforward. Chuck 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 li...@thetimmy.com 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 GSEIS ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com ) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com This email sent to the_lars...@mac.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: