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 Bj...@si-software.de on 2004/12/14 09:45:41 UTC

Problem with alignment when printing

Hi,
I am trying to print this little SVG:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" 
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
  <g>
    <rect x="0" y="0" width="200" height="200" fill="darkblue"/>
  </g>
</svg>

When I am telling the printdialog to use 1cm margin each side the svg gets 
scaled (aspect ratio is preserved) to fit to the page, which is ok. What 
bothers me is that the square also gets centered in the vertical axis. It 
is important for me that when i use 1 cm margin the square starts 1cm from 
the left edge and 1 cm from the right and not 1 cm from the left and 
"somewhere" from the top. Does anybody have a guess how to change the 
alignment from center to northwest?

Thanks, Björn


Re: Problem with alignment when printing, UPDATE to prior mail

Posted by Thomas DeWeese <Th...@Kodak.com>.

Bjoern.Stenersen@si-software.de wrote:

> Thomas DeWeese <Th...@Kodak.com> schrieb am 15.12.2004 12:21:56:

>  >     Well, then something isn't working right ;)
>  >     Are you using the AOI hint?  Rightly or wrongly (probably
>  > wrongly) this bypasses the viewBox handling.
> 
> I am not using the AOI hint, why should I? 

    I don't know :).  As I stated above if you do use AOI it bypasses
the viewBox handling which is what is supposed to take 
preserveAspectRatio into account.

> As I understand the AOI hint it can be used to
> print a subarea of an SVG, but i wan´t to print the complete SVG. In the 
> PrintTranscoder I add the hint SCALE_TO_PAGE to Boolean.TRUE. 

    I don't think this should affect things.  If you are willing
to dive into the source the code that should be handling the
positioning is line 243 in the SVGAbstractTranscoder.

    Also what version of Batik are you using?  I seem to recall
fixing a number of bugs in this general area so it might be
worth your while to get the current CVS version and try that.

> To explain it a bit more precise 
> i created those two images:
> 
> Thats how it is right now:
> http://www.si-software.de/images/bs/wrong.gif
> 
> Thats how it should be:
> http://www.si-software.de/images/bs/right.gif
> 
> Perhaps you another idea how to get this result?
> 
> 
>  >
>  > >  > > Bjoern.Stenersen@si-software.de schrieb am 14.12.2004 09:45:41:
>  > >  > >
>  > >  > >  >
>  > >  > >  > Hi,
>  > >  > >  > I am trying to print this little SVG:
>  > >  > >  >
>  > >  > >  > <?xml version="1.0" encoding="UTF-8"?>
>  > >  > >  > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" 
>  "http://www.w3.
>  > >  > >  > org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
>  > >  > >  > <svg width="200" height="200" 
> xmlns="http://www.w3.org/2000/svg">
>  > >  > >  >   <g>
>  > >  > >  >     <rect x="0" y="0" width="200" height="200" 
> fill="darkblue"/>
>  > >  > >  >   </g>
>  > >  > >  > </svg>
>  > >  > >  >
>  > >  > >  > When I am telling the printdialog to use 1cm margin each 
> side the
>  > >  > >  > svg gets scaled (aspect ratio is preserved) to fit to the page,
>  > >  > >  > which is ok. What bothers me is that the square also gets 
> centered
>  > >  > >  > in the vertical axis. It is important for me that when i 
> use 1 cm
>  > >  > >  > margin the square starts 1cm from the left edge and 1 cm 
> from the
>  > >  > >  > right
>  > >  > >
>  > >  > > *** UPDATE ***
>  > >  > >
>  > >  > >  > and not 1 cm from the left and "somewhere" from the top. Does
>  > >  > >  > anybody have a guess how to change the alignment from center to
>  > >  > > northwest?
>  > >  > >  >
>  > >  > >  > Thanks, Björn
>  > >  >
>  > >  >
>  > >  >
>  > >  > 
> ---------------------------------------------------------------------
>  > >  > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>  > >  > For additional commands, e-mail: batik-users-help@xml.apache.org
>  > >  >
>  >
>  >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>  > For additional commands, e-mail: batik-users-help@xml.apache.org
>  >



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


