erdomke / RtfPipe

Library for processing rich-text format (RTF) streams
MIT License
121 stars 44 forks source link

Error: Non-whitespace characters were found after the end of the file #28

Closed saf-itpro closed 3 years ago

saf-itpro commented 5 years ago

Opened RtfPipe-master solution in latest version of VS2017 and added a new WinForm project in the solution referencing RtfPipe dll from the library project. But the following line in my WinForm project gives the error shown below:

var st = Rtf.ToHtml("minimal.rtf");

Error:

Non-whitespace characters were found after the end of the file

NOTE:
I had successfully ran the following before debugging the solution:

  1. PS> Install-Package RtfPipe -Version 1.0.6980.30005

  2. build.ps1

  3. Had copied minimal.rtf file from the unit test project of the solution to the root directory of my WinForm project and have included it the project. Have also verified that the file does not contain any spaces at the end.

dollhead commented 4 years ago

I've got the same error, but for my file with .rtf extension. In my case, it was not an RTF file, but a Docx file saved as RTF.

erdomke commented 4 years ago

I'll double check again, but I don't think I was able to replicate the original error. This library can only handle RTF files, not other file formats masquerading as RTF files. You should be able to detect if a file truly is RTF by looking for the header {\rtf1. A DOCX file would start with the bytes PK since it is a zip file.

dollhead commented 4 years ago

@erdomke sure, I understand that the library handles just RTF. I was able to open my masquerading file with a library for reading docx.

The reason I wrote my previous message here is that I received the same error as OP, but obviously my case is different. So I decided to leave a feedback in case someone else will face the same error.

comth commented 4 years ago

"Have also verified that the file does not contain any spaces at the end." How did you do that? I'm having the same problem here.

isupovs commented 3 years ago

I have this problem too

piso1969 commented 3 years ago

Ho lo stesso problema