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 27-04-2006, 10:24
sifterbox
Guest
 
Posts: n/a
Default Pdf Export Files Just Rewrite Over And Over

Basically I want to export an open file as a pdf file. I record myself simply going to export and exporting the file then hitting stop record. It works just fine except when I go to export the next file it names the file the same as the first file. so pic2 is getting renamed pic1 and the pic1 is overwritten.

is there a way to export a pdf file and name it as the current file not the original file you exported while recording the macro.

I opened the edittor and it says documents/pic1.pdf" etc or something like that. is there a way to change the pic1.pdf to "current file name" or something liek that

Or it would be even easier if I could have a folder ad do a batch conversion from cdr to pdf. If anyone knows how to do this please respond. I dont see an option to do pdf in the file conversion vba.
Reply With Quote
  #2  
Old 27-04-2006, 15:28
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

you can replace literal file name string with ActiveDocument.Name+".pdf" or ActiveDocument.FileName+".pdf"

another option is to use Alex's FileConverter macro, which I customized to include PDF file type too. The macro is attached here, but due to size limit of 97kbytes it was archived inside using winrar (www.rarlabs.com), be sure to unpack rar file too to obtain gms
Attached Files
File Type: zip FileConverter.zip (92.0 KB, 579 views)
Reply With Quote
  #3  
Old 27-04-2006, 16:18
sifterbox
Guest
 
Posts: n/a
Default

I am sorry I didnt mean to say pdf file I meant PSD photoshop document.
Reply With Quote
  #4  
Old 27-04-2006, 16:31
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

FileConverter doesn't have current support for PSD
If multiple layers in PSD aren't crucial (and by the way they won't be created automatically I suppose) then why not use FileConverter macro with TIF?
TIF is beautiful universal format, I never use psd in my life since Photoshop7+ allows to save layers in tif with zip-compression gaining up to 50% in filesize
Reply With Quote
  #5  
Old 27-04-2006, 16:36
sifterbox
Guest
 
Posts: n/a
Default

I basically used to use tif's I make license plates from laser engravers and mirror and one day I found I could export using layers. basically it only works for my method with psd files. I coul dshow you a picture sof both if you need.

I cant get the files to come out as the current name still
Reply With Quote
  #6  
Old 04-05-2006, 10:32
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

Quote:
Originally Posted by sifterbox
I cant get the files to come out as the current name still
It should be really easy. Please post your macro here and I (or someone else) will tell exact changes need to be made.
Reply With Quote
  #7  
Old 05-05-2006, 16:39
sifterbox
Guest
 
Posts: n/a
Default

Sub Macro7()
'
' Recorded 5/5/2006
'
' Description:
'
'
Dim expflt As ExportFilter
Set expflt = ActiveDocument.ExportBitmap("H:\test 1\dive-29.psd", cdrPSD, cdrAllPages, cdrRGBColorImage, 854, 431, 72, 72, cdrNormalAntiAliasing, False, True, False, True, cdrCompressionNone)
expflt.Finish
End Sub
Reply With Quote
  #8  
Old 05-05-2006, 16:43
sifterbox
Guest
 
Posts: n/a
Default

I would ideally like to do a batch conversion on a whole folder of files all that would just need to be opened and converted to psd files (photoshop) using the same names of the files and not naming each one dive-29.psd

But using this macro I will just open each file one at a time and the macro will export the files one at a time.

thank you, also I just thought of it but if you cant do this in a macro function I will need to add close the file after that so I can hit the button to export the next file without having to close each file as well but I can add that myself later after I figure out how keep each file with its original name.

thanks
Reply With Quote
  #9  
Old 06-05-2006, 06:09
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

10 min work for such a overcoder as myself ;-)
it will ask you for a folder containing CDRs, then will export them in the same folder as PSD with names corresponding original files
you may wish to turn off PANOSE font matching dialog box, look in code
In the end it will present you a message with processed files and if there were any errors - they'll be visually separated by --------

Code:
Sub psdExport()
   Dim file$, expflt As ExportFilter, doc As Document, errs$, report$
   Static folder$: If folder = "" Then folder = "H:\test 1"
   folder = Application.CorelScriptTools.GetFolder(folder, "Initial folder: " + folder, AppWindow.Handle)
   If folder = "" Then Exit Sub
   
   If right(folder, 1) <> "\" Then folder = folder + "\"
   
   On Error GoTo ErrHandler
   Application.PanoseMatching = cdrPanosePrompt ' may change to cdrPanoseTemporary
   file = Dir(folder + "*.cdr")
   Do While file <> ""
      Set doc = Application.OpenDocument(folder + file)
      If Not doc Is Nothing Then
         Set expflt = doc.ExportBitmap(folder + doc.Name + ".psd", cdrPSD, cdrAllPages, _
            cdrRGBColorImage, , , 72, 72, cdrNormalAntiAliasing, False, True, False, True, cdrCompressionNone)
         expflt.Finish
         doc.Dirty = False: doc.Close: report = report + file + ",   "
      End If
