Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > Sample Code
  New Posts New Posts RSS Feed - DrawRotatedImage, Centering, FitImage
  FAQ FAQ  Forum Search   Register Register  Login Login

DrawRotatedImage, Centering, FitImage

 Post Reply Post Reply
Author
Message
PaladinTodd View Drop Down
Beginner
Beginner


Joined: 28 Feb 06
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote PaladinTodd Quote  Post ReplyReply Direct Link To This Post Topic: DrawRotatedImage, Centering, FitImage
    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.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store