Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

FAQ.How to save RTFD?
Answer: How to load PDF to htmlviewer on desktop?
Public Sub LoadPDFData(viewer as HTMLViewer, PDFData as string)
Dim base64string As String = EncodeBase64(PDFData)

// remove line endings to make it a big line
base64string = ReplaceLineEndings(base64string, "")

// build data URL
// https://en.wikipedia.org/wiki/Data_URI_scheme
Dim dataURL As String = "data:application/pdf;base64," + base64string

// show in webviewer

// may not work everywhere due to URL length limit
// for Web projects, use WebFile instead!
End Sub
This avoids a temporary file, which may also work.
For Web Apps, please use WebFile.

Feedback, Comments & Corrections

FAQ.How to save RTFD?
Answer: With NSTextViewMBS you can use this code to save to RTFD:
// save text as RTFD including image attachments
dim f as FolderItem = GetSaveFolderItem(FileTypes1.ApplicationRtfd, "test.rtfd")

if f = nil then Return

dim a as NSAttributedStringMBS = textView.textStorage
dim w as NSFileWrapperMBS = a.RTFDFileWrapperFromRange(0, a.length, DocumentAttributes)

dim e as NSErrorMBS
if w.writeToFile(f, e) then

MsgBox e.LocalizedDescription
end if
Notes: For TextArea you can query the underlaying NSTextViewMBS object via TextArea.NSTextViewMBS method.

Feedback, Comments & Corrections

The biggest plugin in space...

MBS FileMaker Plugins