Copying Program Listings from PDF Documents
-
- ROM Dongle
- Posts: 9
- Joined: Mon Feb 15, 2016 11:51 am
Copying Program Listings from PDF Documents
I have been trying to get a long program listing in a PDF version of QL Today to be able to load into QPC2 and have had partial success. The method I use is to highlight the text that I want in Acrobat Reader then coy it, open Notepad and paste the text into it. I then save it as a text file then rename the file with a _bas file extension. When I load it as a Superbasic program I get error messages complaining about syntax erros etc. Is there a way to format the text before loading into Superbasic such as getting rid of DOS carriage returns and line feeds? The errors seem to occur on long lines of text with REMark statements.
-
- RWAP Master
- Posts: 2840
- Joined: Sun Nov 28, 2010 4:51 pm
- Location: Stone, United Kingdom
- Contact:
Re: Copying Program Listings from PDF Documents
I use Total Edit Pro (freeware) from http://www.codertools.com/
This allows you to format the text to change line endings, or set them when you save the file (using Save As)
This allows you to format the text to change line endings, or set them when you save the file (using Save As)
Rich Mellor
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module - add a USB printer to your QL
Also Involved in:
Icephorm
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module - add a USB printer to your QL
Also Involved in:
Icephorm
Re: Copying Program Listings from PDF Documents
A useful tool for larger listings would be pdftotext.exe, part of the pdftools set and downloadable from http://www.xpdfreader.com/download.html - This can extract text from all or selected pages of a pdf document into a txt file (you can also set the line endings to "unix" which prepares the file for QL processing).
Any Windows editor that understands Unix line endings (I prefer Sublime text, but you can also use other free text editors like the great Notepad++) can be used to eliminate OCR errors and other formatting quirks, then.
Tobias
Any Windows editor that understands Unix line endings (I prefer Sublime text, but you can also use other free text editors like the great Notepad++) can be used to eliminate OCR errors and other formatting quirks, then.
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
- NormanDunbar
- Forum Moderator
- Posts: 2284
- Joined: Tue Dec 14, 2010 9:04 am
- Location: Leeds, West Yorkshire, UK
- Contact:
Re: Copying Program Listings from PDF Documents
Another couple of problems copying code from pdfs, are:
What I like about it is that if my pc crashes, this is windows remember, unsaved files are still present when I next open the editor
Cheers,
Norm.
- Unicode. You get the code OK, but there are spaces between each character. A nightmare to fix.
- Double spaced lines. Again, a pain to fix, especially on long listing.
- Code that spans two or more pages, gets the headers, footers, footnotes, page numbers etc, all of which has to be edited out.
- This was the weirdest though, upside down code when pasted into an editor!
What I like about it is that if my pc crashes, this is windows remember, unsaved files are still present when I next open the editor
Cheers,
Norm.
Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
-
- ROM Dongle
- Posts: 9
- Joined: Mon Feb 15, 2016 11:51 am
Re: Copying Program Listings from PDF Documents
Thanks for all the replies, I will investigate. The download part of the Codertools site seems to be down at the moment.
-
- RWAP Master
- Posts: 2840
- Joined: Sun Nov 28, 2010 4:51 pm
- Location: Stone, United Kingdom
- Contact:
Re: Copying Program Listings from PDF Documents
Yes - the downloads aren't working - but can be found on archive.org - https://web.archive.org/web/20161227042 ... n_v5_7.msihenry's cat wrote:Thanks for all the replies, I will investigate. The download part of the Codertools site seems to be down at the moment.
Rich Mellor
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module - add a USB printer to your QL
Also Involved in:
Icephorm
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module - add a USB printer to your QL
Also Involved in:
Icephorm