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 Lars Eirik Rønning <la...@gmail.com> on 2008/08/05 16:14:48 UTC
svg to pdf gives different visual output
Hi.
I have been using the batik rasterizer to generate pdf from my svg file.
I have tried this both using the standalone batik-rasterizer.jar and my own
code using the Pdftranscoder.
The strange thing is that my .svg fil contains a rectangle which is 311pt.
When i convert this to pdf the pdf version is 243pt.
I have not set any particual transcoding hints and was hoping that the
conversion would be done more or less seamlessly.
Hope you are able to answer me.
I will be happy to post the svg file and the pdf if you desire.
Lars
Re: svg to pdf gives different visual output
Posted by Lars Eirik Rønning <la...@gmail.com>.
Needed to zip the svg file..
On Wed, Aug 6, 2008 at 11:55 AM, Lars Eirik Rønning <la...@gmail.com>wrote:
> I have attached the .svg file
> Its generated from illustrator.
>
>
> On Tue, Aug 5, 2008 at 4:29 PM, Helder Magalhães <
> helder.magalhaes@gmail.com> wrote:
>
>> > I will be happy to post the svg file and the pdf if you desire.
>>
>> I believe that attaching the source (SVG) file is always a good idea
>> (if it's not massively big, of course). Specially if you are able to
>> reduce [1] it: for example, does a simplified version of the document,
>> containing a single rectangle, hold the same result?
>>
>> Regards,
>>
>> Helder Magalhães
>>
>> [1] http://webkit.org/quality/reduction.html
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>>
>
Re: svg to pdf gives different visual output
Posted by Helder Magalhães <he...@gmail.com>.
> I will be happy to post the svg file and the pdf if you desire.
I believe that attaching the source (SVG) file is always a good idea
(if it's not massively big, of course). Specially if you are able to
reduce [1] it: for example, does a simplified version of the document,
containing a single rectangle, hold the same result?
Regards,
Helder Magalhães
[1] http://webkit.org/quality/reduction.html
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: svg to pdf gives different visual output
Posted by th...@kodak.com.
Hi Lars,
"Lars Eirik Rønning" <la...@gmail.com> wrote on 08/12/2008 06:24:22
AM:
> i realised that the printer was set to scale to fit in printable area.
> Setting the scaling to none solved it.. (and this was not due to batik!)
Ok, good.
> Could you help me to understand the difference between key device
> resolution and key pixel unit to milimeter? Only the latter helps me
> in acchieving the final result i want.
KEY_PIXEL_UNIT_TO_MILLIMETER - Specifies the size of a px CSS
unit in millimeters. So this controls how your 811px is mapped to
real world units.
KEY_DEVICE_RESOLUTION - Specifies the resolution (in dpi) of the
'destination' device. This is used to calculate the resolution that
rasterized items need to be created at. This is needed for some
advanced features of SVG, like filters and some of the more complex
gradient settings.
> Hope to hear from you!
> Thanks again.
> Lars
> On Tue, Aug 12, 2008 at 12:17 PM, <th...@kodak.com> wrote:
>
> Hi Lars,
>
> "Lars Eirik Rønning" <la...@gmail.com> wrote on 08/11/2008 10:23:15
AM:
>
>
> > I have tried to do as Thomas adviced me to and changed the svg file
> > with units from px to pt.
> > I am not able to get a printout which gives me the correct
> outputsize however.
> >
> > When i try to print the svg file from Illustrator the rectangle is
> > 11cm , however i keep getting 10.5 cm when using either the batik-
> > rasterizer or my code with transcoding hints.
> > I have tried to set the PDFTranscoder hints and used both
> > KEY_RESOLUTION and PDFTranscoder.KEY_DEVICE_RESOLUTION, new
Float(0.3528f));
>
> When you say you keep getting 10.5cm rect, are you talking about
> the PDF file (which Batik can control) or the final sheet of paper
> where there is another piece of software that may change the rendering
> of the document (the PDF application and/or the print driver).
>
> > Please see the attached fiile. It is the biggest rectangle which
> > should be 11cm according to illustrator.
>
> > Sorry to bother you guys with this again..
> >
> > Could someone let me know if they are able to actually get a
> > printout where the biggest rectangle is 11cm( 4.33070866 inch)
> Both by adjusting the 'KEY_PIXEL_UNIT_TO_MILLIMETER' and
> changing 'px' to 'pt' I can get a PDF where the rectangle is
> 11cm wide. Getting the PDF printed without scaling is a
> problem that I'm not sure Batik can help with.
>
>
> > On Mon, Aug 11, 2008 at 3:59 PM, Lars Eirik Rønning
<larseirik@gmail.com
> > > wrote:
> > Hi again
> > I have tried to do as you advice me to and changed the svg file with
> > units from px to pt.
> > I am not able to get a printout which gives me the correct
> outputsize however.
> >
> > When i try to print the svg file from Illustrator the rectangle is
> > 11cm , however i keep getting 10.5 cm when using either the batik-
> > rasterizer or my code with transcoding hints.
> > Please see the attached fiile. It is the biggest rectangle which
> > should be 11cm according to illustrator.
> >
> > Sorry to bother you guys with this again..
> >
> > Could someone let me know if they are able to actually get 11cm on
> > the biggest square?
> >
> >
>
> > On Wed, Aug 6, 2008 at 2:26 PM, Lars Eirik Rønning
<larseirik@gmail.com
> > > wrote:
> > I have had a look at the transcoding hints and i was wondering which
> > one to use to get the output correct
> > This is the one i have looked at now:
PDFTranscoder.KEY_DEVICE_RESOLUTION
> > I also see that there is something referred to as :PDFTranscoder.
> > KEY_PIXEL_UNIT_TO_MILLIMETER,new Float(0.2645833f)
> > To mee it looks like the latter is the right one, but i am not
> entirely sure..
> > Any help is appreciated.
> >
>
> > On Wed, Aug 6, 2008 at 1:51 PM, Lars Eirik Rønning
<larseirik@gmail.com
> > > wrote:
> > Thank you so much Thomas.
> > That helped me a lot!
> >
> >
>
> > On Wed, Aug 6, 2008 at 12:32 PM, <th...@kodak.com> wrote:
> >
> > Hi Lars,
> >
> > "Lars Eirik Rønning" <la...@gmail.com> wrote on 08/05/2008
10:14:48 AM:
> >
> >
> > > I have been using the batik rasterizer to generate pdf from my svg
file.
> >
> > > The strange thing is that my .svg fil contains a rectangle which is
> > > 311pt.
>
> > Actually your SVG document contains a rectangle that is 311 user
> > space units, where in your document 311 user space units are mapped
> > to 311 _px_ units. Where by default Batik uses 96 px per inch (user
> > agents are supposed to pick and appropriate px to real world unit
> > conversion - 96 is a common px->inch conversion for SVG UserAgents),
> > by contrast a pt is defined as 1/72nd of an inch always.
> >
> > > When i convert this to pdf the pdf version is 243pt.
>
> > Right 311px/96pxPerIn ~= 3.25in * 72ptPerIn ~= 243pt
> >
> > > I have not set any particular transcoding hints and was hoping that
> > > the conversion would be done more or less seamlessly.
> >
> > To fix this you can either use 'pt' instead of 'px' units on
> > your outermost SVG (which seems to make the most sense to me):
> >
> > width="311.811pt" height="311.811pt"
> >
> > Or you can override Batik's default px to real world mapping
> > by using the '-dpi' command line option (and/or transcoding hint):
> >
> > -dpi 72
> >
> > [attachment "a4.zip" deleted by Thomas E. DeWeese/449433/EKC]
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail:
batik-users-help@xmlgraphics.apache.org
Re: svg to pdf gives different visual output
Posted by Lars Eirik Rønning <la...@gmail.com>.
Thanks Thomas.
10 minutes ago... i realised that the printer was set to scale to fit in
printable area...when printing from pdf..(that is printer software)
Setting the scaling to none solved it.. (and this was not due to batik!)
It all works beautifully and i was about to send a message back to the
mailing list..
Once again. I am very impressed by you taking the time Thomas!
Could you help me to understand the difference between key device resolution
and key pixel unit to milimeter? Only the latter helps me in acchieving the
final result i want.
Hope to hear from you!
Thanks again.
Lars
On Tue, Aug 12, 2008 at 12:17 PM, <th...@kodak.com> wrote:
>
> Hi Lars,
>
> "Lars Eirik Rønning" <la...@gmail.com> wrote on 08/11/2008 10:23:15
> AM:
>
> > I have tried to do as Thomas adviced me to and changed the svg file
> > with units from px to pt.
> > I am not able to get a printout which gives me the correct outputsize
> however.
> >
> > When i try to print the svg file from Illustrator the rectangle is
> > 11cm , however i keep getting 10.5 cm when using either the batik-
> > rasterizer or my code with transcoding hints.
> > I have tried to set the PDFTranscoder hints and used both
> > KEY_RESOLUTION and PDFTranscoder.KEY_DEVICE_RESOLUTION, new
> Float(0.3528f));
>
> When you say you keep getting 10.5cm rect, are you talking about
> the PDF file (which Batik can control) or the final sheet of paper
> where there is another piece of software that may change the rendering
> of the document (the PDF application and/or the print driver).
>
> > Please see the attached fiile. It is the biggest rectangle which
> > should be 11cm according to illustrator.
>
> > Sorry to bother you guys with this again..
> >
> > Could someone let me know if they are able to actually get a
> > printout where the biggest rectangle is 11cm( 4.33070866 inch)
>
> Both by adjusting the 'KEY_PIXEL_UNIT_TO_MILLIMETER' and
> changing 'px' to 'pt' I can get a PDF where the rectangle is
> 11cm wide. Getting the PDF printed without scaling is a
> problem that I'm not sure Batik can help with.
>
>
> > On Mon, Aug 11, 2008 at 3:59 PM, Lars Eirik Rønning <larseirik@gmail.com
> > > wrote:
> > Hi again
> > I have tried to do as you advice me to and changed the svg file with
> > units from px to pt.
> > I am not able to get a printout which gives me the correct outputsize
> however.
> >
> > When i try to print the svg file from Illustrator the rectangle is
> > 11cm , however i keep getting 10.5 cm when using either the batik-
> > rasterizer or my code with transcoding hints.
> > Please see the attached fiile. It is the biggest rectangle which
> > should be 11cm according to illustrator.
> >
> > Sorry to bother you guys with this again..
> >
> > Could someone let me know if they are able to actually get 11cm on
> > the biggest square?
> >
> >
>
> > On Wed, Aug 6, 2008 at 2:26 PM, Lars Eirik Rønning <larseirik@gmail.com
> > > wrote:
> > I have had a look at the transcoding hints and i was wondering which
> > one to use to get the output correct
> > This is the one i have looked at now: PDFTranscoder.KEY_DEVICE_RESOLUTION
> > I also see that there is something referred to as :PDFTranscoder.
> > KEY_PIXEL_UNIT_TO_MILLIMETER,new Float(0.2645833f)
> > To mee it looks like the latter is the right one, but i am not entirely
> sure..
> > Any help is appreciated.
> >
>
> > On Wed, Aug 6, 2008 at 1:51 PM, Lars Eirik Rønning <larseirik@gmail.com
> > > wrote:
> > Thank you so much Thomas.
> > That helped me a lot!
> >
> >
>
> > On Wed, Aug 6, 2008 at 12:32 PM, <th...@kodak.com> wrote:
> >
> > Hi Lars,
> >
> > "Lars Eirik Rønning" <la...@gmail.com> wrote on 08/05/2008 10:14:48
> AM:
> >
> >
> > > I have been using the batik rasterizer to generate pdf from my svg
> file.
> >
> > > The strange thing is that my .svg fil contains a rectangle which is
> > > 311pt.
>
> > Actually your SVG document contains a rectangle that is 311 user
> > space units, where in your document 311 user space units are mapped
> > to 311 _px_ units. Where by default Batik uses 96 px per inch (user
> > agents are supposed to pick and appropriate px to real world unit
> > conversion - 96 is a common px->inch conversion for SVG UserAgents),
> > by contrast a pt is defined as 1/72nd of an inch always.
> >
> > > When i convert this to pdf the pdf version is 243pt.
>
> > Right 311px/96pxPerIn ~= 3.25in * 72ptPerIn ~= 243pt
> >
> > > I have not set any particular transcoding hints and was hoping that
> > > the conversion would be done more or less seamlessly.
> >
> > To fix this you can either use 'pt' instead of 'px' units on
> > your outermost SVG (which seems to make the most sense to me):
> >
> > width="311.811pt" height="311.811pt"
> >
> > Or you can override Batik's default px to real world mapping
> > by using the '-dpi' command line option (and/or transcoding hint):
> >
> > -dpi 72
> >
> > [attachment "a4.zip" deleted by Thomas E. DeWeese/449433/EKC]
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
Re: svg to pdf gives different visual output
Posted by th...@kodak.com.
Hi Lars,
"Lars Eirik Rønning" <la...@gmail.com> wrote on 08/11/2008 10:23:15
AM:
> I have tried to do as Thomas adviced me to and changed the svg file
> with units from px to pt.
> I am not able to get a printout which gives me the correct outputsize
however.
>
> When i try to print the svg file from Illustrator the rectangle is
> 11cm , however i keep getting 10.5 cm when using either the batik-
> rasterizer or my code with transcoding hints.
> I have tried to set the PDFTranscoder hints and used both
> KEY_RESOLUTION and PDFTranscoder.KEY_DEVICE_RESOLUTION, new
Float(0.3528f));
When you say you keep getting 10.5cm rect, are you talking about
the PDF file (which Batik can control) or the final sheet of paper
where there is another piece of software that may change the rendering
of the document (the PDF application and/or the print driver).
> Please see the attached fiile. It is the biggest rectangle which
> should be 11cm according to illustrator.
> Sorry to bother you guys with this again..
>
> Could someone let me know if they are able to actually get a
> printout where the biggest rectangle is 11cm( 4.33070866 inch)
Both by adjusting the 'KEY_PIXEL_UNIT_TO_MILLIMETER' and
changing 'px' to 'pt' I can get a PDF where the rectangle is
11cm wide. Getting the PDF printed without scaling is a
problem that I'm not sure Batik can help with.
> On Mon, Aug 11, 2008 at 3:59 PM, Lars Eirik Rønning <larseirik@gmail.com
> > wrote:
> Hi again
> I have tried to do as you advice me to and changed the svg file with
> units from px to pt.
> I am not able to get a printout which gives me the correct outputsize
however.
>
> When i try to print the svg file from Illustrator the rectangle is
> 11cm , however i keep getting 10.5 cm when using either the batik-
> rasterizer or my code with transcoding hints.
> Please see the attached fiile. It is the biggest rectangle which
> should be 11cm according to illustrator.
>
> Sorry to bother you guys with this again..
>
> Could someone let me know if they are able to actually get 11cm on
> the biggest square?
>
>
> On Wed, Aug 6, 2008 at 2:26 PM, Lars Eirik Rønning <larseirik@gmail.com
> > wrote:
> I have had a look at the transcoding hints and i was wondering which
> one to use to get the output correct
> This is the one i have looked at now:
PDFTranscoder.KEY_DEVICE_RESOLUTION
> I also see that there is something referred to as :PDFTranscoder.
> KEY_PIXEL_UNIT_TO_MILLIMETER,new Float(0.2645833f)
> To mee it looks like the latter is the right one, but i am not entirely
sure..
> Any help is appreciated.
>
> On Wed, Aug 6, 2008 at 1:51 PM, Lars Eirik Rønning <larseirik@gmail.com
> > wrote:
> Thank you so much Thomas.
> That helped me a lot!
>
>
> On Wed, Aug 6, 2008 at 12:32 PM, <th...@kodak.com> wrote:
>
> Hi Lars,
>
> "Lars Eirik Rønning" <la...@gmail.com> wrote on 08/05/2008 10:14:48
AM:
>
>
> > I have been using the batik rasterizer to generate pdf from my svg
file.
>
> > The strange thing is that my .svg fil contains a rectangle which is
> > 311pt.
> Actually your SVG document contains a rectangle that is 311 user
> space units, where in your document 311 user space units are mapped
> to 311 _px_ units. Where by default Batik uses 96 px per inch (user
> agents are supposed to pick and appropriate px to real world unit
> conversion - 96 is a common px->inch conversion for SVG UserAgents),
> by contrast a pt is defined as 1/72nd of an inch always.
>
> > When i convert this to pdf the pdf version is 243pt.
> Right 311px/96pxPerIn ~= 3.25in * 72ptPerIn ~= 243pt
>
> > I have not set any particular transcoding hints and was hoping that
> > the conversion would be done more or less seamlessly.
>
> To fix this you can either use 'pt' instead of 'px' units on
> your outermost SVG (which seems to make the most sense to me):
>
> width="311.811pt" height="311.811pt"
>
> Or you can override Batik's default px to real world mapping
> by using the '-dpi' command line option (and/or transcoding hint):
>
> -dpi 72
>
> [attachment "a4.zip" deleted by Thomas E. DeWeese/449433/EKC]
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: svg to pdf gives different visual output
Posted by Lars Eirik Rønning <la...@gmail.com>.
Hi again
I have tried to do as Thomas adviced me to and changed the svg file with
units from px to pt.
I am not able to get a printout which gives me the correct outputsize
however.
When i try to print the svg file from Illustrator the rectangle is 11cm ,
however i keep getting 10.5 cm when using either the batik-rasterizer or my
code with transcoding hints.
I have tried to set the PDFTranscoder hints and used both KEY_RESOLUTION and
PDFTranscoder.KEY_DEVICE_RESOLUTION, new Float(0.3528f));
Please see the attached fiile. It is the biggest rectangle which should be
11cm according to illustrator.
Sorry to bother you guys with this again..
Could someone let me know if they are able to actually get a printout where
the biggest rectangle is 11cm( 4.33070866 inch)
On Mon, Aug 11, 2008 at 3:59 PM, Lars Eirik Rønning <la...@gmail.com>wrote:
> Hi again
> I have tried to do as you advice me to and changed the svg file with units
> from px to pt.
> I am not able to get a printout which gives me the correct outputsize
> however.
>
> When i try to print the svg file from Illustrator the rectangle is 11cm ,
> however i keep getting 10.5 cm when using either the batik-rasterizer or my
> code with transcoding hints.
> Please see the attached fiile. It is the biggest rectangle which should be
> 11cm according to illustrator.
>
> Sorry to bother you guys with this again..
>
> Could someone let me know if they are able to actually get 11cm on the
> biggest square?
>
>
>
> On Wed, Aug 6, 2008 at 2:26 PM, Lars Eirik Rønning <la...@gmail.com>wrote:
>
>> I have had a look at the transcoding hints and i was wondering which one
>> to use to get the output correct
>> This is the one i have looked at now: PDFTranscoder.KEY_DEVICE_RESOLUTION
>> I also see that there is something referred to as
>> :PDFTranscoder.KEY_PIXEL_UNIT_TO_MILLIMETER,new Float(0.2645833f)
>> To mee it looks like the latter is the right one, but i am not entirely
>> sure..
>> Any help is appreciated.
>>
>>
>> On Wed, Aug 6, 2008 at 1:51 PM, Lars Eirik Rønning <la...@gmail.com>wrote:
>>
>>> Thank you so much Thomas.
>>> That helped me a lot!
>>>
>>>
>>>
>>> On Wed, Aug 6, 2008 at 12:32 PM, <th...@kodak.com> wrote:
>>>
>>>>
>>>> Hi Lars,
>>>>
>>>> "Lars Eirik Rønning" <la...@gmail.com> wrote on 08/05/2008 10:14:48
>>>> AM:
>>>>
>>>> > I have been using the batik rasterizer to generate pdf from my svg
>>>> file.
>>>>
>>>> > The strange thing is that my .svg fil contains a rectangle which is
>>>> > 311pt.
>>>>
>>>> Actually your SVG document contains a rectangle that is 311 user
>>>> space units, where in your document 311 user space units are mapped
>>>> to 311 _px_ units. Where by default Batik uses 96 px per inch (user
>>>> agents are supposed to pick and appropriate px to real world unit
>>>> conversion - 96 is a common px->inch conversion for SVG UserAgents),
>>>> by contrast a pt is defined as 1/72nd of an inch always.
>>>>
>>>> > When i convert this to pdf the pdf version is 243pt.
>>>>
>>>> Right 311px/96pxPerIn ~= 3.25in * 72ptPerIn ~= 243pt
>>>>
>>>> > I have not set any particular transcoding hints and was hoping that
>>>> > the conversion would be done more or less seamlessly.
>>>>
>>>> To fix this you can either use 'pt' instead of 'px' units on
>>>> your outermost SVG (which seems to make the most sense to me):
>>>>
>>>> width="311.811pt" height="311.811pt"
>>>>
>>>> Or you can override Batik's default px to real world mapping
>>>> by using the '-dpi' command line option (and/or transcoding hint):
>>>>
>>>> -dpi 72
>>>>
>>>
>>>
>>
>
Re: svg to pdf gives different visual output
Posted by Lars Eirik Rønning <la...@gmail.com>.
I have had a look at the transcoding hints and i was wondering which one to
use to get the output correct
This is the one i have looked at now: PDFTranscoder.KEY_DEVICE_RESOLUTION
I also see that there is something referred to as
:PDFTranscoder.KEY_PIXEL_UNIT_TO_MILLIMETER,new Float(0.2645833f)
To mee it looks like the latter is the right one, but i am not entirely
sure..
Any help is appreciated.
On Wed, Aug 6, 2008 at 1:51 PM, Lars Eirik Rønning <la...@gmail.com>wrote:
> Thank you so much Thomas.
> That helped me a lot!
>
>
>
> On Wed, Aug 6, 2008 at 12:32 PM, <th...@kodak.com> wrote:
>
>>
>> Hi Lars,
>>
>> "Lars Eirik Rønning" <la...@gmail.com> wrote on 08/05/2008 10:14:48
>> AM:
>>
>> > I have been using the batik rasterizer to generate pdf from my svg file.
>>
>> > The strange thing is that my .svg fil contains a rectangle which is
>> > 311pt.
>>
>> Actually your SVG document contains a rectangle that is 311 user
>> space units, where in your document 311 user space units are mapped
>> to 311 _px_ units. Where by default Batik uses 96 px per inch (user
>> agents are supposed to pick and appropriate px to real world unit
>> conversion - 96 is a common px->inch conversion for SVG UserAgents),
>> by contrast a pt is defined as 1/72nd of an inch always.
>>
>> > When i convert this to pdf the pdf version is 243pt.
>>
>> Right 311px/96pxPerIn ~= 3.25in * 72ptPerIn ~= 243pt
>>
>> > I have not set any particular transcoding hints and was hoping that
>> > the conversion would be done more or less seamlessly.
>>
>> To fix this you can either use 'pt' instead of 'px' units on
>> your outermost SVG (which seems to make the most sense to me):
>>
>> width="311.811pt" height="311.811pt"
>>
>> Or you can override Batik's default px to real world mapping
>> by using the '-dpi' command line option (and/or transcoding hint):
>>
>> -dpi 72
>>
>
>
Re: svg to pdf gives different visual output
Posted by Lars Eirik Rønning <la...@gmail.com>.
Thank you so much Thomas.
That helped me a lot!
On Wed, Aug 6, 2008 at 12:32 PM, <th...@kodak.com> wrote:
>
> Hi Lars,
>
> "Lars Eirik Rønning" <la...@gmail.com> wrote on 08/05/2008 10:14:48
> AM:
>
> > I have been using the batik rasterizer to generate pdf from my svg file.
>
> > The strange thing is that my .svg fil contains a rectangle which is
> > 311pt.
>
> Actually your SVG document contains a rectangle that is 311 user
> space units, where in your document 311 user space units are mapped
> to 311 _px_ units. Where by default Batik uses 96 px per inch (user
> agents are supposed to pick and appropriate px to real world unit
> conversion - 96 is a common px->inch conversion for SVG UserAgents),
> by contrast a pt is defined as 1/72nd of an inch always.
>
> > When i convert this to pdf the pdf version is 243pt.
>
> Right 311px/96pxPerIn ~= 3.25in * 72ptPerIn ~= 243pt
>
> > I have not set any particular transcoding hints and was hoping that
> > the conversion would be done more or less seamlessly.
>
> To fix this you can either use 'pt' instead of 'px' units on
> your outermost SVG (which seems to make the most sense to me):
>
> width="311.811pt" height="311.811pt"
>
> Or you can override Batik's default px to real world mapping
> by using the '-dpi' command line option (and/or transcoding hint):
>
> -dpi 72
>
Re: svg to pdf gives different visual output
Posted by th...@kodak.com.
Hi Lars,
"Lars Eirik Rønning" <la...@gmail.com> wrote on 08/05/2008 10:14:48
AM:
> I have been using the batik rasterizer to generate pdf from my svg file.
> The strange thing is that my .svg fil contains a rectangle which is
> 311pt.
Actually your SVG document contains a rectangle that is 311 user
space units, where in your document 311 user space units are mapped
to 311 _px_ units. Where by default Batik uses 96 px per inch (user
agents are supposed to pick and appropriate px to real world unit
conversion - 96 is a common px->inch conversion for SVG UserAgents),
by contrast a pt is defined as 1/72nd of an inch always.
> When i convert this to pdf the pdf version is 243pt.
Right 311px/96pxPerIn ~= 3.25in * 72ptPerIn ~= 243pt
> I have not set any particular transcoding hints and was hoping that
> the conversion would be done more or less seamlessly.
To fix this you can either use 'pt' instead of 'px' units on
your outermost SVG (which seems to make the most sense to me):
width="311.811pt" height="311.811pt"
Or you can override Batik's default px to real world mapping
by using the '-dpi' command line option (and/or transcoding hint):
-dpi 72