Page 1 of 1
Pasting Text from PDF into LiveCode Fields
Posted: Thu Apr 04, 2013 1:53 pm
by billenright123
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
Re: Pasting Text from PDF into LiveCode Fields
Posted: Thu Apr 04, 2013 2:03 pm
by dunbarx
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
Re: Pasting Text from PDF into LiveCode Fields
Posted: Thu Apr 04, 2013 6:43 pm
by Simon
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
Re: Pasting Text from PDF into LiveCode Fields
Posted: Thu Apr 04, 2013 7:16 pm
by jacque
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?
Re: Pasting Text from PDF into LiveCode Fields
Posted: Fri Jun 21, 2013 11:47 pm
by wje123
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.
Re: Pasting Text from PDF into LiveCode Fields
Posted: Sat Jun 22, 2013 1:48 am
by jacque
You could test what's in the clipboard:
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
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.
Re: Pasting Text from PDF into LiveCode Fields
Posted: Sun Jun 23, 2013 4:57 pm
by wje123
This is the result (whether 1 char or the entire PDF is copied)
REVO5500
{\rtf1\mac {\colortbl;\red0\green0\blue0;}
\pard
}
Thanks
Bill
Re: Pasting Text from PDF into LiveCode Fields
Posted: Mon Jun 24, 2013 8:20 pm
by jacque
It looks like it is capturing some RTF info but no text and nothing else. Probably worth a bug report.
Re: Pasting Text from PDF into LiveCode Fields
Posted: Tue Jun 25, 2013 8:43 am
by Mark
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
Re: Pasting Text from PDF into LiveCode Fields
Posted: Wed Jun 26, 2013 11:54 am
by wje123
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
Re: Pasting Text from PDF into LiveCode Fields
Posted: Sat Jul 25, 2015 12:30 pm
by rinzwind
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.