How to adjust area text bounding box without altering kerning or spacing between words? - adobe-illustrator

I am creating svg figures using ggplot in R, then fine-tuning them in Adobe Illustrator.
Any attempt to expand area text in Illustrator (i.e. plot title or axis labels) causes the words to be spaced further apart.
How can I keep the word spacing constant while increasing the size of the area text bounding box, so that all the text can be seen?
The images show what happens when I try to expand the text box.

Increase Letter Spacing to fit the text your desired need. Let me know if you have any questions.

This turns out to be a problem with the bounding boxes drawn by the graphics device in R Studio. It cannot be undone by Illustrator.
The simplest (though non-reproducible) solution is just to delete the text box in Illustrator and add a new one manually, then type your text. It is fast and if you insist on reproducible work it is necessary to learn the ins and outs of the theme arguments in ggplot to specify the sizes. I also recommend the latex2expr package for typing LaTeX math notation into ggplot arguments.

Related

Text with superscript in matplotlib, rendered as a single string

When making tick labels with superscripts (e.g. on a log-log plot), matplotlib renders each digit in a label as a separate text object in PDF. Is there a way to make matplotlib render entire label as one string, with characters of different kinds (regular and superscript)?
It is important when trying to edit/resize plot in a vector editor. Currently I have to re-do all tick labels manually as the split tick labels get misaligned.
You may refer to the official tutorial using Latex language [https://matplotlib.org/users/usetex.html]

What is PDF stroking, non-stroking and filling?

I've just started using Apache PDFBox and I'm completely baffled as to what is meant by stroking, non-stroking and filling when applied to text and lines.
Please can someone point me to a reference / guide which explains what these terms mean (for beginners) and what the difference is between them.
Its pretty simple. Consider a rectangle located at 0,0 and 50 units wide and high. That is described as a path with vertices at 0,0 0,50 50,50 and 50,0
Now, if you stroke the path (imagine drawing along the path using a pen) with black. What you get is a black square, the interior of the square is whatever was on the paper before you drew the border (probably nothing, so white).
If you fill the path, you get a filled in square, but no border drawn.
If you fill and stroke the path you get a filled in square with a border. Because the fill and stroke colours can be different you can have the square filled in one colour and the border drawn in another.
See the PDF Reference, section 4.4 "Path Construction and Painting"
Update (by -kp-)
I've copied the following table from the official PDF-1.7 specification:
This table shows the different text rendering modes. Here too, you can stroke or fill or do both to glyph shapes. You can even do neither stroke nor fill, but still define the shapes: that is, you get invisible text -- a very useful mode for placing OCR-ed text on top of a scanned image! It makes the text searchable, copy'n'paste-able and screen-reader aware.
I am currently writing a book The ABC of PDF with iText that introduces you to all these principles.
You are talking about the "Graphics State" and syntax that is used to define objects on a page. This syntax is stored in content streams.
Ignoring "Text State" (a subset of "Graphics State") for the moment, the idea is that you create paths and shapes (shapes are closed paths). These path and shapes can be drawn using stroke and fill operators. If you fill a path, you need to define whether you're using the non-zero winding rule or the even-odd rule (if you've studied geometry at college level, you've already encountered these rules).
Stroke and fill operators will use the colors of the current graphics state. Lines will be drawn using the stroking color. Shapes will be filled using the non-stroking color.
There's much more info in the free ebook you can download from Leanpub.

PDF - Mass cropping of non-whitespace application

I have about 400 pdfs with a lot of dead space between the text and the page border.
Usually I'm using govert's pdf cropper to crop all the whitespace, but this time the pdf background color is (darn!) yellow,
and no software which I know (and I've searched for quite a while) can crop non-whitespace
(well, except maybe pdfcrop.pl -a Pearl library which supposedly can remove black spaces).
Anybody knows of a software that can perform such task?
The ideal app, I guess, would have the option to receive specific color to remove,
like rgb(192,192,192).
Thanks in advance.
The reason this is so difficult is that PDF has no concept of paper color or background color. So what you're seeing is not a different background color, but an object (typically a rectangle) painted in that yellow background color.
Most cropping tools simply calculate the bounding box of all objects on the page and then crop away everything outside that bounding box. Of course that doesn't work for your file because the bounding box will include the background rectangle object.
There are potentially a number of directions you could take this:
1) If all pages need to be cropped by the same amount, you could attempt to do cropping that way (simply passing a rectangle to the cropping tool to do the actual cropping).
2) There are tools (callas pdfToolbox - watch it, I'm associated with this tool, Enfocus PitStop...) that allow you to remove objects from a document and this could be done by specifying your yellow color. This would allow you to modify the PDF file by removing the background object and then perform the cropping you want to perform.

How to save Photoshop slices as rectangles to a text file?

Is it possible to get slice rectangles in pixels using Photoshop scripting? I'd like to be able to save user slice rectangles as text in the following format: x, y, width, height for each slice on a new line.
I'm absolutely new to Photoshop scripting, so I don't know how to do it, or if it's possible at all.
There is not real way of controlling slices with JavaScript; there are ways around it.
However, this link may be of use to you.

Is it possible to remove the background of a text block in pdf using ghostscript

I am trying to convert a pdf into tif using ghost script. Is it possible to remove the background (grey color) of a text block (back font color) in a pdf using ghost script? I would like to replace the grey background to white.
Appreciate your help!!
I don't think you'll get a generic solution to your problem because there are many different ways such a background may be coded in your PDF and there is no sure way to distinguish such a background from a rectangular form of some vector image.
PDF essentially offers a set of tools for positioning glyphs and vector graphics in some rectangle (page) to display and some additional tools to add some interactivity (e.g. forms). Thus, a colored background in a PDF generally is created by drawing a line along the edge of the area of the background, fill this form with the desired color, and position glyphs and graphics (text and images) atop it. There are other operators, too, which can be used, though, and many variants of their use, and generally the form created is not marked as background.
In the answer Dingo refers to in his comment a rectangle covering the whole page, actually even a bit more (in case of a fairly common choice of a media box), is drawn (m: move to a corner; 4*l: draw the 4 edge lines; h: close the path; f fill the form).
Thus, please make the PDF in question available for inspection, maybe there is some specific solution for your file.