OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-12-2013, 19:20
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default Export Problem

I have a file with 106 pages size around 25 mb. I have a 374 dpi bitmap on one page. When I export the single page using the following code the save file is over 1 GB for X5 format and 95 mb for X6! I'm Using X6 without any service packs:

Code:
Private Sub cmdOK_Click()

    Dim Activate As Boolean

    Activate = False

    For i = 0 To ListToExp.ListCount - 1
    If ListToExp.Selected(i) = True Then
        Activate = True
        Exit For
    End If
    Next i
    
    If Activate = False Then MsgBox "Select at least one layer", vbExclamation, "Oops! - Nothing to Export": Exit Sub

    ActiveDocument.Unit = cdrMillimeter
    ActiveDocument.Resolution = 300
   

    Dim sp As Integer, ep As Integer, pags As Integer
    Dim sr As ShapeRange
    Dim opt As New StructSaveAsOptions
    Dim expfltCDR As ExportFilter
    Dim wid As Long, hgt As Long, strnos As Long
    Dim Range As Double
    Dim ts As Shape

    Range = pageT.Value - pageB.Value

    If pageT.Value > ActiveDocument.pages.Count Or Range < 0 Or pageB.Value < 1 Then
    MsgBox "Oops!", vbExclamation, "Check your page ranges!"
    Exit Sub
    End If
          
    Optimization = True

    pags = sp

    For pags = pageB To pageT

        ActiveDocument.ClearSelection
        ActiveDocument.pages(pags).Activate

        For i = 0 To ListToExp.ListCount - 1
        If ListToExp.Selected(i) = True Then
            nam = ListToExp.list(i)
            ActiveDocument.pages(pags).Layers(nam).Shapes.All.AddToSelection
            ActiveDocument.pages(pags).Layers(nam).Printable = True
            ActiveDocument.pages(pags).Layers(nam).Activate
        End If
        Next i

        If ActiveSelection.Shapes.Count > 0 Then
        
            Set sr = ActiveSelection.DuplicateAsRange
                       
            Set sr = ActiveSelectionRange
            
            sr.Group
            
            sr.AlignRangeToPage cdrAlignHCenter
            sr.AlignRangeToPage cdrAlignVCenter

            FilePth = cmdPath.Caption
            strName = ActiveDocument.pages(pags).name
            
            
            If TrimName Then
            
                strnos = InStrRev(strName, " ")
                If strnos > 0 Then strName = Mid(strName, strnos, Len(strName))
                
            End If
            
            If SaveAsX5.Value = True Then
            
                With opt
                    .EmbedVBAProject = False
                    .Filter = cdrCDR
                    .IncludeCMXData = True
                    .Range = cdrSelection
                    .EmbedICCProfile = False
                    .ThumbnailSize = cdr10KColorThumbnail
                    .Version = cdrVersion15
                    .Overwrite = True
                End With
                
            Else
            
                With opt
                    .EmbedVBAProject = False
                    .Filter = cdrCDR
                    .IncludeCMXData = True
                    .Range = cdrSelection
                    .EmbedICCProfile = False
                    .ThumbnailSize = cdr10KColorThumbnail
                    .Version = cdrCurrentVersion
                    .Overwrite = True
                End With
            
            End If
            
            FilePth = FilePth & "\" & strName & ".cdr"
            FilePth = Replace(FilePth, "\\", "\")
            ActiveDocument.SaveAs FilePth, opt
            
           sr.Delete

        End If

    Next pags

    Optimization = False
    
    cmdClose_Click

End Sub
Without the bitmap the file saves as 43 kb as an X6 file and 10 times that as an X5 file. Can anyone tell me why having the bitmap causes the file size to balloon? What can I do to keep the file size down? Thanks
Reply With Quote
  #2  
Old 12-12-2013, 05:22
Plixo Plixo is offline
Junior Member
 
Join Date: Oct 2011
Location: Singapore
Posts: 18
Default Maybe...

Maybe your save proc convert the bitmap to different resolution [300DPI in the code] and do not compress it ?

If you can post your file somewhere, I can give it a try ;-)

Last edited by Plixo; 12-12-2013 at 05:23. Reason: details
Reply With Quote
  #3  
Old 17-12-2013, 13:28
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default

Thanks for the reply, if you want to test it just make a document A5 size and place a 300 dpi bitmap on it that fills about 75% of the page.
Reply With Quote
  #4  
Old 13-01-2014, 00:22
Plixo Plixo is offline
Junior Member
 
Join Date: Oct 2011
Location: Singapore
Posts: 18
Default Fix to get same size as with manual save

Hi knowbodynow,

I gave it a try.

Discovered that the saved size using your code was in my case 2x the one saved using "save As" menu.

After multiple trials, I discovered the difference is in the inclusion of CMX data, thus you can just change this line:
Code:
.IncludeCMXData = False
In any case, the saved file will be much bigger than a jpeg, I would guess CorelDraw use a simple LZF algorithm to save compressed embedded bitmaps.

Hope this helps.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Export Problem with PNG/Transparency and C# with X5 cracknix Macros/Add-ons 4 12-09-2010 22:43
Export to EPS problem, need more functionality Klim CorelDRAW/Corel DESIGNER VBA 0 20-05-2009 10:08
Export to GIF problem norbert_ds CorelDRAW/Corel DESIGNER VBA 1 29-08-2008 15:18
HPGL export problem Anonymous General 1 16-02-2006 09:15
Problem with Export (or Save as) in AI-Format LOT CorelDRAW/Corel DESIGNER VBA 3 10-02-2004 14:28


All times are GMT -5. The time now is 20:45.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com