Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra characters added to all slides when building a pro6 file #72

Closed
eapariciodev opened this issue Aug 29, 2024 · 5 comments
Closed

Comments

@eapariciodev
Copy link

return `{\\rtf1\\ansi\\ansicpg1252\\cocoartf1038\\cocoasubrtf320',{\\fonttbl\\f0\\fswiss\\fcharset0 ${font};}{\\colortbl;\\red${

I don't know anything about the RTF format, but are the ', characters after \\cocoasubrtf320 correct? I ask because when I import a pro6 document generated from this library all of my slides end up with those characters at the beginning of the text.

I'm on an M1 Mac, if that matters. I saw another issue where apparently Propresenter 7 uses the RTFData field. That led me to looking into how the RTF is generated and seeing those exact characters in the formatRtf utility method just seemed suspicious.

@ChrisMBarr
Copy link
Owner

I hate RTF so much, haha. I'll have to look into this. Can you provide some input file/data and what it generated as output?

@eapariciodev
Copy link
Author

This basic sample produces the attached file. The decoded PlainText string is fine. The decoded RTFData seemingly has the extra characters.

const pro6Xml = ProPresenter6Builder({
  slideGroups: [{ slides: ['Test 1', 'Test 2', 'Test 3'] }],
});

I had to add the .txt extension so Github would let me attach the file, but it's just the generated ProPresenter 6 doc.
test.pro6.txt

@ChrisMBarr
Copy link
Owner

Ok, finally got around to looking at this, and I think it might truly be as simple as just removing those extra character - RTF is weird to me and difficult to understand, so a lot of what I have in there was just me copy/pasting "working" RTF data and inserting the text between the formatting characters.

Something I learned recently is that ProPresenter on a Mac seems to read a different property that a Windows machine does. Those Win* properties are used by Windows, and the RTFData property seems to be used by a Mac.

<NSString rvXMLIvarName="PlainText">...</NSString>
<NSString rvXMLIvarName="RTFData">...</NSString>
<NSString rvXMLIvarName="WinFlowData">...</NSString>
<NSString rvXMLIvarName="WinFontData">...</NSString>

So I am on a Windows machine here, and from my prespective it all seemed to work but I had no idea different platforms would read things differently! So, before I commit a fix to this I will need some confirmation that this is working as I expect it to. I am using this from one of my unit tests to generate a *.pro6 file:

const builder = new v6Builder({
  properties: {
    CCLISongTitle: 'My Test Song',
  },
  slideGroups: [
    {
      label: 'Verse 1',
      slides: ['Hello World\nline 2'],
    },
  ],
});

And below are the outputs of that before and after the fix of just removing those characters from the RTF string.

📄 before.txt | 📄 after.txt

Please download these, change the file extension to pro6, import them into ProPresenter, and let me know if this fixes this issue for you or not

@eapariciodev
Copy link
Author

Yep, the "after" file looks good.

The "before" one had an extra ` at the very end of the xml and wouldn't import. Once I removed that then it imported and had the extra characters in the slide text.

@ChrisMBarr
Copy link
Owner

Cool! I'm gonna update my unit tests and publish a new release with that fix soon then. Thanks for the confirmation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants