pdf generation - Grouping rectangles in iTextSharp -


I have several rectangles and all share the same color. Is there a way to merge / group them into a vector object, then the size of the generated PDF is small?

If you are making a document with scratch, the answer is trivial: Yes!

It is enough to attract all the paths of the rectangle that share the color of the same place and then fills the operator, strokes or fills & amp; Path stroke

If you are talking about optimizing an existing PDF document, then you are coming for some heavy programming. You will need to parse every content stream in search of rectangle operators (assuming that the rectangles do not move through move-to and line-to operator), fill these shapes and / or check in strokes, and then these Reorder all operators. It would have been a lot of thought that I would know where it started, but I can not predict where it will end. It will probably be known that this form means more important to define a single rectangle as XObject and to reuse a single external object, perhaps not. It is difficult to predict.

Apart from this: You are talking about operators in one stream. These currents are compressed in some way, so you are doing a lot of work to achieve only a very small reduction in size.

I would say: Whatever you are asking is possible, but it is not clear why you will do this, because this will only reduce a limited limitation in the file size.

If size is an issue, then there may be other places where you are "wasting the bytes" which can be more desirable results. I'm very curious to hear why you feel that rectangles are using criminals using spot colors. You are reusing the color charge of the spot, are not you? If you are making a new spot color example for every rectangle, you have got the real culprit and you can avoid grouping the rectangles.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -