Generate colour behind text

Post Reply
bjorkollur
Newbie
Posts: 3
Joined: Thu Apr 28, 2022 11:44 pm

Generate colour behind text

Post by bjorkollur »

Hi everybody, is there someone here that can assist me? Or at least point me in the right direction.
I need to create an action that selects text by specific font and size and draws a particular background colour behind it.

Similar to what the highlighter does in the comment tools, but it is not supposed to be a comment.

Attached you will find a screenshot explaining what I am trying to do.
Screenshot 2022-08-25 at 17.54.53 copy.png
Screenshot 2022-08-25 at 17.54.53 copy.png (201.94 KiB) Viewed 501945 times
User avatar
JimmyHartington
Advanced member
Posts: 300
Joined: Tue Mar 22, 2011 7:38 am

Re: Generate colour behind text

Post by JimmyHartington »

Hi

Are you able to provide a sample file?

A way to look could be to see if a selection finding the text segment. Setting the art box to the selection. Add rectangle based on art box.
What I am afraid of is that it would select all the headers and create an art box like in the image below.

Image
bjorkollur
Newbie
Posts: 3
Joined: Thu Apr 28, 2022 11:44 pm

Re: Generate colour behind text

Post by bjorkollur »

Hi Jimmy, and thank you for your replay.
Here is a link to this file: https://www.althingi.is/lagasafn/pdf/152b/1991021.pdf

Whould be realy greatfull for all help that can lead to a solution of this problem.
User avatar
JimmyHartington
Advanced member
Posts: 300
Joined: Tue Mar 22, 2011 7:38 am

Re: Generate colour behind text

Post by JimmyHartington »

It is not quite a box, but this is an attempt.

Image

Actionlist: https://d.pr/f/bAwHG8+
bjorkollur
Newbie
Posts: 3
Joined: Thu Apr 28, 2022 11:44 pm

Re: Generate colour behind text

Post by bjorkollur »

WOW..! Thanx so much.

This is fantastic solution, I was stuck in drawing boxes, and didn't have idea to look out of the box ;)
Also did I not realize I could seperate stroke from fill.

Again, thank you so much, you saved me a lot of time.
User avatar
JimmyHartington
Advanced member
Posts: 300
Joined: Tue Mar 22, 2011 7:38 am

Re: Generate colour behind text

Post by JimmyHartington »

I got stuck on not being able to separate stroke and fill before I embedded the font and outlined it.
So if search in the pdf is important, then it will not work for those headings.
freddyp
Advanced member
Posts: 1022
Joined: Thu Feb 09, 2012 3:53 pm

Re: Generate colour behind text

Post by freddyp »

Good job, Jimmy!

I do have an alternative suggestion: selection of the text as you did, but then
Copy or cut objects to clipboard (then choose copy of course)
Select all
Paste objects from clipboard
Select last added objects
Convert text to outlines
etc.

This will keep the original text as text. That is perhaps not important in this case, I just wanted to point out the copy/paste possibility. And because you then have the text twice, once as text and once as outlines and the outlines are selected you can change the stroke and fill separately without having to embed the font, convert the outlines and separate fill and stroke.

Note the "Select all" between the copy and the paste. This is often forgotten and if you do not use it, it does not work. The reason for that is the following: all actions only work when the selected objects are relevant for that action: Select images, Convert text to outlines does nothing quite obviously. Similarly, select text, copy, paste does not work because you cannot paste on selected text, you have to paste on a page, hence "Select all" (Select page also works).
User avatar
JimmyHartington
Advanced member
Posts: 300
Joined: Tue Mar 22, 2011 7:38 am

Re: Generate colour behind text

Post by JimmyHartington »

freddyp wrote: Mon Aug 29, 2022 9:20 am I do have an alternative suggestion: selection of the text as you did, but then
Copy or cut objects to clipboard (then choose copy of course)
Select all
Paste objects from clipboard
Select last added objects
Convert text to outlines
etc.
I thought of that.
But stopped when I need to paste it to the same coordinates.
I imagine I would need to create an object first which has the size of the Media Box.
Select that with the text.
And then I can paste at the center of the Media Box.
And then delete this object.

But I did not do it since I was not sure the way to use the stroke was good enough for bjorkollur.
If they want I will be happy to give it a try :D
freddyp
Advanced member
Posts: 1022
Joined: Thu Feb 09, 2012 3:53 pm

Re: Generate colour behind text

Post by freddyp »

You can paste objects in the same location: uncheck the option "Move graphic elements" in the Position tab. An unfortunate choice of default value perhaps?
User avatar
JimmyHartington
Advanced member
Posts: 300
Joined: Tue Mar 22, 2011 7:38 am

Re: Generate colour behind text

Post by JimmyHartington »

freddyp wrote: Mon Aug 29, 2022 12:47 pm You can paste objects in the same location: uncheck the option "Move graphic elements" in the Position tab. An unfortunate choice of default value perhaps?
Thanks. Did not know this.
Then I will give it try later to keep the text as text.
User avatar
JimmyHartington
Advanced member
Posts: 300
Joined: Tue Mar 22, 2011 7:38 am

Re: Generate colour behind text

Post by JimmyHartington »

I have now tried to make a new version with freddyp’s suggestions.
https://d.pr/f/NjLN8H+

And maybe freddyp can help again.
It works, but on pages with no headings of the selected type, they get pasted the content from the page before.

See this gif:
Image
freddyp
Advanced member
Posts: 1022
Joined: Thu Feb 09, 2012 3:53 pm

Re: Generate colour behind text

Post by freddyp »

In the first tab: Clear clipboard after paste.
freddyp
Advanced member
Posts: 1022
Joined: Thu Feb 09, 2012 3:53 pm

Re: Generate colour behind text

Post by freddyp »

There is also another possibility: Select page if content is selected (select only the page object and of course more than 0 objects).
User avatar
JimmyHartington
Advanced member
Posts: 300
Joined: Tue Mar 22, 2011 7:38 am

Re: Generate colour behind text

Post by JimmyHartington »

freddyp wrote: Mon Aug 29, 2022 4:11 pm In the first tab: Clear clipboard after paste.
This did the trick.
Here is a new action list: https://d.pr/f/PPgZFR+

Just noticed that foot note indicatiors does not get marked. Because they are in a different font size.
Image
User avatar
JimmyHartington
Advanced member
Posts: 300
Joined: Tue Mar 22, 2011 7:38 am

Re: Generate colour behind text

Post by JimmyHartington »

And now luck will have it, that I can use this action list for a workflow internally. :D
Post Reply