Search code examples
filepdftestingfile-uploadfilesize

Easy way to make a test PDF of a certain file size


want to test the upload file size limit in an application, and it's a pain finding / making various pdf's of certain sizes to test / debug this. Anybody have a better way?


Solution

  • You can write a simple shell script that converts set of images to pdf: How can I convert a series of images to a PDF from the command line on linux? and do it for 1,2,3, ..., all image files in certain directory.

    Creating directory full of copies of single image, should be simple too, start with one image file with desired size e.g. 64KB.

    # pseudocode - don't test it
    END=5
    for i in {1..$END}; do cp ./image ./image_$i; done
    for i in {1..$END}; do convert ./image_{1..$i} mydoc_$i.pdf; done