Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-31-2005, 12:55 PM
dih dih is offline
Junior Member
 
Join Date: Jan 2005
Posts: 5
Default SWFKit Pro: Physical page size in print event handlers

Hi,

I need to get the priysical size of page in onPrint event handler. There is no such methods or properties in Printer object.

I tried to use a Dll object and WinAPI:
//---
Dll.registerFunction ("gdi32.dll", "CreateDCA", "CreateDC", "stdcall", "long*", "string", "string", "string", "long");
Dll.registerFunction ("gdi32.dll", "GetDeviceCaps", "getDeviceCaps", "stdcall", "long", "long*", "long");
var Hdc = CreateDC("WINSPOOL", Printer.printers[1], null, null);
PhysicalWidth= getDeviceCaps(Hdc, 110);
//---

But getDeviceCaps returns "undefined".
Is this code right?
Is there any way to get the physical page size?

Help me please.
Reply With Quote
  #2 (permalink)  
Old 02-01-2005, 10:48 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:SWFKit Pro: Physical page size in print event handlers

Please use the paperSize property.
Reply With Quote
  #3 (permalink)  
Old 02-02-2005, 06:57 AM
dih dih is offline
Junior Member
 
Join Date: Jan 2005
Posts: 5
Default Re:SWFKit Pro: Physical page size in print event handlers

Thank you.
But it is useless for my case. paperSize, pageWidth and pageHeight are not enough. I need center image on PHYSICAL PAGE so I need to obtain these GetDeviceCaps values:
PHYSICALWIDTH - physical page width [dots]
PHYSICALHEIGHT - physical page height [dots]
PHYSICALOFFSETX - horizontal offset from physical page edge to logical page edge [dots]
PHYSICALOFFSETY - vertical offset from physical page edge to logical page edge [dots]

Is this possible?
Thanks.

Reply With Quote
  #4 (permalink)  
Old 02-02-2005, 10:31 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:SWFKit Pro: Physical page size in print event handlers

Please use the Printer.getImageSize method to get the logical size of an image

Code:
var w = this.pageWidth;
var h = this.pageHeight;

var is = this.getImageSize(image);
var left = (w - is.width) / 2;
var top = (h - is.height) / 2;

this.printImage(image, left, top, is.width, is.height);
Reply With Quote
  #5 (permalink)  
Old 02-02-2005, 11:35 AM
dih dih is offline
Junior Member
 
Join Date: Jan 2005
Posts: 5
Default Re:SWFKit Pro: Physical page size in print event handlers

Thank you.

Your code allows to center image inside the logical page. But the logical page often is not centered inside the physical page. That's why I need PhysicalWidth, PhysicalHeight, PhysicalXOffset, PhysicalYOffset.

It must be something like this:

var w = this.pageWidth;
var h = this.pageHeight;

var xCorrection = (PhysicalWidth - w)/2 - XOffset;
var yCorrection = (PhysicalHeight - h)/2 - YOffset;

var is = this.getImageSize(image);
var left = (w - is.width) / 2 + xCorrection ;
var top = (h - is.height) / 2 + yCorrection ;

this.printImage(image, left, top, is.width, is.height);



Thanks.
Reply With Quote
  #6 (permalink)  
Old 02-04-2005, 07:18 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:SWFKit Pro: Physical page size in print event handlers

SWFKit doesn't provide the feature, we will implement the feature in the next version.
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 07:41 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.