How to create multiple PDF file in OpenACS - pdf-generation

Currently I can generate a single PDF file using this process:
ad_returnredirect to ADP pages (the PDF template)
Create a PDF using the eval [template::adp_compile -file $template].
ad_returnredirect "/pdfs/$folder/${fileprepend}.pdf" to file location to download.
But what I need is to generate a multiple PDF files. I tried to use the same process and add a loop... but as you can see it requires to visit the ADP pages first before it can generate template and create a PDF files, is there any other way to create a PDF files in sub-process without visiting the pages for template?

HTTP file delivery only allows one file to be returned, and there is no way to package multiple PDF files in one return. So I understand it's HTTP and not OpenACS that causes your "problem".
I'd just setup one page with links to all the PDF document you'd want the user to download. Or you could zip them together into one file.

Related

How to edit metadata of an uploaded file to mediawiki?

I am using a extension with mediawiki that uses the metadata of the uploaded file to generate its title.
However I cannot see how to edit the metadata for an uploaded file in mediawiki at all.
Here is the documention for the extention:
CategoryGallery with captions generated from image description files
(requires CategoryGallery extension) You'll need
Extension:CategoryGallery for this. Place image descriptions on your
image file pages (e.g. File:Popsicle stick Eiffel Tower.jpg) using the
same PageSummary template as before. Now, on the page where you're
putting the gallery, use e.g.:
<catgallery cat="Aubry" bpdcaption="short_summary" />
The result is as
follows (note how the captions are generated using the metadata you
saved on each image page):
How can I do this? Here is an example of the files I have uplaoded: http://www.gwart.co.uk/File:Eldar_Avatar_-_Mark_Gibbons_1994.jpg
If you are talking about metadata generated by CommonsMetadata, see here. There is also metadata extracted from the file; you can't edit that, short of editing the file itself.

Use EC2 for PDF Generation, provide public URL to user

I have developed an application which allows Users to select multiple "transactions"; each of this is directly related to a PDF file.
When a User multi-selects them, and "prints" them, these PDF files are merged into one longer file to provide ease of print.
Currently, "transaction" PDFs are generated on request, and so is PDF-merging.
I'm trying to scale this up relaying over Amazon infrastructure, some questions arised to me.
Should I implement a queue for the PDF generation per "transaction"? If so, how can I provide the user a seamless experience? We don't want them to "wait"
Can I use EC2 to generate these PDF files for me? If so, can I provide a "public" link for the user to download the file directly from Amazon, instead of using our resources.
Thanks a lot!
EDIT ---- More details
User inputs some information through a regular form
System generates a PDF per request, using the provided information for the document
The PDF generated by the system is kept under Amazon S3
We provide an API which allows you to "print" multiple pdfs at once, to do so, we merge the selected PDF files from S3, into one file for ease-of-print
When you multi-print documents, a new window is opened which is your merged file directly, user needs to wait around 20ish seconds for it to display.
We can to leverage the resources used to generate the PDFs onto Amazon infrastructure, but we need to keep the same flow, meaning, we should provide an instant public link to the User to download & print the files.
Based on your understanding, i think you just need your link to be created immediately right after user request for file. However, you want in parallel to create PDF merge. I have idea to do that based on my understanding, and may be it could work in your situations.
First start with some logic to create unique pdf file name, with random string representing name of file. And at same time in background generate PDF, but the name of PDF should be same as you created in first step. This will give user instant name of file with link to download. However, your file creation is still in progress.
Make sure, you use threads if using PHP or event loop if using Node.JS to run both steps at same time. This will avoid 404 error for file not found.
Transferring files from EC2 to S3 would also add latency delay. But if you want to preserve files for later or multiple use in future then S3 is good idea as it could simply serve PDF files for faster delivery. As we know S3 is used for static media storage. Otherwise simply compute everything and generate files on EC2

fineuploader - initial file list - edit file name functionality

When using the inital file list functionality to populate fineuploader with previously stored files, is it possible for the edit filename functionality to be used?
At the moment it seems that the edit elements are hidden in the template, although it would be relatively simply if this functionality were enabled to hook onto the rename trigger and save the updated filename via ajax (what i'm hoping to achieve).
So is there someway to enable the edit filename for the initial file list?
Your requirements are outside of the scope of a file upload library. If you want to allow your users to rename a file uploaded in a different session, you will need to provide for this in your custom web application. You can certainly modify the file list provided by Fine Uploader after it is rendered with the initial files.

Generating PDF files from Database using CodeIgniter

Generating PDF files from Database using CodeIgniter
for example,
when i click save button all contents in the table can downloaded as pdf format
please help me
thanks...
Take a look at this article.
http://www.christophermonnat.com/2008/08/generating-pdf-files-using-codeigniter/
Also my answer is helful too.
cezPDF in Codeigniter 2
on the user click you should hit a controller function which will query the database and load a view file which you can pass to this library and it will throw it as pdf.
There is no native PDF library in CodeIgniter, so you need to use an third party library or a third party software-as-a-service (SaaS) to generate the PDF.
Here is what I did for one client.
I first generate a nicely formatted, print-friendly HTML page using standard CodeIgniter techniques to select the data from the relevant table, sort it, and echo to the page.
Next, I use the following SasS to turn my formatted HTML page into a PDF download:
http://www.htm2pdf.co.uk
This is a commercial system, but relatively affordable and quick and easy to use.
Alternatively, if you want to do some custom programming, you can try:
http://html2pdf.fr
In this case, you need to link to the class file (external to CodeIgniter) and call
the various methods to generate the PDF. This approach does not require an annual fee
but it will take more programming effort.
You can use codeginter's database utility for getting backup in txt format first http://ellislab.com/codeigniter/user-guide/database/utilities.html#backup
Then you can read the generated file and convert it in pdf using https://github.com/aiwmedia/HTML2PDF-CI
This pdf will you can give for download

Image File Uploads Security

I am implementing a project to my site to allow users to upload image files (ai, pdf, jpeg, gif, tiff). I know this can be very risky but I was wondering what kind of security checks I should put in place to make sure these files to not cause my site any harm.
OR
Should I use something like dropbox to upload my images? If I do this is it possible to get these images whenever I want so I can display them within the browser to the user?
image uploads are fine, because you know what you want: An image
First rule is never to trust the client, so let the user upload the file (maybe you want to add an upload size limit).
Second, you have to ensure that the image is really an image so
Check the mime-type of the file (don't go by the file extension, use a real mime type check like the file shell command or an appropriate library)
To really make sure the file is OK, Open and Reprocess it using an image library like GD, ImageMagick etc. and save it to disk (keep in mind this needs some resource!). This will also filter out corrupted images.
An uploaded file usually doesn't harm the site itself but the users who download the file.
I've come across with a file uploading part of a project I worked.
Some high-level suggestions to complement sled's answer:
The mime type is set on base of the file extension, so it's no useful (as the file has not been uploaded yet to the server, the mime type is just a 'guess' in base of his extension).
So solutions would be:
Do the content check client-side (before sending the http-request)
When you get the whole file by HTTP do the check server-side before persisting to the disk.
Other Suggestions:
The simple file extension check
(wheter by filename or mime-type) is
the basic secutiry measure that also
has to be present.
Folder permissions: Don't allow execute permissions, don't allow the user to create new folders (as it might create a sub-folder with executing permissions).

Resources