« Media Player Classic Pauser | Main | Type ©, ®, and ™ easily. »

Fix Copy-and-Pasting in PDFs

Update (3/30/15): PDF-XChange Viewer is now supported.

Update (10/24/14): I’ve disabled comments due to spam. If you want to contact me, click here.

Update (5/2/11): Major update. See details below.

Update (11/21/2010): Improved version of the script. See details below.

Recently I’ve been reading a lot of ebooks in PDF format so it wasn’t long before I noticed that when you copy text in Adobe Reader (or any other kind of PDF reader like Foxit Reader), it copies the hard returns so if you copy more than one line of text, each line of text is treated like its own paragraph.


The Problem

This is what it looks like in Adobe Reader.

This is what happens when you copy that text and paste it into Microsoft Word.

Still good, right? But what if I want to change the font size?

Here I changed the font size of the first two lines to 8-pt. Now you should see the problem quite clearly; in its infinite wisdom, Adobe Reader inserts hard returns instead of soft returns. In other words, Adobe Reader is essentially pressing “Enter/Return” after every line instead of automatically “word wrapping” the text to fit the window size. If this sounds absurdly idiotic, that’s because it is. At first I didn’t know that was the problem until I found this guy’s blog post in a Google search. To give you an idea of how basic “word wrap” is, Notepad has it.

I know I’m not the only one who’s had this problem, and someone even wrote a Word macro. I haven’t tried the macro but it only works with Microsoft Word and it seems overly complicated (it uses well over 100 lines of code and requires a detailed step-by-step installation and usage guide; my script just works out of the box and only uses five nine lines of code (I added support for other PDF readers) [The latest version uses quite a few lines of code, but the vast majority of it is just to add some “nice-to-have” features, especially the automatic quote appending].

The Fix


PDF Copy-Paster.exe (program)

Program Notes

This script strips out all hard returns out of any copied text. Simply keep the program running and it will automatically take out all the hard returns in the background. The program only activates for PDF readers. Currently the program recognizes Adobe Reader (both the standalone program and the browser plugin versions), Foxit Reader, and Sumatra PDF as PDF readers. If your favorite PDF reader isn’t on here, shoot me a quick email and I’ll add it for you.

[Note: The latest version (5/2/11) will close this popup for you automatically] Note that if you press ctrl+c twice quickly, Adobe Reader may pop up a message saying “There was an error while copying to the Clipboard. An internal error occured.” This is likely because Adobe Reader tried to modify the clipboard contents while they were being modified by the script (removing the hard returns). You do not need to copy the text again; everything should work fine.

Update (5/2/11)

I finally made a breakthrough and identified why sometimes the script would stop working and have to be restarted. Turns out it’s an issue with Windows, not anything to do with my code. Anyway, I’ve included a workaround as well as some new features such as an option to automatically add quotes to your copied selections (right click on tray icon to enable) and the ability to left-click on the tray icon to disable or enable the program. The program’s been significantly changed, but most of it is under the hood. The script should now have absolutely no bugs. Of course, if you think you’ve found me, please contact me.

Update (11/21/2010)

I’ve been using this program a lot while writing some big research papers, so I returned to the script to make toggling it more elegant. Now, just press Ctrl+Shift+D to toggle whether the script is active or not. The script’s icon will reflect this change. You no longer need the helper program for this functionality.

Update (9/2/2010)

Helper Program

I wrote this little script for a friend who sometimes wanted to retain the hard returns and sometimes didn’t. It’s not exactly elegant, but it works. Press Ctrl+Shift+d to toggle PDF Copy-Paster. If it’s already running, it will be closed while if it isn’t running, this script will run it.

A few notes

1. This only works for the compiled version of PDF Copy-Paster (the .exe version). Although I am providing a source code version (.ahk), this version also only works with the compiled version of PDF Copy-Paster.

2. This companion script needs to be placed in the same directory as PDF Copy-Paster.exe.

3. I was too lazy to make an icon for this, so it uses the default AHK icons.

Helper Program Download

PDF Copy-Paster Toggler.exe (program)

PDF Copy-Paster Toggler.ahk (source code)

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (38)

I can only say..OMFG!!

Dude, like how is it...I mean, I just....Thanks sooo f******* very much!

Why didn't I searched for this in the past??..and I can't believe you have no comments!! this is great!, so easy simple awesome, I really have to congratulate you.

You know, I got used to copy first and identify the hard breaks and erase one by one, at first it was annoying, then I just didn't care anymore, then in MS word I used a featured called "show all" or something like that which shows you the "invisible things" like spaces and tabulates and the hard returns, so I looked for those and erased them one by one..so...

I just have no words for your awesome contribution, it helps me a lot, I wish I saw this before, but now it's gonna be a lot of use.

Thanks thanks thanks, really! =)


