Illustrator Script Mass PDF export bleed - adobe-illustrator

im using a Savescript for a mass pdf export of multiple AI files.
The exports goes ok, except for the fact that it keeps on exporting with bleeds
(standard 3mm bleed)
this is the script: http://xcorr.net/2010/05/12/batch-export-ai-files-to-pdf/
with these saveoptios
function getPDFOptions()
{
var pdfSaveOpts = new PDFSaveOptions();
pdfSaveOpts.acrobatLayers = false;
pdfSaveOpts.colorBars = false;
pdfSaveOpts.colorCompression = CompressionQuality.AUTOMATICJPEGHIGH;
pdfSaveOpts.compressArt = true; //default
pdfSaveOpts.embedICCProfile = true;
pdfSaveOpts.enablePlainText = true;
pdfSaveOpts.generateThumbnails = true; // default
pdfSaveOpts.optimization = true;
pdfSaveOpts.pageInformation = false;
pdfSaveOpts.preserveEditability = false;
pdfSaveOpts.bleedLink = false;
pdfSaveOpts.bleedOffsetRect = [0,0,0,0];
pdfSaveOpts.trimMarks = false;
pdfSaveOpts.offset = 0.0;
return pdfSaveOpts;
}
i tried pdfSaveOpts.bleedLink = false; putting it on true with combination of pdfSaveOpts.bleedOffsetRect = [0,0,0,0]; but for some reason it isn't working.
Does anyone see what i'm doing wrong or have a working script?

Try setting up a pdf save preset in illustrator then specify it be used in the script with pdfSaveOpts.pDFPreset = "presetName".
You could likely skip all of the other options, no need to reinvent the wheel if it will let you use a preset. You can read about all the options you can pass here Illustrator scripting reference.
Just search for PDFSaveOptions.

The trim lines are there, they are just invisible due to the option:
pdfSaveOpts.preserveEditability = false
If you change this to true then you will see the bleeds in Illustrator again.
It's strange, but ran into this issue myself today. This is the same thing that happens when exporting directly from Illustrator, and unchecking Preserve Editability. I believe the bleeds are encoded in the file, but you just can no longer see them.

Related

How to export vuelayers map to png or jpeg?

How would I adapt #ghettovoice JSFiddle that saves a map to PDF to save the map to a JPEG or PNG? I have no idea how to attempt this problem so ideally if you know hoe to do it you can explain the logic behind it.
exportMap: function () {
var map = this.$refs.map
map.once('rendercomplete', function () {
var mapCanvas = document.createElement('canvas');
var size = map.getSize();
mapCanvas.width = size[0];
mapCanvas.height = size[1];
var mapContext = mapCanvas.getContext('2d');
Array.prototype.forEach.call(
document.querySelectorAll('.ol-layer canvas'),
function (canvas) {
if (canvas.width > 0) {
var opacity = canvas.parentNode.style.opacity;
mapContext.globalAlpha = opacity === '' ? 1 : Number(opacity);
var transform = canvas.style.transform;
// Get the transform parameters from the style's transform matrix
var matrix = transform
.match(/^matrix\(([^(]*)\)$/)[1]
.split(',')
.map(Number);
// Apply the transform to the export map context
CanvasRenderingContext2D.prototype.setTransform.apply(
mapContext,
matrix
);
mapContext.drawImage(canvas, 0, 0);
}
}
);
if (navigator.msSaveBlob) {
// link download attribuute does not work on MS browsers
navigator.msSaveBlob(mapCanvas.msToBlob(), 'map.png');
} else {
var link = document.getElementById('image-download');
link.href = mapCanvas.toDataURL();
link.click();
}
});
map.renderSync();
}
The problem was a combination of missing dependencies (namely FileSaver.js and fakerator.js) and a cross origin server block (CORS block) (Browsers automatically prevent httpRequests to a different domain name unless the server allows it). The first one is fixed by installing the packages while the second one is resolved by setting the crossOrigin Attribute of the ImageWMSLayer to null in my case but possibly to 'Anonymous' for other sources. Hope this helped someone else :)

