I'm using Windows 10 with MM12.2 PDF import does not include the standalone newlines anymore. This is a very annoying issue since we would like to extract paragraphs which is now not possible. We tried other PDF import methods: PDF2TEXT which successfully keeps the additional newlines when importing the .txt file as TXT. Export using Acrobat reader with "Save as text file". When importing the file as a text file the additional newlines are present.
We need to import thousands of PDF files and the new PDF import that came with version 12.2 is accepting a lot more PDF's than before but deletes the newlines the mark paragraphs. In fact
TextCases relies on the "return/newlines" code to detect paragraphs (see:https://reference.wolfram.com/language/ref/textcontent/Paragraph.html)
so combined with the new PDF importer doesn't really makes it useful.
Are there any known options to not delete the additional newlines?
An easy example is created below.
teststring = "sentence 1\nsentence 2\n\nsentence 3\n\n\nsentence 4" (*Create a string with additional newlines*) Export["newlinepdf.pdf", teststring] (*export to PDF*) wrongstring=Import["newlinepdf.pdf", "Plaintext"] (*Import again and notice that the additional newlines are missing. This behaviour is consistent with all PDF's we tried*) Import["newlinepdf.pdf", "PlaintextLegacy"] (*The leagcy undocumented option works (but doubles the newlines)for this example but fails with other PDF's we tried (errors out)*) Subscript[#, ToString@First@ToCharacterCode[#]] & /@ (teststring // Characters)
Subscript[#, ToString@First@ToCharacterCode[#]] & /@ (wrongstr // Characters)
The imported version with "Plaintext" option