Hallo Forum,
I have the common problem to resize the artboard to standardize technical illustrations to the format 50x50mm. So I found good help in the forum (thank you). I have some problem and may somebody can help me:
N.B.: here It should be a test on landscape format
This is my code, may somebody can help me ?
Thank you to every replay
Regards Alex
Public Sub copy_paste_with_transformation ()
'Duplicates grouped items in a new document with landscape sensitive transformation
Set appRef = CreateObject("Illustrator.Application")
'calculate the size of objects do define if it's landscape or not
Bounds = appRef.ActiveDocument.VisibleBounds
'If the group is landscape the lenth should be 45mm otherwise the higth
appRef.ActiveDocument.GroupItems 'problem
appRef.ActiveDocument.SelectObjectsOnActiveArtboard 'may a solution for CS4 too
appRef.ActiveDocument.Resize(45, 45) 'problem
appRef.ActiveDocument.copy
Set newDocument = appRef.Documents.Add(aiDocumentCMYKColor, 50, 50) 'Paper size is 50mm
newDocument.Paste
'Align group to page center hrizontal and vertical
'???
End Sub
Not in VB ( klingon ) but ExtendScript… May be you can look this up and translate?
#target illustrator
newDocGroup();
function newDocGroup() {
var mm = 2.83464567, grpFile, doc, scale;
grpFile = File( Folder.desktop + '/Testing.ai' );
doc = app.documents.add( DocumentColorSpace.CMYK, 50*mm, 50*mm );
doc.groupItems.createFromFile( grpFile );
if ( doc.pageItems[0].width >= doc.pageItems[0].height ) {
scale = ( 45*mm / doc.pageItems[0].width ) * 100;
} else {
scale = ( 45*mm / doc.pageItems[0].height ) * 100;
};
doc.pageItems[0].resize( scale, scale, true, true, true, true, scale, Transformation.CENTER );
};
North America
Europe, Middle East and Africa
Asia Pacific