Writing about my code is a brain storming that make me think more about it
coding is like scuba diving: the more you think about it, the deeper you go
so, at our compagny, we use frames in autocad to enclose drawing with information about name, revision, ingeneer signatures etc.
but not everyone use autocad on a daily basis
so we needed to reproduce a frame, of each format: a0, a1, a2, a3 that will contain information for the floor work in a factory
we did not want multiples pages. that is why there is 4 different size
the goal is to:
take a table from sheet1 (soushe = source sheet)
generate a frame in paper format a3 (based in acrobat pdf printer)
try to fill the frame with the date contained in the source sheet
if the a3 is too small, rebuild the frame with a2, a1, and finally a0 if it is still too small to fit in one sheet
the difficulties are:
the source sheet always have multiple columns
each line can be short or long, we cannot cut the line when we put them in the destination sheet with the frame (shedes = sheet destination)
so some line will be double or even triple
the destination sheet will be pixelised
each line will have a normal height, but will be expanded in height (double heaight, triple etc.) if the line from the source sheet have too much text
but this must be done with an average of the width of the letters, as M is larger than I
and finally, is i double the height and the text still dont fit, i must add height
her is an image of the corner of the frame generated:
as you can see the line height are smaller where the frame info is
the column is a pixel large only and lots of merge are done
now my goal is to automate the filling of the line that are just above the frame
No comments:
Post a Comment