On changing device font, app font changes.How to restrict that?

I have used one custom font in the react native application. And everything is working fine accept when the users go to the phone settings and change the font size. Then in the application the UI looks pretty ugly. I have used StyleSheet.create method to create all the styles in the app and also have given definite font sizes for the texts. But even though when the phone settings font size is changed, my app font size also changes.
Is there a way to restrict any changes in the app's font size, irrespective of what users may do in the phone settings?
Or you can add this in your main app index.js file
// Override Text scaling
if (Text.defaultProps) {
Text.defaultProps.allowFontScaling = false;
} else {
Text.defaultProps = {};
Text.defaultProps.allowFontScaling = false;
}
// Override Text scaling in input fields
if (TextInput.defaultProps) {
TextInput.defaultProps.allowFontScaling = false;
} else {
TextInput.defaultProps = {};
TextInput.defaultProps.allowFontScaling = false;
}
You can stop the scaling with this prop allowFontScaling={false} in your Text component.
Ref - https://reactnative.dev/docs/text#allowfontscaling
I was able to solve this problem using the following code in every page
constructor() {
super();
if (Text.defaultProps == null) Text.defaultProps = {};
Text.defaultProps.allowFontScaling = false;
}
Hope it can help others as well.
For projects using functional components and hook,
Add below line in useEffect of App.js file
if (Text.defaultProps == null) Text.defaultProps = {};
Text.defaultProps.allowFontScaling = false;

Adobe Illustrator Scripting - Change Color of Selection

I'm trying to set the colour of my current selection in Illustrator using a .jsx script.
I can't find documentation on changing styles on (selected) objects. I have read most documentation out there, but I can't seem to find such a "simple" thing anywhere. Here is the code I've come up with:
thisThing = app.activeDocument.selection[0];
thisThing.filled = true;
thisThing.fillColor = '#ff0000';
When I run it, nothing happens sadly.
I have figured out a solution - it works, but it's very messy (due to being an edited solution). This gives a random grey colour to the selected item:
var myGrey= new CMYKColor()
myGrey.black=((Math.random()*80)+10);
if (app.documents.length && app.selection.length)
{
for (var a=0; a<app.selection.length; a++)
{
try {
app.selection[a].fillColor = myGrey;
} catch (e)
{
// ignoring all possible errors ...
}
}
}
In case you want to do non-grayscale: add myGrey.Yellow = value between 1-100;

Turning Multiple Layers On and Off in Photoshop with export image Script

