• Not Answered

Automatic Page Fit To Any Imge Size OR Vice Varsa

My current photo editing software (Microsoft PhotoDRaw) has the ability to do this and wondering if I can achieve the same in CorelDraw X5 or PhotoPaint Pro X3.  I just reinstalled both and need to start using them since PhotoDraw only work up till Windows XP and I use Virtual Machine to run it.

Here you go.  If say I open a new project to any page size of my choice and import any image (any size) into the page.   Is there a way I can automatically fit the page to the image size in either CorelDraw X5or PhotoPaint X3?  That is, if my default page size is letter (8.5"x11") and I import an image that is 2.2"x5", can I automatically fit the default page to the fit the image at 2.2"x5"?  Really very handy too.  Can I also do the reverse image to paper size?  If I can do either, where do I go?

Thanks.

9 Replies - Latest Reply

  • Hi.

    Try this macro. I tested in X6

     

    Sub itemsToPage()
        doPageAndItemSizing False
    End Sub
    Sub pageToItems()
        doPageAndItemSizing True
    End Sub
    Sub togglePageBorder()
        If ActiveDocument.Properties("PageBorder", 1) Then
            ActiveDocument.Properties("PageBorder", 1) = False
        Else
            ActiveDocument.Properties("PageBorder", 1) = True
        End If
            Application.FrameWork.Automation.Invoke "77f7f9eb-3e06-4899-9a8b-80d9e2aa68d3"
    End Sub
    Private Sub doPageAndItemSizing(bPgToItem As Boolean)
        Dim sr As ShapeRange
        Dim w#, h#
        Set sr = ActiveSelectionRange
        If sr.Count = 0 Then MsgBox "Make a selection. Exiting...", vbCritical, "GDG": Exit Sub
        If Not ActiveDocument.Properties("PageBorder", 1) Then
            ActiveDocument.Properties("PageBorder", 1) = True
            Application.FrameWork.Automation.Invoke "77f7f9eb-3e06-4899-9a8b-80d9e2aa68d3"
        End If
        If bPgToItem Then
            sr.GetSize w, h
            ActivePage.SetSize w, h
        Else
            ActivePage.GetSize w, h
            sr.SetSize w, h
        End If
        sr.SetPositionEx cdrBottomLeft, 0, 0
    End Sub

     

    ~John

  • In reply to Sub GDG_John( ):

    RunFlaCruiser

    Thanks for the Macro you sent me.  Honestly, I tried running it but could not.  I thought I could with the AutoCAD's LISP experience, but this is a different method.  I printed out all the help infor on CoredDraw X5 marcro, but still could not.  I added it in the manager but the final extension is different from what the marcro import needs.

    Please could you give me more directions on how to use the code you sent me.

    Thanks for your time.

  • In reply to caxtin:

    Hi.

    This very short video will give you some basics:

    http://community.coreldraw.com/forums/t/35227.aspx

    This page will tell you exactly how step by step:

    http://www.gdgmacros.com/getting_started_with_macros.php

    ~John

  • In reply to Sub GDG_John( ):

    John,

    I checked out your tutorial(s) and just like a charm, the code you sent worked well. I love it. I sure will use your tutorials to create other recordings.

    However, what I am really looking for is shown in the included video clip. The application I used is Microsoft PhotoDraw which is only compatible till Windows XP which I run on my VMWarre Virtual Machine. I would like to eliminate that from my system is I can use Corel instead.

    In the video, the paper fits to the image or image fits to paper (of any size) automatically. Just wondering if it is possible in CorelDraw X5 or PhotoPaint X3.

    Thanks for your time.

    Oka

     



    [edited by: caxtin at 16:42 (GMT -5) on Fri, Feb 1 2013]
  • In reply to caxtin:

    Hi.

    Sure.

    I kinda figured you would want to leave the image proportional so I was expecting this.

    Just change:

     

        If bPgToItem Then
            sr.GetSize w, h
            ActivePage.SetSize w, h
        Else
            ActivePage.GetSize w, h
            sr.SetSize w, h
        End If

     

    to:

     

        If bPgToItem Then
            sr.GetSize w, h
            ActivePage.SetSize w, h
        Else
            ActivePage.GetSize w, h
            sr.SetSize w
        End If

     

    I didn't test again but that should do it.

    ~John

  • In reply to Sub GDG_John( ):

    Hello John,

    I replaced the section as isntructed and got this error:

  • In reply to caxtin:

    Hi, Look carefully. You removed an End If after the Application.Framework line. -John
  • In reply to Sub GDG_John( ):

    All I can say is WOW!  It works perfectly well to what I am looking for.
    However, I would please like you to add a function there for me.

    When I open a new project with (naturally) a page size, and try any of the functions,
    the Page Border is turned off.  After turning it back on, it stays on all through the project,
    even after applying either of the Image-To-Page or Page-To-Image along the way.
    Could you please add a line there to automatically turn the Page Border on or leave it on
    which ever is the case here.  Please if you can do that for me, it sure WILL BE greatly appreciated.

    In AutoCAD, I can save and re-isntall my LISPs after any possible AutoCAD re-installation.
    On your web site, I did a search for "Backup" but could not find one.  Or I searching for the wrong
    discription.   How do I re-install (re-enable) any macros I might have for CorelDraw if I happen to
    re-install CorelDraw?    Playing around in CorelDraw, I found in Macro Manager I can Load and create
    New  GMS files.  Also in Visual Basic window, I can Import or Export other file extensions.
    I also found I can copy To and save my macro.  How about the image (Appearance) used for the marcros'
    button in the toolbar?  Is that automatically backuped also into the GMS file?
    What would you recommend on the best way to do this.

    I have to make some time later to browse throuh as many functions you have there.

    Thanks for all your help for me in this macros requsest.
    - Oka

     



    [edited by: caxtin at 1:30 (GMT -5) on Sun, Feb 3 2013]
  • In reply to Sub GDG_John( ):

    and if we need each items to be place on different pages as well?