Util-Get Page Size when printed

From Vectorlab
Jump to: navigation, search


Function to get the size of a page in print. The real dimensions of the paper. This needs the routine U_CurrUnits2PrintedPage to be loaded first. By Orso B. Schmid


{ Orso ************************************************ }
{ gets page size in world coordinate: how it prints in the reality }
PROCEDURE U_GetPageSizeWorld(layName : STRING; VAR w, h : REAL);
	VAR
		userLayer: STRING;
		topL, botR : POINT;
	BEGIN
		BeginContext;
		userLayer := GetLName(ActLayer);
		
		IF GetLayerByName(layName) <> NIL THEN
			Layer(layName);
			
		GetDrawingSizeRect(topL.x, topL.y, botR.x, botR.y);
		w := U_CurrUnits2PrintedPage(abs(botR.x - topL.x), ActLayer);
		h := U_CurrUnits2PrintedPage(abs(botR.y - topL.y), ActLayer);
		
		Layer(userLayer);
		EndContext(0);
	END;