Copy text without new line + carriage return
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
-
- User
- Posts: 874
- Joined: Tue Jun 26, 2012 1:50 pm
Copy text without new line + carriage return
Hello.
Is there a way to copy text out of a PDF without line breaks (new line + carriage return)? Yesterday I had to copy a floating text consisting of columns around images and then needed to get rid of all the line breaks. I did this by copying the text to Notebook++ and then replacing all \n and \r with empty characters, but maybe there is an easier way?
Is there a way to copy text out of a PDF without line breaks (new line + carriage return)? Yesterday I had to copy a floating text consisting of columns around images and then needed to get rid of all the line breaks. I did this by copying the text to Notebook++ and then replacing all \n and \r with empty characters, but maybe there is an easier way?
- TrackerSupp-Daniel
- Site Admin
- Posts: 8588
- Joined: Wed Jan 03, 2018 6:52 pm
Re: Copy text without new line + carriage return
Hi Timur,
I think for the time being, your method is the simplest around. If I can find one to do this from directly within the editor I will come let you know
I think for the time being, your method is the simplest around. If I can find one to do this from directly within the editor I will come let you know
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Tracker Software Products (Canada) LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Re: Copy text without new line + carriage return
Hi all,
I found that at least with some PDF's, copying the text "as Rich Text" for example via context menu, can copy entire paragraphs as continuous (flowing) text without new lines and/or carriage returns.
Hth & regards
David.P
I found that at least with some PDF's, copying the text "as Rich Text" for example via context menu, can copy entire paragraphs as continuous (flowing) text without new lines and/or carriage returns.
Hth & regards
David.P
David.P
PDF-XChange Pro
PDF-XChange Pro
- Paul - Tracker Supp
- Site Admin
- Posts: 6897
- Joined: Wed Mar 25, 2009 10:37 pm
- Location: Chemainus, Canada
- Contact:
Re: Copy text without new line + carriage return
I'm not seeing any difference between copy and copy as rich text.
David - does it matter what document you copy from to get this difference?
All my copy/paste efforts past entire paragraphs appropriately. It sounds like Timur has a relatively complex layout?
David - does it matter what document you copy from to get this difference?
All my copy/paste efforts past entire paragraphs appropriately. It sounds like Timur has a relatively complex layout?
Does this happen the same way for you Timur on any document or is this a specific case?Yesterday I had to copy a floating text consisting of columns around images and then needed to get rid of all the line breaks.
Best regards
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
-
- User
- Posts: 874
- Joined: Tue Jun 26, 2012 1:50 pm
Re: Copy text without new line + carriage return
Two columns of text floating around a center image. It doesn't matter whether I copy as text or rich-text the lines are copied as seen in the original. In order to copy that to pure text in a more readable form I have to first remove the /n/r.
When I copy from Editor I also have to remove lots of "-" (words divided between lines) whereas Adobe Reader copies the text without the latter even when they appear in the original PDF. So for the time being I will use Adobe Reader to copy these kind of texts, because it saves me from removing the "-" on top of the /n/r.
When I copy from Editor I also have to remove lots of "-" (words divided between lines) whereas Adobe Reader copies the text without the latter even when they appear in the original PDF. So for the time being I will use Adobe Reader to copy these kind of texts, because it saves me from removing the "-" on top of the /n/r.
Last edited by Timur Born on Fri Apr 20, 2018 8:02 pm, edited 1 time in total.
- Paul - Tracker Supp
- Site Admin
- Posts: 6897
- Joined: Wed Mar 25, 2009 10:37 pm
- Location: Chemainus, Canada
- Contact:
Re: Copy text without new line + carriage return
Understood.
Do we have and or may we have that document to "play" with here?
Do we have and or may we have that document to "play" with here?
Best regards
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
-
- User
- Posts: 874
- Joined: Tue Jun 26, 2012 1:50 pm
Re: Copy text without new line + carriage return
You can use the following PDF, it contains several pages of similar formatting and also contains lots of "-" separated lines.
http://www.ulisses-spiele.de/download/2 ... a_261d.pdf
http://www.ulisses-spiele.de/download/2 ... a_261d.pdf
- Paul - Tracker Supp
- Site Admin
- Posts: 6897
- Joined: Wed Mar 25, 2009 10:37 pm
- Location: Chemainus, Canada
- Contact:
Re: Copy text without new line + carriage return
Thanks Timur
have a great weekend!
have a great weekend!
Best regards
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
-
- User
- Posts: 874
- Joined: Tue Jun 26, 2012 1:50 pm
Re: Copy text without new line + carriage return
In the meantime I am using an Autohotkey script that automatically strips new line + carriage return when I paste text via ALT+CTRL+V instead of CTRL+V.
- Tracker Supp-Stefan
- Site Admin
- Posts: 17908
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Copy text without new line + carriage return
Thanks for the tip Timur!
Cheers,
Stefan
Cheers,
Stefan
-
- User
- Posts: 874
- Joined: Tue Jun 26, 2012 1:50 pm
Re: Copy text without new line + carriage return
This is the AHK code I am using. It specifically looks for different cases that may or may not warrant a new line + carriage return. So paragraphs should stay intact. It also removes dashes "-" that are used to break words in two lines. Last but not least, it replaces several space characters with a single one.
I shamelessly copied the code from another source and then did a few minor edits.
I shamelessly copied the code from another source and then did a few minor edits.
Code: Select all
Paste:
; Note for following code that `r`n = newline
;Code the paragraph breaks with a special combinations
StringReplace Clipboard, Clipboard, .`r`n, -.-, All
StringReplace Clipboard, Clipboard, ?`r`n, -?-, All
StringReplace Clipboard, Clipboard, !`r`n, -!-, All
StringReplace Clipboard, Clipboard, :`r`n, -:-, All
;StringReplace Clipboard, Clipboard, `r`n`r`n, -*-, All
;Remove a dash followed by newline, since that's probably a single word across a linebreak
StringReplace Clipboard, Clipboard, -`r`n, , All
;Replace a single newline with a space
;StringReplace Clipboard, Clipboard, %A_Space% `r`n, %A_Space%, All
;StringReplace Clipboard, Clipboard, `r`n, %A_Space%, All
;Replace multiple adjacent spaces with a single one
Clipboard := RegExReplace(Clipboard, "\s+" , " ")
;Replace the paragraph break codes with newlines
StringReplace Clipboard, Clipboard, -.-, .`r`n, All
StringReplace Clipboard, Clipboard, -?-, ?`r`n, All
StringReplace Clipboard, Clipboard, -!-, !`r`n, All
StringReplace Clipboard, Clipboard, -:-, :`r`n, All
;StringReplace Clipboard, Clipboard, -*-, `r`n, All
Send ^v ;paste
return
- Will - Tracker Supp
- Site Admin
- Posts: 6815
- Joined: Mon Oct 15, 2012 9:21 pm
- Location: London, UK
- Contact:
Re: Copy text without new line + carriage return
Thanks Timur, I'm sure others will find that useful!
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com