Here is a better version that copies the selected image to a new document, dynamically sizes it to 100%, centers it on the page and exports the page to a PDF that is named using the original image name.
// Begin Script ////////////////////////////////////////////////////////////////////////////////////
//set selection as variable
var thisItem = app.selection[0];
//create new document
var myNewDocument = app.documents.add();
//duplicate selected item to new document
var myDuplicatedItem = thisItem.duplicate(myNewDocument.pages.item(-1));
//get image within the frame
var myLinkedItem = myDuplicatedItem.pageItems[0];
//get name of the linked image
var myLinkName = myLinkedItem.itemLink.name;
//strip extension from linked image name
var myLinkName = myLinkName.split(“.”)[0];
//find the horizontal and vertical scale integers
var myHscale = 100 / myLinkedItem.horizontalScale;
var myVscale = 100 / myLinkedItem.verticalScale;
//Scale the image around its center point
var myScaleMatrix = app.transformationMatrices.add();
myScaleMatrix = myScaleMatrix.scaleMatrix(myHscale, myVscale);
myLinkedItem.transform(CoordinateSpaces.PASTEBOARD_COORDINATES, AnchorPoint.centerAnchor, myScaleMatrix);
//fit frame to content
myDuplicatedItem.fit(FitOptions.frameToContent);
//get width of the full-sized item
var dupedItemWidth = myDuplicatedItem.geometricBounds[3] – myDuplicatedItem.geometricBounds[1];
//get height of the full-sized item
var dupedItemHeight = myDuplicatedItem.geometricBounds[2] – myDuplicatedItem.geometricBounds[0];
//get the x coords we need to center the item on the page
var xCoordsCalc = (myNewDocument.documentPreferences.pageWidth – dupedItemWidth) / 2;
//get the y coords we need to center the item on the page
var yCoordsCalc = (myNewDocument.documentPreferences.pageHeight – dupedItemHeight) / 2;
//set frame bounds in order to center the frame on the page
myDuplicatedItem.geometricBounds = [yCoordsCalc, xCoordsCalc, (yCoordsCalc + dupedItemHeight), (xCoordsCalc + dupedItemWidth)];
//move the image to fit into the centered frame
myDuplicatedItem.fit(FitOptions.contentToFrame);
//Set Name of exported pdf to match the name of the linked image
var myFile = File(“/Users/admin/Desktop/” + myLinkName + “.pdf”);
//export the pdf
myNewDocument.exportFile(ExportFormat.PDF_TYPE, myFile, false, “High Quality Print”);
// End Script ////////////////////////////////////////////////////////////////////////////////////