NextFile:
      file = Dir
   Loop
   MsgBox report + vbNewLine + "--------------" + vbNewLine + errs, , _
      "Processed folder: " + folder
   Exit Sub
ErrHandler:
   errs = errs + "Error on " + file + ": " + ERR.Description + vbNewLine
   ERR.Clear
   Resume NextFile
End Sub
Reply With Quote
  #10  
Old 12-12-2011, 21:59
celticbluefox
Guest
 
Posts: n/a
Default

can you help me with this code to change it up a bit? I would like the cdr page names to also export with each page layer. is this possble? secod item when exporting i need certain layers to export out one way and other layer an other way but i would like it to work in this really cool export you have setup. here is an example
Sub Macro1()
'
' Recorded 12/12/2011
'
' Description:
'
'
ActivePage.Layers("outline").Visible = False
ActiveLayer.Visible = False
ActivePage.Layers("emblem").Visible = False
ActivePage.Layers("text location").Visible = False
ActiveLayer.Visible = True
ActiveDocument.EditAcrossLayers = True
ActiveDocument.EditAcrossLayers = False
Dim expflt As ExportFilter
ActiveLayer.Shapes.All.CreateSelection
Set expflt = ActiveDocument.ExportBitmap("C:\Documents and Settings\Karie\My Documents\cdr example.psd", cdrPSD, cdrSelection, cdrRGBColorImage, 580, 579, 150, 150, cdrNormalAntiAliasing, False, True, True, False, cdrCompressionNone)
expflt.Finish
ActiveWindow.ActiveView.ToFitAllObjects
ActiveWindow.ActiveView.ToFitAllObjects
ActivePage.Layers("outline").Visible = True
ActiveWindow.ActiveView.ToFitAllObjects
Dim lr1 As Layer
Set lr1 = ActiveDocument.Pages(1).CreateLayer("Layer 1")
lr1.Name = "contour outline"
lr1.MoveAbove ActivePage.Layers("outline")
ActivePage.Layers("outline").Visible = False
ActivePage.Layers("outline").Visible = True
ActivePage.Layers("outline").Shapes.All.Copy
lr1.Paste
Dim Paste1 As ShapeRange
Set Paste1 = ActiveSelectionRange
ActivePage.Layers("outline").Shapes.All.SetOutlineProperties Color:=CreateCMYKColor(0, 0, 0, 0)
ActiveDocument.EditAcrossLayers = True
lr1.Visible = False
ActiveDocument.CreateSelection ActivePage.Layers("outline").Shapes.All, ActivePage.Layers("design").Shapes.All
ActiveDocument.AddToSelection ActivePage.Layers("text").Shapes.All
Set expflt = ActiveDocument.ExportBitmap("C:\Documents and Settings\Karie\My Documents\cdr example_txdgnol.psd", cdrPSD, cdrSelection, cdrRGBColorImage, 580, 750, 150, 150, cdrNormalAntiAliasing, False, True, True, False, cdrCompressionNone)
expflt.Finish
ActivePage.Layers("text location").Visible = False
ActivePage.Layers("emblem").Visible = False
ActivePage.Layers("text location").Visible = True
ActivePage.Layers("emblem").Visible = True
lr1.Visible = False
lr1.Visible = True
lr1.Visible = False
lr1.Visible = True
ActivePage.Layers("outline").Visible = False
ActivePage.Layers("design").Visible = False
ActivePage.Layers("text").Visible = False
ActiveWindow.ActiveView.ToFitAllObjects
ActiveDocument.CreateSelection Paste1, ActivePage.Layers("emblem").Shapes.All, ActivePage.Layers("text location").Shapes.All
Set expflt = ActiveDocument.ExportBitmap("C:\Documents and Settings\Karie\My Documents\cdr example_txlocemol.psd", cdrPSD, cdrSelection, cdrRGBColorImage, 580, 750, 150, 150, cdrNoAntiAliasing, False, True, True, False, cdrCompressionNone)
expflt.Finish
End Sub



i would really appriecate your help wOxxOm
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


All times are GMT -5. The time now is 23:51.


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