Print Page | Close Window

DrawRotatedImage, Centering, FitImage

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: Sample Code
Forum Description: Share Debenu Quick PDF Library sample code with other forum members
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=339
Printed Date: 22 Nov 24 at 7:07PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: DrawRotatedImage, Centering, FitImage
Posted By: PaladinTodd
Subject: DrawRotatedImage, Centering, FitImage
Date Posted: 28 Feb 06 at 1:06PM

I was attempting to draw an image rotated and centered onto a PDF. The actual image would vary and was not under my control - the user can upload any size image. I went through a lot of brain damage trying to make FitImage work, but could not do it. I ended up using DrawRotatedImage and got it to work with a little bit of trouble. Here's the code in case anyone gets stuck with the same problem (Visual FoxPro code).

    PRIVATE lMaxHeight, lMaxWidth, lWidth, lHeight, lAdj
    lMaxHeight = 45
    lMaxWidth = 90
    lWidth = opdfedit.o.ImageWidth
    lHeight = opdfedit.o.ImageHeight
    lAdj = 0
    
    IF lHeight > lMaxHeight
     lAdj = lMaxHeight / lHeight
     lHeight = lHeight * lAdj
     lWidth = lWidth * lAdj
    ENDIF
     
    IF lWidth > lMaxWidth
     lAdj = lMaxWidth / lWidth
     lHeight = lHeight * lAdj
     lWidth = lWidth * lAdj
    endif


    lReturn = opdfedit.o.DrawRotatedImage(lpdfx + lHeight, lpdfy + (lWidth / 2), lWidth, lHeight, 90)

lPDFX = the left edge of the image. LPDFY = the mid-point where you want things to center around.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk