Printing solution, any idea?

Thank you! David.

You’re right. I made a funny mistake 14.gif. The paper size is 262mm * 185mm.

From the wxWidget document, I found that wxPrintout class has both GetPPIPrinter() and GetPPIScreen() functions. I think they must be helpful for me to get the solution, but I got the retruned value (0,0) from the both functions although they are called after PageSetup and PrinterSetup.

I know the “math” you told me. But I think it is the conversion between “dot” and “mm” (or “inch”). What about “dot” and “pixel”? Or they are totally un-convert-able?

I’m under windows xp (15.gif).

2009-03-27

···

artman328


发件人: David Woods

发送时间: 2009-03-27 23:02:21

收件人: wxpython-users

抄送:

主题: RE: RE: [wxpython-users] Printing solution, any idea?

Can you tell me how to determine the pixel size of the window corresponded to the paper size?

Say I have a printer with 180 dpi resolution, is there a method to convert the size between the paper’s

mm size and window’s pixel size?

It’s called math. You say your paper has a width of 2620mm. Divide by 25.4 mm/inch = 103.15 inches. (Are you sure you don’t mean 262mm, for 10.3 inches, a much more reasonable size for piece of paper?) Or you could go the other way, 180 dots per inch divided by 25.4 mm per inch = 7.087 dots per mm.

David

-----Original Message-----
From:
wxpython-users-bounces+dwoods=wcer.wisc.edu@lists.wxwidgets.org [mailto:wxpython-users-bounces+dwoods=wcer.wisc.edu@lists.wxwidgets.org] On Behalf Of artman328
Sent: Friday, March 27, 2009 9:39 AM
To: wxpython-users
Subject: Re: RE: [wxpython-users] Printing solution, any idea?

2009-03-27


artman328


发件人: David Woods

发送时间:
2009-03-27 22:23:45

收件人:
wxpython-users

抄送:

主题: RE: [wxpython-users] Printing solution, any idea?

Thanks for your answer!

I made the texts into bitmaps just for draging them to get the right position.

I “draw” the texts on the window when I’ve got the right pos.

Can you tell me how to determine the pixel size of the window corresponded to the paper size?

Say I have a printer with 180 dpi resolution, is there a method to convert the size between the paper’s mm size and window’s pixel size?

Thanks

I want to print some contents on a paper on which some contents are pre-

printed. I need to place the to-be-printed contents on the paper

precisely. I’ve made the contents into bitmap so I can drag and drop them

to the right places.

The size of the paper I’m printing on is 2620mm in width and 1850mm in

height. How can I get the pixel size of my scroll window corresponded to

the size of the paper? For I want the font size to be the same to the pre-

printed contents, I “must not” scale the to-be-printed window. Is that

true?

Scaling after drawing on your device context would alter the apparent size

of your fonts, if I understand how things work.

However, you should be able to determine the printer resolution from

wxPrintout.GetPPIPrinter() so you can size your bitmap prior to drawing your

text on it. Then no resize will be necessary, and your fonts should be the

correct size.

David


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

A pixel is just a dot on the screen, so no
conversion is necessary. I think screens are typically 72 DPI, while
printers tend to be much higher and resolution and there is more variation from
one to the next.

I’m not sure why you’re getting (0, 0)
resolutions from wxPrintout. It’s been too long since I’ve touched the
print framework to remember, and I don’t have time right now to dig into it.

Good luck.

David

14.gif

15.gif

···

-----Original Message-----
From:
wxpython-users-bounces@lists.wxwidgets.org
[mailto:wxpython-users-bounces@lists.wxwidgets.org] On Behalf Of artman328
Sent: Friday, March
27, 2009 10:34 AM
To: wxpython-users
Subject: Re: RE: RE:
[wxpython-users] Printing solution, any idea?

Thank
you! David.

You’re
right. I made a funny mistake . The paper size is 262mm *
185mm.

From
the wxWidget document, I found that wxPrintout class has both GetPPIPrinter()
and GetPPIScreen() functions. I think they must be helpful for me to get
the solution, but I got the retruned value (0,0) from the both functions
although they are called after PageSetup and PrinterSetup.

I
know the “math” you told me. But I think it is the conversion
between “dot” and “mm” (or
“inch”). What about “dot” and
“pixel”? Or they are totally un-convert-able?

I’m
under windows xp ().

2009-03-27


artman328


发件人: David
Woods

发送时间:
2009-03-27 23:02:21

收件人:
wxpython-users

抄送:

主题: RE: RE:
[wxpython-users] Printing solution, any idea?

Can you
tell me how to determine the pixel size of the window corresponded to the
paper size?

Say I have
a printer with 180 dpi resolution, is there a method to convert the size
between the paper’s

mm size
and window’s pixel size?

It’s called math. You say your paper
has a width of 2620mm. Divide by 25.4 mm/inch = 103.15
inches. (Are you sure you don’t mean 262mm, for 10.3 inches, a much more
reasonable size for piece of paper?) Or you could go the other way, 180
dots per inch divided by 25.4 mm per inch = 7.087 dots per mm.

David

-----Original Message-----
From:
wxpython-users-bounces+dwoods=wcer.wisc.edu@lists.wxwidgets.org
[mailto:wxpython-users-bounces+dwoods=wcer.wisc.edu@lists.wxwidgets.org] On Behalf Of artman328
Sent: Friday, March
27, 2009 9:39 AM
To: wxpython-users
Subject: Re: RE: [wxpython-users]
Printing solution, any idea?

2009-03-27


artman328


发件人: David
Woods

发送时间:
2009-03-27 22:23:45

收件人:
wxpython-users

抄送:

主题: RE:
[wxpython-users] Printing solution, any idea?

Thanks for your
answer!

I made the
texts into bitmaps just for draging them to get the right position.

I
“draw” the texts on the window when I’ve got the right pos.

Can you tell me
how to determine the pixel size of the window corresponded to the paper
size?

Say I have a
printer with 180 dpi resolution, is there a method to convert the size between
the paper’s mm size and window’s pixel size?

Thanks

I want to print some contents on a paper on which some contents are pre-

printed. I need to place the to-be-printed contents on the paper

precisely. I’ve made the contents into bitmap so I can drag and drop them

to the right places.

The size of the paper I’m printing on is 2620mm in width and 1850mm in

height. How can I get the pixel size of my scroll window corresponded to

the size of the paper? For I want the font size to be the same to the pre-

printed contents, I “must not” scale the to-be-printed window. Is that

true?

Scaling after drawing on your device context would alter the apparent size

of your fonts, if I understand how things work.

However, you should be able to determine the printer resolution from

wxPrintout.GetPPIPrinter() so you can size your bitmap prior to drawing your

text on it. Then no resize will be necessary, and your fonts should be the

correct size.

David


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users