I have 1 group in photoshop in which there are multiple images which are hide by default except the first one, I looking to turn show every image one by one except first one and then export as image with merged first layer
Note : Please see the screenshots Layer
Can someone point me in the direction whether it is possible with script or any action?
I've never scripted in Photoshop but trying to figure this out on my own.
Whole post edited, yet this script covers usability of the original script (that worked only on a single layer group) and also extends itself onto all layer groups.
Script takes the layers from each layer groups in the file and iterates through all of them except the first one in the given group turning them on and off for saving. First layer in each group is always visible for a given group iteration. Exports as PNG but you may adjust anything you need - export options, path, file name etc. Created for CS6 but should work with any version, just check it out.
Any more information you may need is in the reference manual. Just Google for Photoshop CS6/CC Javascript Reference.
The code's below, just copy-paste it using Notepad and save as jsx file. You may test it using ExtendScript Toolkit (it has been installed together with anything from Adobe, you just need to find it). If it works as intended, place the file within Adobe\Adobe Photoshop CS6 (64 Bit)\Presets\Scripts folder, restart Photoshop and the script will be accessible through File > Scripts menu. You may also bind a keyboard shortcut to it if this action needs to be repeated over and over many times. Cheers!
#target Photoshop
if (documents.length == 0) {
alert("nothing opened");
} else {
// start
//setup
var file = app.activeDocument;
var groupsAmount = file.layerSets.length; // get the layer groups
// iterate through groups
for (var k=0; k < groupsAmount; k++) {
hideAllLayers();
var images = file.layerSets[k].layers; // get the layers from the given group
file.layerSets[k].visible = true;
images[0].visible = true; // show the first layer in this group
// begin "i" from 1 to start from the 2nd layer
for (var i=1; i < images.length; i++) {
images[i].visible = true;
exportimage(images[i].name);
images[i].visible = false;
}
}
// function used to export image (adjust as you want accoring to the manual)
function exportimage(name){
var options = new ExportOptionsSaveForWeb();
options.format = SaveDocumentType.PNG;
options.PNG8 = false;
options.transparency = true;
options.optimized = true;
// adjust path & name
file.exportDocument(File(file.path+"/"+name+".png"),ExportType.SAVEFORWEB, options);
}
// function to hide all layers
// simplified version of http://morris-photographics.com/photoshop/scripts/downloads/Hide%20All%20Layers%202-1-0.jsx
function hideAllLayers() {
var ref = new ActionReference();
ref.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
var desc = new ActionDescriptor();
desc.putReference(cTID('null'), ref);
executeAction(sTID('selectAllLayers'), desc, DialogModes.NO);
var ref = new ActionReference();
ref.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
var list = new ActionList();
list.putReference(ref);
var desc = new ActionDescriptor();
desc.putList(cTID('null'), list);
executeAction(cTID('Hd '), desc, DialogModes.NO);
}
function cTID(s) {return app.charIDToTypeID(s);}
function sTID(s) {return app.stringIDToTypeID(s);}
//end
}

Trouble getting all of the variables to work, once one is clicked

just a quick question. Basicaly, I'm making a simple game to accompany my murder mystery interactive website and I'm having some actionscript issues. The idea is that the user will be able to click on objects around the room, and recieive clue, find keys etc. One of the problems im having is when the user clicks the lamp, it brings up a box over the screen to resemble nighttime, however, when the screen reverts to normal, none of the other elements, i.e the book, are clickable - again, im sure this is a simple solution that I am just overlooking, here is the full code;
import flash.events.Event;
import flash.events.MouseEvent;
book.addEventListener(MouseEvent.CLICK,getBook);
key.addEventListener(MouseEvent.CLICK,getKey);
door.addEventListener(MouseEvent.CLICK,gotoBedroom);
//paper.addEventListener(MouseEvent.CLICK,getNote);
Lamp.addEventListener(MouseEvent.CLICK,getDark);
var gotBook:Boolean = false;
var gotKey:Boolean = false;
key.visible = false;
NightTime.visible = false;
//function getNote(evt:MouseEvent):void{
//report.gotoAndPlay(1);
//}
function getKey(evt:MouseEvent):void{
if(gotBook==false){
key.visible = false;
}else{
key.visible = true;
}
}
function gotoBedroom(evt:MouseEvent):void{
if(gotKey==true){
gotoAndStop("Bedroom");
}else
feedBackText.gotoAndPlay(1);
}
if(gotBook==true){
book.visible = false;
key.visible = true;
}
function getBook(evt:MouseEvent):void{
book.visible = false;
key.visible = true;
}
function getDark(evt:MouseEvent):void{
NightTime.gotoAndPlay(1);
NightTime.visible = true;
}
stop()
any help in making all of the variables clickable at the same time would be greatly appreciated. Thank you!
If I get it right, by calling getDark function you show NightTime box (or whatever it is) which cover the screen. I can't see function which is calling
NightTime.visible = false;
so i guess after you show it it's there all the time and overlap rest of screen.
If that's the reason, adding
NightTime.mouseChildren = false;
NightTime.mouseEnabled = false;
should solve the problem.