几何尺寸与公差论坛

 找回密码
 注册
查看: 723|回复: 0

【转帖】pdf export page selec

[复制链接]
发表于 2009-4-13 13:19:57 | 显示全部楼层 |阅读模式
pdf export page select
hi,
do you know how to call the pop-pu box when you save your pdf (without macro) that allow you to select the pages that need to be save.
thanks,
steph
using acrobat pro, and using the pdf print driver, not the save as pdf.
the pdf sheet selection box should be there after you click the save button if you chose to save as pdf anyway, if its not and your in sw2008 click the options button before clicking save and check if there are any options for this (i cannot check at the mo just upgrading my sw08)
luke do you know if there is a bay to call the pdf sheet selection box with a macro ?
steph
stehane-
i don't think there's a way to do this--you'll have to create your own selection box. are you trying to give the operator the option to pick a specific sheet or sheets, or do you know in advance which sheets to output (ie the visible one)?
-jason s.
thanks for the answer jason,
i have done a list box (if more then 1 sheet is present) where i list the sheets available and the user can select the sheets he needs to export and it works fine.
steph
hi stephane,
i have been looking for a macro that exports a specific sheet from a multi sheet drawing but have been unsuccessful in finding one. all the ones i have found export all in one shot.
would you be able to share this macro by any chance.
thanks.
hi stephane,
i've also been looking for a macro that exports a single sheet in pdf format.
i also don't understand why the views within the sheet are placed in the pdf file when normally created.
i would be greatly appreciative of any help or if you could possibly share your macro.
thanks,
jim anglin
lube-power, inc.
janglin@lubepower.com
jim anglin
design engineer, emsug
lube-power, inc.
sw 2009 sp2.1
dell 390 2.6 ghz core 2 duo
4gb ram, xp32 pro sp3
ati firegl v7200
'you will need to create a form with :
'1 listbox : listbox1
'1 button : select
option explicit
dim swapp as sldworks.sldworks
dim swdoc as sldworks.modeldoc2
dim swmodeldocext as sldworks.modeldocextension
dim swexportpdfdata as sldworks.exportpdfdata
dim swdrawing as sldworks.drawingdoc
dim boolstatus as boolean
dim filename as string
dim lerrors as long
dim lwarnings as long
dim varsheetname as variant
dim path as string
dim fso as new filesystemobject
dim spathname as string
dim nerrors as long
dim nwarnings as long
dim nretval as long
dim bshowmap as boolean
dim bret as boolean
private sub cmdselect_click()
set swapp = application.sldworks
set swdoc = swapp.activedoc
set swdrawing = swdoc
set swexportpdfdata = swapp.getexportfiledata(1)
set swmodeldocext = swdoc.extension
dim lnglistitem as long
dim strsheetname(30) as string
for lnglistitem = 0 to listbox1.listcount - 1
if listbox1.selected(lnglistitem) then
strsheetname(lnglistitem) = listbox1.list(lnglistitem)
end if
next lnglistitem
varsheetname = strsheetname
path = swdoc.gettitle
filename = "c:\pdf\"
filename = filename + left(path, 4) + "\"
set fso = createobject("scripting.filesystemobject")
if fso.folderexists(filename) then
else
fso.createfolder (filename)
end if
filename = filename + left$(path, len(path) - 9) + ".pdf"
if swexportpdfdata is nothing then msgbox "nothing"
boolstatus = swexportpdfdata.setsheets(swexportdata_exportspecifiedsheets, varsheetname)
boolstatus = swmodeldocext.saveas(filename, 0, 0, swexportpdfdata, lerrors, lwarnings)
if left(path, 2) = "t-" then
bshowmap = swapp.getuserpreferencetoggle(swdxfdontshowmap)
swapp.setuserpreferencetoggle swdxfdontshowmap, false
filename = "c:\dxf\"
filename = filename + left$(path, len(path) - 9) + ".dxf"
bret = swdoc.saveas4(filename, swsaveascurrentversion, swsaveasoptions_silent, nerrors, nwarnings)
if bret = false then
nretval = swapp.sendmsgtouser2("problems saving file.", swmbwarning, swmbok)
end if
' restore old setting
swapp.setuserpreferencetoggle swdxfdontshowmap, bshowmap
else
bshowmap = swapp.getuserpreferencetoggle(swdxfdontshowmap)
swapp.setuserpreferencetoggle swdxfdontshowmap, false
'filename = swdoc.getpathname
'filename = left$(filename, len(filename) - 7) + ".dxf"
filename = "c:\dxf\"
filename = filename + left(path, 4) + "\"
set fso = createobject("scripting.filesystemobject")
if fso.folderexists(filename) then
else
fso.createfolder (filename)
end if
filename = filename + left$(path, len(path) - 9) + ".dxf"
bret = swdoc.saveas4(filename, swsaveascurrentversion, swsaveasoptions_silent, nerrors, nwarnings)
if bret = false then
nretval = swapp.sendmsgtouser2("problems saving file.", swmbwarning, swmbok)
end if
' restore old setting
swapp.setuserpreferencetoggle swdxfdontshowmap, bshowmap
end if
exportpdf.hide
end sub
private sub userform_activate()
set swapp = application.sldworks
set swdoc = swapp.activedoc
set swdrawing = swdoc
set swexportpdfdata = swapp.getexportfiledata(1)
set swmodeldocext = swdoc.extension
listbox1.clear
call vue
if listbox1.listcount = 1 then
cmdselect_click
end if
end sub
private sub vue()
dim swview as sldworks.view
dim arr_sheetnames() as string
dim strstartupsheetname as string
dim strsheet as string
dim strtablename as string
dim lngsheet as long
dim lnglistitem as long
dim bolresult as boolean
strstartupsheetname = swdrawing.getcurrentsheet.getname
arr_sheetnames = swdrawing.getsheetnames
for lngsheet = 0 to ubound(arr_sheetnames)
listbox1.additem (arr_sheetnames(lngsheet))
if lngsheet = ubound(arr_sheetnames) + 1 then
strsheet = strstartupsheetname
else
if arr_sheetnames(lngsheet) = strstartupsheetname then
goto next_sheet
end if
strsheet = arr_sheetnames(lngsheet)
end if
bolresult = swdrawing.activatesheet(strsheet)
next_sheet:
next lngsheet
end sub
steph
edited: 05/22/2008 at 03:27 pm by stephane demers
thanks steph.
i will give it a try. i am not very well versed in creating macros or forms but i will see what i can do. i will let you know if it turns out.
thanks again.
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 10:46 , Processed in 0.037773 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表