How do I debug a script relying heavily on an existing Illustrator document? - adobe-illustrator

I'm using Adobe Illustrator CS5 and ExtendScript Toolkit CS5.
I've got a very involved script and alert() isn't working anymore because stuff is within a loop. How can I simulate the fact that I'm using a specific Illustrator document so that I can use the debugging features of ExtendScript Toolkit?
I want it to be the same as being inside an Illustrator document and going "File->Scripts->Scriptname". If I just test the script inside ExtendScript, I get an error on
if (app.documents.length > 0) {
Thanks!

Solved!
I had to change the target application to Illustrator within ExtendScript Toolkit and set the debug level to $.level=2
to get it to work properly. I can now have breakpoints and all that good stuff.

Related

vb.net - Display docx & xlsx files in Webview2 control

I'm working on a project in .net that has a need for a document preview function.
I've implemented a Webview2 control and, as the majority of doucments that need to be viewed are pdf, this works a treat.
However, now and again some documents may be in either docx or xlsx format.
When I set webview2.Source = New Uri(PathtoFile) on these files, the webview2 control downloads the document to my downloads folder rather than rendering it.
I get that the files are not HTML, but then again neither are PDFs and they work out of the box.
Is there some mechanism I'm missing whereby I can have the Webview2 control display the file contents for docx and xlxs rather than download?
We are having the same problem ourselves. At the moment we are using a product called Aspose that will allow us to convert Word Documents to XPS, after which we can display the document in a Document Viewer.
While this works, and it works well, the main problem is that this relies on us downloading the document, then converting it and then loading the converted document into the Viewer. Which causes a certain perception of "sluggishness" due to all of that work, whereas images and PDFs, especially when hosted on the Web, can be hosted directly in the WebView2 and this then leaves the rest of our application nicely responsive to user interaction.
So in case anyone comes up with a better suggestion, I'm following this ...
The code using Aspose is pretty straightforward (example in Visual Basic .NET):
Dim oDoc As Aspose.Words.Document = Nothing
oDoc = New Aspose.Words.Document(sFile)
oDoc.Save(fileName:=sToFileName, saveFormat:=Aspose.Words.SaveFormat.Xps)
(left out all error handling and so on in order to focus on the actual functionality. sToFileName just contains a filename along the lines of [somefolder][yourtargetfilename].xps ...)
I guess you may try to convert DOCX to PDF directly via Aspose.Words and XLSX to PDF via Aspose.Cells. Both these APIs support rendering to PDF or even image formats. Since your viewer supports to view PDF or images, so you may try this approach, it might work for your needs.
PS. I am working as Support developer/ Evangelist at Aspose.

Problems with PDF fonts generated with ggsave under windows when linking in Illustrator

I run into problems with embedded (or not embedded?) fonts in PDFs of ggplots created with ggsave and linked into illustrator files, for some reason on windows only.
For my workflow I link plots into illustrator where I create figures with several plots. I don't embed the plots because in case something changes in R the plots are automatically updated when Illustrator is reopened.
So the problem is that when trying to save such files I always get an error message that saving is not possible because the Font "^1" could not be embedded. I can save the illustrator files when I disable PDF compatibility but cannot save them as PDF, which is what I need.
I don't get this problem if I use ggsave(plot, device=cairo_pdf), but with cairo_pdfI run into other problems (e.g. with geom_rangeframe).
In previous posts I read about an issue with the dingbats or AdobePiStd font, but using ggsave(plot, useDingpats=F) does not solve it. Does anyone have an idea how to solve this?
After further research I could solve the problem with the embedFonts function. The the problem seems to be that the fonts are not embedded by default. I wrote a small function to use instead of ggsave to automatically embed the fonts into the same PDF file:
ggsave_embed<-function(fileN, ...){
ggsave(fileN, ...)
embedFonts(file=fileN, outfile = fileN)
}
# example usage:
ggsave_embed("myfile.pdf", myPlot)

Javascript editor with Photoshop intellisense

I want to get started doing some scripts with Photoshop and I wonder if there's an editor out there that either already has Photoshop's objects or allows to load Photoshop's DOM for intellisense.
Any pointers?
The Extendscript Toolkit that comes with Adobe suite is pretty much all you need. It even has the entire DOM reference available through the help menu. It does code completion (intellisense) and you can run/debug scripts in the editor.

PDF Outline Text - Automation of Acrobat Sequences

I have built an application that automates the filling out of form fields inside a pdf. It then takes various assets and combines them together to generate a "print ready" product. All of this is accomplished using the magic of iTextSharp. When form fields are populated, they are then flattened to text. The problem is that even with the fonts embedded they aren't really attached to the form fields in a meaningful way (like straight text elements are) and the printers are complaining that the pdf is generating licensing errors due to this. I researched this a bit and it just seems to be the nature of how form fields are.
The artists we are working with requested that we research a way to "outline" the text that is created from flattening the form fields. I found that running the PDF Optimizer with a custom preset allows for Text Outlining in Acrobat, and even better I can generate an Acrobat Sequence that runs this command on the pdf. The problem is that Sequences can not be automated, at all.
I found a plug-in called AutoBatch that allows for the execution of Sequences on the command line through a batch file. The downside is that this would require installing Acrobat Pro and the Plug-in on the server this application will be running on. Further it seems like an overkill solution just to outline the text in the pdf. For all I know at this point iTextSharp may allow me to do this programmatic, but searching for such a thing on google returns little results and nothing relevant.
So the question: Is there a better way to outline text in a pdf than the current solution I have implemented or am I kind of stuck?
TLDR; PDF is generated w/ non-standard fonts. I need to "outline" this text to send it to the printer. Currently using AutoBatch Acrobat Plug-In to execute Acrobat Sequence from the Command Line. Seems excessive, wondering if anyone knows a better way to automate font outlining.
I am also in a printing environment and have used forms for "Box Covers" plenty of times to shorten the code used to produce box covers.
I simple us "pdfStamper.FormFlattening = true;" and the printers (Xerox DP180 and DC5000) has no problems in using the PDF.
The moment I leave out FormFlattening the printer gives a lot of errors regarding the PDF.
If you are using FormFlattening then check if the printer has the font locally installed in order for it to reference the font from the print engine instead of the PDF resources.

Batch edit pdf - change Page Layout and Magnification with Automator Action or AppleScript

Just wondering if there is a way to batch edit pdf documents and set the "Page Layout" and "Magnification" attribute of a document so that they all the documents are displayed the same way if you open them.
I'm a Mac so a Automator or AppleScript solution would be cool! BTW I have Acrobat Pro.
Thanks!!
this could be done with some really hard work via gui script (NOT recommended) or by way of javascript which has it's complications as well but is much more reliable than gui scripting you will need the the javascript reference to learn how to do the javscript part of the script and you will have to research how to run the js in your applescript if you have questions I'll be happy to try to help but I'm not just gonna hand you the code to this job.