I am uploading PDFs from Dropbox/iCloud. But file sizes are like 50MB, 100MB. As of app requirement, there is no limit for file size to upload. How to reduce the file size before uploading to server?
You can use libHaru library to generate any kind of pdf. Try to reduce your pdf size while creating the pdf itself.
Related
I followed this document for handling multipart form data
I can upload ok with file size below 2GB. With the size is greater than 2GB, the application sends nothing.
Does anyone have experience in uploading large files using fsharp.data?
I am working on a PDF app which imports pdf document from Mail app. After importing the file (2 MB) in the app and opening it using PDFKit PDFDocument class the file size increases to 35 MB. I checked it by using PDFDocument.dataRepresentation() method and saving it in documents directory.
Can someone help me understand why does the file size increases by such a huge number? What is the best way to handle this situation?
I'm trying to load a large video file (over 700MB) into memory from the documents directory using let data: NSData = NSFileManager.defaultManager().contentsAtPath(path)! but it crashes my app. Smaller files load fine. Is there a better way to load larger files? Thanks.
Depending on what you want to do with the file, using NSData.init(contentsOfURL:options:) with the option .DataReadingMappedIfSafe may work for you.
This will map the file into memory (if possible), i.e. the file's contents will only be loaded (page by page) as you access them via the bytes property.
I m developing an application where i m giving functionality to export a pdf report with multiple images. It is working fine with pdf prawn. But loading time of report is more if i m rendering images. If i dont render images pdf file is exported very quickly. Is there any way to reduce the loading time or to compress the image file before render in pdf files.
Thanks.
For a rails app that works a lot with uploaded image heavy pdf files I'm looking for a way to optimize the file size of uploaded pdf's.
Adobe Acrobat has a 'save as reduced file size pdf' option which often halves the filesize when images are included.
I would like to do a similar action that is triggered after a file upload in my rails app.
Any ideas?
While #lzap's comment may be true, if you still want to give it a shot, you might look at pdftk (PDF Toolkit). Its a library for manipulating and creating PDF files that looks like it offers the ability to compress a given pdf file.
The library can be installed on most major operating systems, so if you have the ability to install it on your host, then simply call:
system("pdftk uncompressed-input.pdf output compressed-outpu.pdf compress")
inside your rails app whenever you want to compress a particular PDF file. I have no idea how long this would take, and if you are compressing many PDF's at the same time, you may want to consider handing off to a background job (without this, Rails will wait until the compression is done before returning anything to the browser, probably causing a timeout error for long running groups of compression calls).
Also, if your file names come from user input, be extra careful to avoid injection attacks.