Hello,
I use the imposition layout tool all the time and find it very useful to create a single page PDF from multiple pages in a CorelDRAW file. I have ran into a little problem where I need the exact opposite of this tool. I have a CDR that contains 9 images per page, all perfectly symmetrical to each other. It's actually a card game layout, 9 cards per page, 3 rows and 3 columns. Each card measures 2.5in x 3.5in. All combined the page is 7.5in x 10.5in.
What I want to do is print to PDF or export as PDF, but just one card per page. The final product would be a multi-page PDF file where the page size is 2.5in x 3.5in and there would be one card per page. Is this possible somehow using CorelDRAW?
1 page with 9 individually grouped cards. Select the nine and run the macro.
If you have 100 pages with 9 cards each you'll end up with 900 pages. Might be best to copy the first nine to a new doc then run the macro.
Sub ShapesAsPages2()
ActiveDocument.BeginCommandGroup "ShapesAsPages2"
Dim s As Shape, sDuplicate As Shape, w#, h#
Dim sr As ShapeRange
Dim PageNext As Page
Set sr = ActiveSelectionRange
For Each s In sr.Shapes
s.GetSize w, h
Set PageNext = ActiveDocument.InsertPages(1, False, ActivePage.Index)
ActivePage.SizeHeight = s.SizeHeight
ActivePage.SizeWidth = s.SizeWidth
s.MoveToLayer PageNext.Layers(s.Layer.Name)
s.AddToSelection
ActiveSelection.AlignAndDistribute cdrAlignDistributeHAlignCenter, cdrAlignDistributeVAlignCenter, cdrAlignShapesToCenterOfPage
DoEvents
Next s
ActiveDocument.Pages.First.Delete
ActiveDocument.EndCommandGroup
End Sub
Eskimo said: If you would be willing to send me a file, then I am willing to try it. Contact me by private message if you wish. For what I have in mind, I don't think the VBA part of it would be very difficult to write. I don't know if CorelDRAW will have any trouble with a large number of pages, but I could only find that out by trying.
If you would be willing to send me a file, then I am willing to try it. Contact me by private message if you wish.
For what I have in mind, I don't think the VBA part of it would be very difficult to write. I don't know if CorelDRAW will have any trouble with a large number of pages, but I could only find that out by trying.
As an exercise, I wrote something to do this. it doesn't depend on each card already being a single group, but selects shapes contained in each rectangular area where a card is expected to be (as if one had "marquee selected" the shapes for each card).
Starting with this:
produces nine pages laid out like these:
(The dimensions weren't part of the original pages I was working with; I added them later just to show the sizes here.)
The way it is now, my code processes multiple original 9-card pages in one operation (e.g., 50 pages become 450 pages).
If you supply a file, I'll try processing it.
Well, I tried to send the file a bunch of times but the site keeps giving me errors. Can you paste your code and I can give it whirl? I did manage to get it everything to work in a bit of a convoluted manner, but it works. I am using a combination of CutePDF writer with a custom page size of 2.5" x 3.5" and the tiled pages setting in CorelDRAW. The only time consuming thing with that tiled page setting is that it defaults to tiled settings of 4 columns and 5 rows, where I want 3 x 3 instead. I have to go into each and every page and change that setting to 3 x 3 for it to work right. Is there a way to change the default?
If you want to send the file to me to try, then send me a private message through the forum, and I'll give you an e-mail address to which you could send it.
Here's the code the way it stands now - but I can't guarantee how happy CorelDRAW will be if it has to create a 1000+ page file.
And, of course, only try this on a COPY of your file, where you don't care if the macro ruins it! By design, it deletes each 9-card page after it has created the individual pages for the cards.
Sub cards_to_pages()
Dim s1 As Shape
Dim s2 As Shape
Dim sr As New ShapeRange
Dim dblX1 As Double
Dim dblY1 As Double
Dim dblX2 As Double
Dim dblY2 As Double
Dim lngRow As Long
Dim lngCol As Long
Const dblPad As Double = 0.01
Const dblCardWidth As Double = 2.5
Const dblCardHeight As Double = 3.5
Dim lngPageCountOrig As Long
Dim lngPageCounter As Long
Optimization = True
ActiveDocument.BeginCommandGroup "cards to pages"
EventsEnabled = False
On Error GoTo ErrHandler
lngPageCountOrig = ActiveDocument.Pages.Count
For lngPageCounter = 1 To lngPageCountOrig
ActiveDocument.Pages(1).Activate
sr.RemoveAll
For lngRow = 1 To 3
dblY1 = ActivePage.TopY - (lngRow - 1) * dblCardHeight + dblPad
dblY2 = dblY1 - dblCardHeight - 2 * dblPad
For lngCol = 1 To 3
dblX1 = ActivePage.LeftX + (lngCol - 1) * dblCardWidth - dblPad
dblX2 = dblX1 + dblCardWidth + 2 * dblPad
Set s1 = ActivePage.SelectShapesFromRectangle(dblX1, dblY1, dblX2, dblY2, False)
s1.Group
sr.Add s1
Next lngCol
Next lngRow
For Each s2 In sr
ActiveDocument.AddPagesEx 1, dblCardWidth, dblCardHeight
s2.MoveToLayer ActiveLayer
s2.CenterX = ActivePage.CenterX
s2.CenterY = ActivePage.CenterY
Next s2
ActiveDocument.Pages(1).Delete
Next lngPageCounter
ExitSub:
Optimization = False
EventsEnabled = True
Application.Refresh
Exit Sub
ErrHandler:
MsgBox "Error occurred: " & Err.Description
Resume ExitSub