May 6, 2011 | Unregistered CommenterEdward


although..I'm seeing that when I select 2 paragraphs which are "hard returned" so they separe...I mean:

lalalala, paragraph 1.

lalalal, paragraph 2.

I get one line insted of 2, like:

lalalala, paragraph 1. lalalal, paragraph 2.

So I don't know if that can be fixed....but anyway doesn't matter that much, for now I usually copy few part's, not whole paragraphs, but for times like that, it would be nice to see the separation... =)


May 6, 2011 | Unregistered CommenterEdward

Hi Edward,

Thanks for the kind words! I think the reason this fix isn't more popular is because so few people know how to search for the problem. Few people know the difference between hard and soft returns, and even fewer people would ever imagine that Adobe would design their program to use hard returns even now in 2011. Also, I think that most people are willing to manually remove each hard return. It was only when I needed to copy from dozens of different PDFs that I actually bothered trying to solve the problem.

Yes, the issue with multiple paragraphs is a limitation, Unfortunately, I can't figure out a way to solve it. Unfortunately, there's really only so much that can be done without changing Adobe Reader itself.

Also, if you notice that sometimes the wrong characters are copied, that is also an unavoidable problem, since it's Adobe Reader not recognizing the correct character (regardless of whether my program is active or not).

The One Hour Programmer

May 6, 2011 | Registered CommenterOne Hour Programmer

Hi there, you are a genius! thanks a lot for the fix...it works perfectly.

September 15, 2011 | Unregistered CommenterMireilla

I am one of those people who don't understand soft returns and hard returns etc. But I found this website trying to fix an error (error copying to clipboard message every time I tried to copy something). Not knowing what would happen I downloaded the fix, realised it didn't do what I needed (apparently hard returns are a good thing if you are copying legislation?) and toggled it off. But this has fixed my clipboard error problem, so thank you!

November 1, 2011 | Unregistered CommenterHolly

You said you have the updated version automatically removing the popup in Adobe that says “There was an error while copying to the Clipboard. An internal error occured.”
Can you please share the AHK script you wrote to do this?

November 9, 2011 | Unregistered CommenterKeith

Sure, no problem:

SetTimer, ErrorBlocker, 150

PostMessage, 0x112, 0xF060,,, Adobe Reader, There was an error while copying to the Clipboard. ; 0x112 = WM_SYSCOMMAND, 0xF060 = SC_CLOSE

It just checks for the window, and closes it if detected.

November 11, 2011 | Registered CommenterOne Hour Programmer

Wow this is AWESOME!!!!!! Thank you thank you thank you for sharing this!

One question, I don't see the icon on my tool bar - the shift+control+d works perfectly but it'd be great to use the button. Any suggestions making it appear?

Thanks again - I've been deleting hard returns for years...NO MORE!

November 16, 2011 | Unregistered CommenterK. Ackerson

Thanks very much! This is going to save me a lot of time. Your work is much appreciated.


November 30, 2011 | Unregistered CommenterMichael

Hi, you the icon isn't in your tool bar, but in your system tray (bottom right of your screen). You can enable/disable the program by simply left-clicking the icon.

December 6, 2011 | Registered CommenterOne Hour Programmer

you, sir, are a god, I've been looking for a work around this forever. The multiple paragraph is definitely a limitation, but it is better than the alternative. I wish Adobe or Microsoft would fix this annoying problem.

December 7, 2011 | Unregistered Commenterjames

Also, what I have been doing before I found this script is using Calibre to convert pdf to txt for huge documents. Then I copy the text into Word for formatting. This helps with having copy multiple paragraph that this script doesn't do. But this program is nice that it allows me to select certain text. Hope this helps someone

December 7, 2011 | Unregistered Commenterjames

Thank you so much for this!

April 4, 2012 | Unregistered CommenterElizabetta

Your fix is right on. I was constantly getting that error mesage til the annoyance became too much and then I started searching on the Adobe site and then to here. I will make sure that I post your site with your solution on the Adobe site and maybe that will prompt them to incorporate the fix themselves!

Thanks again for the simple and perfect fix.


May 23, 2012 | Unregistered Commenterstarnet7

it's works fine.
lot of working time saved up

June 1, 2012 | Unregistered CommenterMikeDrake

I just googled this having become exasperated by inability to copy from .pdf.

