On Aug 28, 2014, at 8:56 AM, Ben <ben_cocoa_dev_l...@yahoo.co.uk> wrote:

> 
> On 28 Aug 2014, at 15:01, Keary Suska <cocoa-...@esoteritech.com> wrote:
> 
>> On Aug 28, 2014, at 7:20 AM, Ben <ben_cocoa_dev_l...@yahoo.co.uk> wrote:
>> 
>>> I'm trying to make a tool for myself to fill in some repetitive forms. 
>>> They've got a custom paper size with a series of boxes to be filled in.
>>> 
>>> Given that I know the dimensions of the paper and the locations and 
>>> dimensions of the boxes to fill in, I should be able to draw a view that 
>>> prints onto these sheets. However, I'm getting lost in the printing system 
>>> trying to figure out what steps I need to take to get this working.
>>> 
>>> I don't understand how to go from the physical paper size (say 80mm wide, 
>>> 150mm tall) to the paper size Cocoa wants in points. Is there a method that 
>>> gives a scaling factor from points to any physical unit?
>>> 
>>> I'll also need to precisely position drawn strings in the view to print, so 
>>> will presumably need to translate points to physical dimensions when 
>>> drawing too.
>>> 
>>> Can anyone point me to something that might explain how to proceed here?
>> 
>> As the docs say, sizes are measured in the user coordinate space: 
>> https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Transforms/Transforms.html#//apple_ref/doc/uid/TP40003290-CH204-SW5
>> 
>> This guide is important to read as well.
>> 
> 
> I've read that before, but not thought to apply it to print devices.

Well, first you need to draw what you need to print, and then print it, so all 
of the Cocoa drawing API's apply.

> If I understand correctly, I should basically just work everything out at 
> 72dpi (the assumed user space scale) and let the system sort out the scaling 
> for the printer?

Yes. I find this works well for basic drawing. You do lose some precision--for 
instance, you can't really do any fractional pixel drawing--but text will come 
out perfectly.

> So for my case, assuming 72dpi ≈ 2.8 dots/mm:
> The paper being 80mm wide should be set to 224 points wide
> To inset a label by 10mm from an edge, I should inset by 28 points?
> 
> Am I understanding this right?

Yes.

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to