I am testing out this PDF api for a new project. I have one large PDF (1000+ pages), and a second, smaller PDF (34 pages). What I need to do is loop through the large PDF, and after every 10 pages, insert the small one. I then need to save the resulting PDF to a new file (4400+ pages).
The code to accomplish this is easy enough, and it runs very quickly. My problem however, is the resulting file size. I would expect a properly optimized PDF to store those 34 pages as a resource and simply reference it, but it seems the API is writing the same pages to the file all 100 times. So if the first PDF is 60MB, and the second is 1MB, I would expect the result to be around 61MB, instead, it is 160MB.
Is there some way I can save the output as an optimized PDF?