Reduce file upload

Hello guys i need a help, I have the next problem I need to upload pdf files but they must have a maximum 150kb by customs disposal some experience or command to be able to reduce the PDF size that are uploaded

I think Monkey Bread’s PDF tools might offer a feature to compress the PDF post-upload. However, I’m uncertain if the compression size is adjustable. A potential workflow could be:

  1. Upload the PDF.
  2. Apply compression.
  3. Review the compressed size and decide whether to accept or reject it

Tks Jay i never try monkey pdf i wil search documentation about

There are several apps that can do that from a command line.

For example Ghostscript : https://opensource.com/article/20/8/reduce-pdf

Tks Ivan y read the link but how you implement that with api ?

No api, you use the Shell class to execute the Shell commands

I have used this site for manually reduce PDF file size (web interface):

I haven’t used their API: https://developer.ilovepdf.com/

What the OP meant was reducing a PDF before uploading, I think :thinking:

I see some suggestions where an online tool was needed.
If the concern is the network load, than compressing it with an online tool defeats that purpose.

I would read into the MBS plugins. But that would still upload a large file, to be compressed server-side.
A solution is to embed some Javascript code in your Xojo Web project, that would run in the browser.

I found an article on StackOverflow. I haven’t checked it yet. But that seems to be one way to go, I think.

tks for reply the user upload the file supose 2mb before save the file in the server, i need save with 150kb max that is the limit permitted

tks alberto i see the page and the api is 39 usd for 1000 converted files for month

I have seen some document PDFs that instead of having text fonts they are all images/pictures (think like a scanned page). It will be very hard to reduce some of those 2MB PDF to reduce to 150kb. The 150kb limit will be hard to meet depending on the files that can be uploaded and their source.

Is that ok or too much? We don’t know how many files you need to reduce the size per month.

Why not just upload a jpeg?

If necessary, you could just use Xojo to create your own iOS app, that scans an image, crop it, save it with the right compression settings… and finally upload it.

The MBS plugins helped me out with just these kind of things.

hi Alberto arround 7000 for month

i will tray that

What is going into these PDF files?

The biggest factors in the size of a PDF file are, in order of impact:

  • Raster images. If you are adding a lot of pictures, or using the text-to-bitmap workaround for Xojo’s lack of Unicode support in their PDF generation classes, this will quickly increase your file size.

  • Lots of fonts. Every font you use in your PDF adds to its size. This include stylistic variations, like bold and italic. However, don’t worry about using a font over and over - after you’ve used it once in the document, using it again doesn’t increase the file size.

Sorry, didn’t realize this thread was nearly two years old…! It showed up on the forum front page for some reason.

I noticed it too. Maybe someone commented and deleted his post? First Xojo PDF versions where basically an image packed as PDF. Fat, low quality and not scalable. I guess the complaint was from that era.