It seems like a breakthrough - It just works :). Great.


June 20, 2012 | Unregistered Commenter1justin

I, too, found this post while looking for an solution to the "Adobe Reader: there was an error copying to the clipboard" dialogue that was popping up every 3rd or 4th time I copied text from the Reader.

Stripping the CR/LF is just icing on the cake, for me.

Thanks, again!


July 2, 2012 | Unregistered CommenterAl Savage

Thank u very much :) Now I wanna say to myself, "WHY I DIDN'T VISITED YOUR WEBSITE BEFORE" . :) :) :)

August 18, 2012 | Unregistered CommenterShakti Singh

Thanks very much. I ran it as administrator in windows x64 it seems working now.

September 8, 2012 | Unregistered CommenterAhmet

Bitdefender market it as avirus.

September 8, 2012 | Unregistered Commenteryusuf

your script does not work for me because i'm using a dictionary which uses clipboard and when i copy something it translate the word almost all dictionaries work the same way but when the script is running it translate the word repeatedly

October 7, 2012 | Unregistered Commentery

This is awesome. Saved me a lotta time. Thanks a lot

October 14, 2012 | Unregistered CommenterRomit

there is a free downlload called easy pdf to text converter. it can be downloaded from cnet download. It is virus and malware free and it works just fine.

October 25, 2012 | Unregistered Commenterjraju

Worked a treat! Thanks!

December 3, 2012 | Unregistered CommenterLeanna

Thank you very much for sharing this wonderful tool. My preferred PDF editor is pdf-Xchange viewer. I don't think your script works for that at the moment. Please could this be included in the next update?

January 20, 2013 | Unregistered CommenterSimon

Thank you so much, saved me a mini mental breakdown

February 18, 2013 | Unregistered CommenterMaxine

Great piece of utility software. Thanks! Any plan to make the source code available for mass people?

March 3, 2013 | Unregistered CommenterAmit

great work

March 8, 2013 | Unregistered Commentersudipta

This little piece of coding art has become one of the most useful programs in my computer, standing in line with Word 2013 and Adobe Reader X. It has saved tons of time I used to waste dealing with formatting irregularities that arise while copying text from PDF files. You deserve my deepest gratitude sir! Thank you.

April 26, 2013 | Unregistered CommenterShuhrat M

Thank you so much. This is awesome.

May 2, 2013 | Unregistered CommenterTrotter

How do I remove your program from my computer???
Albert Lopez

Awesome Man, I lately found what was happening, I just couldn't get the "justify" option in MS Word to work.
For the last 3 semesters of my distance degree program, I had to submit assignments and I had to copy paste stuffs from pdf files. I had to manually edit each and every line to make it look good. I searched, I found the problem was with the Pilcrow sign at the end of each line. Then I searched further and came across your site. Thaaaanks a lot buddy, you saved me a great amount of time.
God Bless.

May 10, 2013 | Unregistered CommenterSK

For translators that work with PDFs a lot and need to copy text from source documents into dictionaries, etc., or check for other instances of source text on the internet, this is fantastic - I wonder why I never searched for it before. Thanks so much!

May 18, 2013 | Unregistered CommenterTom Kain

I kept getting the following Adobe Reader error message and found you via this link (google cache):
"There was an error while copying to the Clipboard. An internal error occurred."

Been annoying me for quite a while, and every forum I found advised to disable Skype add-on in IE, but I don't have Skype installed, and unless it resurrected itself and is hiding somewhere, I'm pretty sure I uninstalled IE a long time ago! Your little patch worked instantly!

July 2, 2013 | Unregistered Commenterzk

I used to be able to copy/past from pdf documents just fine, but in the last few months when I past into the receiving document (word file, my email, anything) it pastes the text but it removes all the spacing between words. I also think that this started happening the same time when I am selecting the text in pdf (pro) that the text becomes highlighted with green crescents (each letter & space gets a crescent where there is a flat facing left on the cresent)... I don't remember this happening before. I have to go back in and put words spacing in... quite a pain. HELP :)

August 18, 2013 | Unregistered CommenterAthur L

thanks man, your script helped me

October 5, 2013 | Unregistered Commentervasya

Works wonderfully and also appears to get rid of the annoying 'error copying' message. Thank you muchly.

November 10, 2013 | Unregistered Commenterm

Just wanted to say I've been using this for a couple of years and it has therefore saved me from countless minutes of reformatting and frustration. Thank you.

May 21, 2014 | Unregistered CommenterConor
Editor Permission Required
You must have editing permission for this entry in order to post comments.