Re: text to dark pdf
Re: text to dark pdf
- Subject: Re: text to dark pdf
- From: Timofey Danshin <email@hidden>
- Date: Tue, 6 Oct 2009 23:13:01 +0400
Well, apparently it is not possible to do that in Camino. Or, at least, i do not know a way to do that. But is there any reason not to use Safari?
Again, i think creating an html stub and then filling in the text would be the preferable variant.
For example, you have a stub like this:
<html>
<body bgcolor="#aaaaaa">
<div id='text'>
</div>
</body>
Then your apple script would look something like this:
-- first you have to open the html document. Look it up in Safari's dictionary. It should be simple.
-- Suppose you have the text you want to insert into the page in variable theTextToInsert
tell application "Safari"
tell document 1 -- if your stub is opened in the front tab of safari
do _javascript_ "
function fillInText() {
document.getElementById("text").innerHTML=' " & theTextToInsert & " ';
}
fillInText();
"
end tell
end tell
And then you go on to save the page as a PDF document. You will, however, loose the formatting of you text, if it is of any importance to you. But, if you can split your text into logical parts (or if you assemble the text from certain parts), you can format them yourself. HTML is not a big deal, you can learn more about it at
w3schools.com .
2009/10/6 Rounak Jain
<email@hidden>
i don't use a script in Safari. I click "print" from the file menu and save the page as pdf.
If I use Camino, then something like this works
tell app "Camino"
set thetext to selected text from current tab of front browser window
end tell
That way I can get the text.
On Oct 6, 2009, at 8:10 PM, Timofey Danshin wrote:
Well, that depends on how you get safari (or another browser, as you were saying) to first "intake" and then save the text. What i mean, actually seeing your script would be helpful.
Timofey.
2009/10/6 Rounak Jain
<email@hidden>
sorry, i don't know _javascript_. If someone can write it, then i can use it. But i can't write it myself. I simply want to change the entire background color to gray.
On Oct 6, 2009, at 4:07 PM, Timofey Danshin wrote:
Well, you can open in in safari and then make safari do _javascript_, that would change the background of the body to the colour you desire.
You can create the document stub first and replace a certain element in it with the text you want (again, by do _javascript_ and document.getElementById('your_id_here').innerHTML.
Best of luck
2009/10/6 Rounak Jain
<email@hidden>
I can convert text into pdf file in many different ways. (For example, i can open the text file in browser and then "Save as pdf" in print window). But I want to do it in a way that the background of the text is gray or dark coloured in the pdf file.
How to do it?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
--
Best Regards,
Timofey Danshin.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
--
Best Regards,
Timofey Danshin.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
--
Best Regards,
Timofey Danshin.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden