Pasting Text from PDF into LiveCode Fields
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 5
- Joined: Thu Apr 04, 2013 11:08 am
Pasting Text from PDF into LiveCode Fields
I have several PDFs (mostly text) that I need to paste into fields for formatted.
However, the fields will not accept the info via Paste command (this works perfectly well in Revolution 4.0).
I can get it to accept if i do the following:
1 Paste text into MS Word.
2 Copy text from MS Word.
Any thoughts?
Thanks
However, the fields will not accept the info via Paste command (this works perfectly well in Revolution 4.0).
I can get it to accept if i do the following:
1 Paste text into MS Word.
2 Copy text from MS Word.
Any thoughts?
Thanks
Re: Pasting Text from PDF into LiveCode Fields
Hi.
When you copy the text from the pdf, what does the clipBoardData have in it? Is the clipBoardData empty?
What I mean is that LC should not care what the source of the data is.
You see what I am getting at.
Craig Newman
When you copy the text from the pdf, what does the clipBoardData have in it? Is the clipBoardData empty?
What I mean is that LC should not care what the source of the data is.
You see what I am getting at.
Craig Newman
Re: Pasting Text from PDF into LiveCode Fields
Hi billenright123,
There are methods of locking pdf documents that prevent people from copying and pasting. You should try to copy and paste just into notepad or textedit to remove LC from the equation.
Simon
There are methods of locking pdf documents that prevent people from copying and pasting. You should try to copy and paste just into notepad or textedit to remove LC from the equation.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Pasting Text from PDF into LiveCode Fields
The same problem used to happen when copying from Word, so you are one step ahead.
It was a bug that RR fixed a while back. I believe there was another app as well that also loaded the clipboard with unusual content but I can't remember which one it was.
That said, I just tried copying from a PDF here and it pastes fine into a LiveCode field. Are you doing a manual paste, or trying to script it?

That said, I just tried copying from a PDF here and it pastes fine into a LiveCode field. Are you doing a manual paste, or trying to script it?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Pasting Text from PDF into LiveCode Fields
Following up on this topic (after being side-tracked for a while).
1 – Only certain PDFs cause this problem (one is attached).
2 – The PDFs are not Locked.
3 – The data readily pastes into Word and other programs.
4 – I have tried clipboardData["text"], etc. None work.
5 – “Put the clipboard data” (in messagebox) does not return anything. Yet the data is there if I go to Word and paste.
I also have strange results pasting in data from Excel.
I know there are work arounds (pasted into Word first, etc.), but it should not be that complicated.
Thanks in advance for any suggestions.
1 – Only certain PDFs cause this problem (one is attached).
2 – The PDFs are not Locked.
3 – The data readily pastes into Word and other programs.
4 – I have tried clipboardData["text"], etc. None work.
5 – “Put the clipboard data” (in messagebox) does not return anything. Yet the data is there if I go to Word and paste.
I also have strange results pasting in data from Excel.
I know there are work arounds (pasted into Word first, etc.), but it should not be that complicated.
Thanks in advance for any suggestions.
Re: Pasting Text from PDF into LiveCode Fields
You could test what's in the clipboard:
Copy a small bit of the problem text and then run that handler, see what you get. It should at least tell you if anything is transferring over at all.
Code: Select all
on cliptest
put the keys of the clipboarddata into tKeys
repeat for each line k in tKeys
put the clipboarddata[k] & cr after tList
end repeat
put tlist
end cliptest
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Pasting Text from PDF into LiveCode Fields
This is the result (whether 1 char or the entire PDF is copied)
REVO5500
{\rtf1\mac {\colortbl;\red0\green0\blue0;}
\pard
}
Thanks
Bill
REVO5500
{\rtf1\mac {\colortbl;\red0\green0\blue0;}
\pard
}
Thanks
Bill
Re: Pasting Text from PDF into LiveCode Fields
It looks like it is capturing some RTF info but no text and nothing else. Probably worth a bug report.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Pasting Text from PDF into LiveCode Fields
Hi,
Apparently, LiveCode is treating the PDF data as an object, which contains an RTF snippet. Try this: in the message box:
What do you get? If you get the same as what you pasted in your previous message, then this is a bug, although at this point I'm not sure whether this bug would be in the PDF reader or in LiveCode.
Kind regards,
Mark
Apparently, LiveCode is treating the PDF data as an object, which contains an RTF snippet. Try this: in the message box:
Code: Select all
put the clipboarddata["object"]
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Pasting Text from PDF into LiveCode Fields
Unfortunately, nothing is returned.
As an interim solution, I have created a macro in Keyboard Maestro.
It pastes the clipboard into TextEdit and then copies the pasted text back to the clipboard.
Not elegant, but fast.
Thanks for the suggestion.
Bill
As an interim solution, I have created a macro in Keyboard Maestro.
It pastes the clipboard into TextEdit and then copies the pasted text back to the clipboard.
Not elegant, but fast.
Thanks for the suggestion.
Bill
Re: Pasting Text from PDF into LiveCode Fields
Somehow copying pasting from the vba editor in Excel (alt+f11) doesn't show up in the clipboarddata too...
Don't know why... pasting into notepad works. And copying in from notepad works too. But directly from the VBA editor does not work.
Don't know why... pasting into notepad works. And copying in from notepad works too. But directly from the VBA editor does not work.