RTF File Uploads Lose Some Formatting

News for this website will be posted here. Mostly Technical.
Forum rules
This forum is for technical discussion regarding the portal and vore itself.

Generally speaking, if you have something that needs moderator attention, you should simply Private message Eka. That includes any bug report, error report, violation report, outage report, suggestion, feature request. Etc.

Most topics will be locked as soon as they are acknowledged. Due to the nature that not many people can do anything regarding a technical issue. In that case, if you need something unlocked for any reason. Feel free to message Eka directly.

RTF File Uploads Lose Some Formatting

Postby lutro » Sun Aug 12, 2018 12:19 pm

I've been having issues uploading RTF files to the site. When they work, they work great, matching the formatting I use without any trouble.

Technically-speaking, I use: Font size changes, bold, italic, and center alignment.

When it works, it looks like this.

When it does not work (which seems to happen when I have to re-upload the file), it ends up like this. It seems the font of choice (Calibri) doesn't appear to show (maybe? not sure). But the more important thing is that the centering is lost on the title/author/etc.

For this upload I ran into the same problem, but I found out that if I edited the submission, uploaded a different random text file, then edited it again to upload the original it works fine.

If I Download the files, all of them are 100% correct. The raw RTF has all the centering/font selection/etc. It's just however the site converts it to HTML I think, that's messing up.

Any ideas? Anyone else run into this before and know of a fix/workaround/way I can upload to prevent it from bugging out?

EDIT: I've inspected the raw HTML files that the portal generates on upload. Working upload here, broken upload here.

In the broken upload, there's a style rule up in the HTML Head that seems to be undoing the center alignment.

Code: Select all
@page { margin-left: 1.25in; margin-right: 1.25in; margin-top: 1in; margin-bottom: 1in }
P { margin-bottom: 0.08in; direction: ltr; color: #000000; text-align: left; widows: 0; orphans: 0 }
P.western { font-family: "Calibri", serif; font-size: 12pt; so-language: en-US }
P.cjk { font-family: "Arial"; font-size: 12pt; so-language: hi-IN }
P.ctl { font-family: "Liberation Serif"; font-size: 12pt; so-language: hi-IN }


Note the main P CSS rule contains "text-align: left;". If I manually remove this then the text on the file becomes centered again.

In the working upload, no such rule exists:

Code: Select all
@page { margin: 0.79in }
P { margin-bottom: 0.08in; direction: ltr; color: #000000; widows: 2; orphans: 2 }
P.western { font-family: "Calibri", serif; font-size: 14pt; so-language: en-US }
P.cjk { font-family: "Calibri"; font-size: 14pt; so-language: zh-CN }
P.ctl { font-family: "Arial"; font-size: 12pt; so-language: hi-IN }


I don't know why the uploader/converter is adding this CSS rule, but it's looking like that's the culprit for the lack of centering.
Last edited by lutro on Sun Aug 12, 2018 12:29 pm, edited 1 time in total.
User avatar
lutro
Been posting for a bit
 
Posts: 43
Joined: Fri Jul 27, 2012 6:15 pm

Re: RTF File Uploads Lose Some Formatting

Postby Eka » Sun Aug 12, 2018 12:24 pm

Overall it is best to treat the output as plain text. Don't be picky with the exact formatting. Instead of expecting it to shows exactly as you posted. Consider this an advanced copy-and-paste where you have *some* additional control to the output.

Format conversion get incredibly complicated, and the converter we use can't be accounted for all the specifics and we really don't have time to troubleshoot the hundreds of problem that require the case to case manual adjustment.
User avatar
Eka
Administrator
 
Posts: 4499
Joined: Fri May 13, 2005 10:59 pm
Location: Canada

Re: RTF File Uploads Lose Some Formatting

Postby lutro » Sun Aug 12, 2018 12:31 pm

That is fair. I did edit my parent post to include what I think the culprit is. If you ever do end up peeking into the upload/conversion process, feel free to utilize the above findings. While it would be nice to figure out what exactly the problem is, I get that supporting every facet of file upload is a non-trivial task.
User avatar
lutro
Been posting for a bit
 
Posts: 43
Joined: Fri Jul 27, 2012 6:15 pm


Return to Technical stuff