Re: Problem with alignment when printing, UPDATE to prior mail

Posted by Bj...@si-software.de.
Thomas DeWeese <Th...@Kodak.com> schrieb am 15.12.2004 12:21:56:

> Bjoern.Stenersen@si-software.de wrote:
> 
> > 
> > Thomas DeWeese <Th...@Kodak.com> schrieb am 14.12.2004 
14:06:58:
> > 
> >  > Bjoern.Stenersen@si-software.de wrote:
> >  >
> >  > > Sorry, I mean it is important for me that the square starts 1cm 
> >  > > from the left edge and 1 cm from the top!
> >  >
> >  >     Look at the allowed values for the "preserveAspectRatio" 
attribute.
> >  > In particular 'xMinYMin meet'.
> > 
> > Do You mean to change the document itself or is there a parameter in 
the 
> > PrintTranscoder?
> 
>     This would need to be changed in the document (although the change
> to the document can be made after the 'source' document has been
> loaded.

I tried this, did not change anything :-(


> 
> > I changed my SVG to this:
> >   <svg width="200" height="200" preserveAspectRatio="xMinYMin meet" 
> >        xml:space="preserve" viewbox="0 0 600 600" 
> >        xmlns="http://www.w3.org/2000/svg">
> > 
> > and changed the preserveAspectRatio-Parameter several times, nothing 
> > happened. To be sure my programm has no bug I also tried to print with 

> > squiggle, same result, the output does not change, even though I 
changed 
> > the preserveAspectRatio-Parameter.
> 
>     Well, then something isn't working right ;)
>     Are you using the AOI hint?  Rightly or wrongly (probably
> wrongly) this bypasses the viewBox handling.

I am not using the AOI hint, why should I? As I understand the AOI hint it 
can be used to
print a subarea of an SVG, but i wan´t to print the complete SVG. In the 
PrintTranscoder I add 
the hint SCALE_TO_PAGE to Boolean.TRUE. To explain it a bit more precise i 
created those two images:

Thats how it is right now:
http://www.si-software.de/images/bs/wrong.gif

Thats how it should be:
http://www.si-software.de/images/bs/right.gif 

Perhaps you another idea how to get this result?


> 
> >  > > Bjoern.Stenersen@si-software.de schrieb am 14.12.2004 09:45:41:
> >  > >
> >  > >  >
> >  > >  > Hi,
> >  > >  > I am trying to print this little SVG:
> >  > >  >
> >  > >  > <?xml version="1.0" encoding="UTF-8"?>
> >  > >  > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" 
"http://www.w3.
> >  > >  > org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
> >  > >  > <svg width="200" height="200" 
xmlns="http://www.w3.org/2000/svg">
> >  > >  >   <g>
> >  > >  >     <rect x="0" y="0" width="200" height="200" 
fill="darkblue"/>
> >  > >  >   </g>
> >  > >  > </svg>
> >  > >  >
> >  > >  > When I am telling the printdialog to use 1cm margin each side 
the
> >  > >  > svg gets scaled (aspect ratio is preserved) to fit to the 
page,
> >  > >  > which is ok. What bothers me is that the square also gets 
centered
> >  > >  > in the vertical axis. It is important for me that when i use 1 
cm
> >  > >  > margin the square starts 1cm from the left edge and 1 cm from 
the
> >  > >  > right
> >  > >
> >  > > *** UPDATE ***
> >  > >
> >  > >  > and not 1 cm from the left and "somewhere" from the top. Does
> >  > >  > anybody have a guess how to change the alignment from center 
to
> >  > > northwest?
> >  > >  >
> >  > >  > Thanks, Björn
> >  >
> >  >
> >  >
> >  > 
---------------------------------------------------------------------
> >  > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> >  > For additional commands, e-mail: batik-users-help@xml.apache.org
> >  >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 

Re: Antwort: Re: Problem with alignment when printing, UPDATE to prior mail

Posted by Thomas DeWeese <Th...@Kodak.com>.
Bjoern.Stenersen@si-software.de wrote:

> 
> Thomas DeWeese <Th...@Kodak.com> schrieb am 14.12.2004 14:06:58:
> 
>  > Bjoern.Stenersen@si-software.de wrote:
>  >
>  > > Sorry, I mean it is important for me that the square starts 1cm 
>  > > from the left edge and 1 cm from the top!
>  >
>  >     Look at the allowed values for the "preserveAspectRatio" attribute.
>  > In particular 'xMinYMin meet'.
> 
> Do You mean to change the document itself or is there a parameter in the 
> PrintTranscoder?

    This would need to be changed in the document (although the change
to the document can be made after the 'source' document has been
loaded.

> I changed my SVG to this:
>   <svg width="200" height="200" preserveAspectRatio="xMinYMin meet" 
>        xml:space="preserve" viewbox="0 0 600 600" 
>        xmlns="http://www.w3.org/2000/svg">
> 
> and changed the preserveAspectRatio-Parameter several times, nothing 
> happened. To be sure my programm has no bug I also tried to print with 
> squiggle, same result, the output does not change, even though I changed 
> the preserveAspectRatio-Parameter.

    Well, then something isn't working right ;)
    Are you using the AOI hint?  Rightly or wrongly (probably
wrongly) this bypasses the viewBox handling.

>  > > Bjoern.Stenersen@si-software.de schrieb am 14.12.2004 09:45:41:
>  > >
>  > >  >
>  > >  > Hi,
>  > >  > I am trying to print this little SVG:
>  > >  >
>  > >  > <?xml version="1.0" encoding="UTF-8"?>
>  > >  > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"  "http://www.w3.
>  > >  > org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
>  > >  > <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
>  > >  >   <g>
>  > >  >     <rect x="0" y="0" width="200" height="200" fill="darkblue"/>
>  > >  >   </g>
>  > >  > </svg>
>  > >  >
>  > >  > When I am telling the printdialog to use 1cm margin each side the
>  > >  > svg gets scaled (aspect ratio is preserved) to fit to the page,
>  > >  > which is ok. What bothers me is that the square also gets centered
>  > >  > in the vertical axis. It is important for me that when i use 1 cm
>  > >  > margin the square starts 1cm from the left edge and 1 cm from the
>  > >  > right
>  > >
>  > > *** UPDATE ***
>  > >
>  > >  > and not 1 cm from the left and "somewhere" from the top. Does
>  > >  > anybody have a guess how to change the alignment from center to
>  > > northwest?
>  > >  >
>  > >  > Thanks, Björn
>  >
>  >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>  > For additional commands, e-mail: batik-users-help@xml.apache.org
>  >



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


Antwort: Re: Problem with alignment when printing, UPDATE to prior mail

Posted by Bj...@si-software.de.
Thomas DeWeese <Th...@Kodak.com> schrieb am 14.12.2004 14:06:58:

> Bjoern.Stenersen@si-software.de wrote:
> 
> > Sorry, I mean it is important for me that the square starts 1cm from 
the 
> > left edge and 1 cm from the top!
> 
>     Look at the allowed values for the "preserveAspectRatio" attribute.
> In particular 'xMinYMin meet'.

Do You mean to change the document itself or is there a parameter in the 
PrintTranscoder?
I changed my SVG to this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="200" height="200" preserveAspectRatio="xMinYMin meet" 
xml:space="preserve" viewbox="0 0 600 600" 
xmlns="http://www.w3.org/2000/svg">
 <g>
   <rect x="0" y="0" width="200" height="200" fill="darkblue"/>
 </g>

</svg>

and changed the preserveAspectRatio-Parameter several times, nothing 
happened. To be sure my programm has no bug I also tried to print with 
squiggle, same result, the output does not change, even though I changed 
the preserveAspectRatio-Parameter.



> 
> > Bjoern.Stenersen@si-software.de schrieb am 14.12.2004 09:45:41:
> > 
> >  >
> >  > Hi,
> >  > I am trying to print this little SVG:
> >  >
> >  > <?xml version="1.0" encoding="UTF-8"?>
> >  > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.
> >  > org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
> >  > <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
> >  >   <g>
> >  >     <rect x="0" y="0" width="200" height="200" fill="darkblue"/>
> >  >   </g>
> >  > </svg>
> >  >
> >  > When I am telling the printdialog to use 1cm margin each side the
> >  > svg gets scaled (aspect ratio is preserved) to fit to the page,
> >  > which is ok. What bothers me is that the square also gets centered
> >  > in the vertical axis. It is important for me that when i use 1 cm
> >  > margin the square starts 1cm from the left edge and 1 cm from the
> >  > right
> > 
> > *** UPDATE ***
> > 
> >  > and not 1 cm from the left and "somewhere" from the top. Does
> >  > anybody have a guess how to change the alignment from center to 
> > northwest?
> >  >
> >  > Thanks, Björn
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 

Re: Problem with alignment when printing, UPDATE to prior mail

Posted by Thomas DeWeese <Th...@Kodak.com>.
Bjoern.Stenersen@si-software.de wrote:

> Sorry, I mean it is important for me that the square starts 1cm from the 
> left edge and 1 cm from the top!

    Look at the allowed values for the "preserveAspectRatio" attribute.
In particular 'xMinYMin meet'.

> Bjoern.Stenersen@si-software.de schrieb am 14.12.2004 09:45:41:
> 
>  >
>  > Hi,
>  > I am trying to print this little SVG:
>  >
>  > <?xml version="1.0" encoding="UTF-8"?>
>  > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"  "http://www.w3.
>  > org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
>  > <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
>  >   <g>
>  >     <rect x="0" y="0" width="200" height="200" fill="darkblue"/>
>  >   </g>
>  > </svg>
>  >
>  > When I am telling the printdialog to use 1cm margin each side the
>  > svg gets scaled (aspect ratio is preserved) to fit to the page,
>  > which is ok. What bothers me is that the square also gets centered
>  > in the vertical axis. It is important for me that when i use 1 cm
>  > margin the square starts 1cm from the left edge and 1 cm from the
>  > right
> 
> *** UPDATE ***
> 
>  > and not 1 cm from the left and "somewhere" from the top. Does
>  > anybody have a guess how to change the alignment from center to 
> northwest?
>  >
>  > Thanks, Björn



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


Problem with alignment when printing, UPDATE to prior mail

Posted by Bj...@si-software.de.
Bjoern.Stenersen@si-software.de schrieb am 14.12.2004 09:45:41:

> 
> Hi, 
> I am trying to print this little SVG: 
> 
> <?xml version="1.0" encoding="UTF-8"?> 
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"  "http://www.w3.
> org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> 
> <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> 
>   <g> 
>     <rect x="0" y="0" width="200" height="200" fill="darkblue"/> 
>   </g> 
> </svg> 
> 
> When I am telling the printdialog to use 1cm margin each side the 
> svg gets scaled (aspect ratio is preserved) to fit to the page, 
> which is ok. What bothers me is that the square also gets centered 
> in the vertical axis. It is important for me that when i use 1 cm 
> margin the square starts 1cm from the left edge and 1 cm from the 
> right 

*** UPDATE ***
Sorry, I mean it is important for me that the square starts 1cm from the 
left edge and 1 cm from the top! 


> and not 1 cm from the left and "somewhere" from the top. Does 
> anybody have a guess how to change the alignment from center to 
northwest? 
> 
> Thanks, Björn