You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Mork0075 <mo...@googlemail.com> on 2007/12/06 15:17:19 UTC

Packing problem with SVG and Java

Hi guys,

i would like to solve a packing problem in a simple manner and i am
interested in your oppinions about the data structures and technologies
to use.

Algorithm input:

The input consists of multiple SVG files/strings (like <svg>...</svg>),
each one having a certain dimension, perhaps 4 cm x 5 cm

Desired output:

ONE pdf file with multiple pages and multiple of the svg (rendered)
"files" on each page (arranged in a efficient manner using the packing
algorithm)

Idea:

The problem is, that for the packing algorithm there's a need of having
all artefacts as a concret, "discrete" object instance.
Dealing with the packing problem in Java2D shouldnt be the problem,
there are rectangles, pages, coordinates etc. Transforming the Java2D to
final.pdf should also work. But what gives me a headache is how to
transform the input (svg files) into Java2D objects which i then can
arrange like normal  Java2D rectangles?

Is it understandable what i would like to do?

Here's another sketch. Thanks a lot for your help

Input:

-------------
| <SVG1> |
-------------

-------------
| <SVG2> |
-------------

-------------
|                |
|<SVG3> |
|                |
-------------


Desired output:

A4 page
------------------------------------------------
----------------------    ----------------------
| renderedSVG1 |   | renderedSVG2 |
----------------------- -----------------------
---------------------
|                          |
| renderedSVG3 |
|                          |
----------------------
------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Packing problem with SVG and Java

Posted by Mork0075 <mo...@googlemail.com>.
Oh my goodness, ten minutes after sending this mail and another trip on
google, the solution seems to be much easier.

Why mapping the svg files to objects, the desired calculations can also
be made with "pure" batik on the svg itself with its x,y, width and
height values.

So i construct a new svg file using batik like this <svg>...</svg>,
positioning as much as input svg files fit on this page (by manipulating
their x and y)
and create a second svg file to arrange the residual input and so on.

Is this the solution?


Mork0075 schrieb:
> Hi guys,
>
> i would like to solve a packing problem in a simple manner and i am
> interested in your oppinions about the data structures and technologies
> to use.
>
> Algorithm input:
>
> The input consists of multiple SVG files/strings (like <svg>...</svg>),
> each one having a certain dimension, perhaps 4 cm x 5 cm
>
> Desired output:
>
> ONE pdf file with multiple pages and multiple of the svg (rendered)
> "files" on each page (arranged in a efficient manner using the packing
> algorithm)
>
> Idea:
>
> The problem is, that for the packing algorithm there's a need of having
> all artefacts as a concret, "discrete" object instance.
> Dealing with the packing problem in Java2D shouldnt be the problem,
> there are rectangles, pages, coordinates etc. Transforming the Java2D to
> final.pdf should also work. But what gives me a headache is how to
> transform the input (svg files) into Java2D objects which i then can
> arrange like normal  Java2D rectangles?
>
> Is it understandable what i would like to do?
>
> Here's another sketch. Thanks a lot for your help
>
> Input:
>
> -------------
> | <SVG1> |
> -------------
>
> -------------
> | <SVG2> |
> -------------
>
> -------------
> |                |
> |<SVG3> |
> |                |
> -------------
>
>
> Desired output:
>
> A4 page
> ------------------------------------------------
> ----------------------    ----------------------
> | renderedSVG1 |   | renderedSVG2 |
> ----------------------- -----------------------
> ---------------------
> |                          |
> | renderedSVG3 |
> |                          |
> ----------------------
> ------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org