There are several approaches to this. It is difficult to get a precise cut-off point, but I assume that an approximate cutoff size is sufficient. I give you three possible ways below.
I am assuming that the pdf consists of records. Each record consists of information that need to be kept in the same pdf. Approach one (assumes homogenous record size): Cut after N records. Assumes that all records adds a similar size to the pdf. Use trial and error to find a suitable number of records. Approach two (works with heterogenous records): Cut after N pages. As long as the pdf is <N pages, add another record. Use trial and error to find a suitable number of pages. Approach three: Cut after N bytes. Obtain the file handle of the Document and check the current size. If the size is <N, add another record. Note that you need to flush the document before measuring. Also note that some information won't be written until you close the pdf, so expect the pdf to become a little larger when you close it. I'm no expert on pdf syntax or the inner workings of iText, so if any approach is a bad idea, please enlighten me. /Klas Kumar, Purushotam skrev 20:59: > I was looking for an article to split the PDF on the basis of size of > the PDF but couldn't get one. > Appreciate your help > > > Thanks and Regards, > Puru > 919-458-1502 > ------------------------------------------------------------------------------ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
