{"id":19536036,"url":"https://github.com/miyako/4d-plugin-document-converter","last_synced_at":"2026-01-30T05:02:56.547Z","repository":{"id":19527238,"uuid":"22774646","full_name":"miyako/4d-plugin-document-converter","owner":"miyako","description":"Convert different styled-text documents. Simplified version of textutil","archived":false,"fork":false,"pushed_at":"2021-11-28T19:54:09.000Z","size":10137,"stargazers_count":1,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-08T17:57:28.880Z","etag":null,"topics":["4d-plugin","doc","docx","html","rtf"],"latest_commit_sha":null,"homepage":"","language":"Rich Text Format","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miyako.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-08T23:45:55.000Z","updated_at":"2024-08-27T05:04:38.000Z","dependencies_parsed_at":"2022-08-23T20:30:58.157Z","dependency_job_id":null,"html_url":"https://github.com/miyako/4d-plugin-document-converter","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-document-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-document-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-document-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-document-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miyako","download_url":"https://codeload.github.com/miyako/4d-plugin-document-converter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240789392,"owners_count":19857818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["4d-plugin","doc","docx","html","rtf"],"created_at":"2024-11-11T02:20:46.818Z","updated_at":"2026-01-30T05:02:56.449Z","avatar_url":"https://github.com/miyako.png","language":"Rich Text Format","funding_links":[],"categories":[],"sub_categories":[],"readme":"![version](https://img.shields.io/badge/version-17%2B-3E8B93)\n![platform](https://img.shields.io/static/v1?label=platform\u0026message=mac-intel%20|%20mac-arm\u0026color=blue)\n[![license](https://img.shields.io/github/license/miyako/4d-plugin-document-converter)](LICENSE)\n![downloads](https://img.shields.io/github/downloads/miyako/4d-plugin-document-converter/total)\n\n4d-plugin-document-converter\n============================\n\nSimplified version of [textutil](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/textutil.1.html)\n\nThere is also an older [v1](https://github.com/miyako/4d-plugin-document-converter/tree/v1) branch\n\n## Syntax\n\n```\ndst:=Convert document (src;from;to;options)\n```\n\nParameter|Type|Description\n------------|------------|----\nsrc|BLOB|\nfrom|LONGINT|\nto|LONGINT|\noptions|OBJECT|JSON\ndst|BLOB|\n\n### Constants for ``from`` and ``to``\n\n```\nDocument format TXT 0 //Plain text document\nDocument format RTF 1 //Rich text format document\nDocument format HTML 3 //Hypertext Markup Language (HTML) document\nDocument format DOC 4 //Microsoft Word document\nDocument format DOCX 5 //ECMA Office Open XML text document format\nDocument format ODT 6 //OASIS Open Document text document format\nDocument format WORDML 7 //Microsoft Word XML (WordML schema) document\n```\n\n```\nDocument format RTFD 2 //Rich text format with attachments document\nDocument format WEBARCHIVE 8 //Web Kit WebArchive document\n```\n\n### Keys for ``option``\n\n```\nDOC_AUTHOR author (string)\nDOC_COPYRIGHT copyright (string)\nDOC_COMPANY company (string)\nDOC_MANAGER manager (string)\nDOC_EDITOR editor (string)\nDOC_TITLE title (string)\nDOC_SUBJECT subject (string)\nDOC_CATEGORY category (string)\nDOC_COMMENT comment (string)\nDOC_TEXT_ENCODING_NAME textEncodingName (string)\nDOC_TOP_MARGIN topMargin (number, in points)\nDOC_LEFT_MARGIN leftMargin (number, in points)\nDOC_BOTTOM_MARGIN bottomMargin (number, in points)\nDOC_RIGHT_MARGIN rightMargin (number, in points)\nDOC_CREATION_TIME creationTime (dateString)\nDOC_MODIFICATION_DATE modificationDate (dateString)\nDOC_CONVERTED converted (number, 1 or 0)\nDOC_READ_ONLY readOnly (number, 1 or 0)\nDOC_VIEW_ZOOM viewZoom (number, 100=100%)\nDOC_VIEW_SIZE viewSize ({width:number, height:number})\nDOC_VIEW_MODE viewMode (number, 1=paperSize or 0=normal)\nDOC_PAPER_SIZE paperSize ({width:number, height:number})\nDOC_BACKGROUND_COLOR backgroundColor ({red:number, green:number, blue:number, alpha:number})\nDOC_EXCLUDED_ELEMENTS excludedElements (string array)\nDOC_HYPHENATION_FACTOR hyphenationFactor (number,  0=off to 1=full)\nDOC_KEYWORDS keywords (string array)\nDOC_DEFAULT_TAB_INTERVAL defaultTabInterval (number)\nDOC_PREFIX_SPACES prefixSpaces (number)\nDOC_COCOA_VERSION cocoaVersion (number)\nDOC_BASE_URL baseURL (string)\nDOC_TIMEOUT timeout (number)\nDOC_TEXT_SIZE_MULTIPLIER textSizeMultiplier (number)\n```\n\n``DOC_BASE_URL``, ``DOC_TIMEOUT``, ``DOC_TEXT_SIZE_MULTIPLIER`` apply to ``src``. All other apply to ``dst``.\n\n## Examples\n\n* HTML to RTF\n\n```\nC_OBJECT($options)\n\nOB SET($options;DOC_TIMEOUT;60)\n\n$path:=Get 4D folder(Current resources folder)+\"sample.webarchive\"\nDOCUMENT TO BLOB($path;$src)\n\n$dst:=Convert document ($src;Document format WEBARCHIVE;Document format RTF;$options)\n\n$path:=Get 4D folder(Current resources folder)+\"sample.rtf\"\nBLOB TO DOCUMENT($path;$dst)\n```\n\n* RTF to TXT\n\n```\nC_OBJECT($options)\n\n$path:=Get 4D folder(Current resources folder)+\"sample.rtf\"\nDOCUMENT TO BLOB($path;$src)\n\n$dst:=Convert document ($src;Document format RTF;Document format TXT;$options)\n\n$path:=Get 4D folder(Current resources folder)+\"sample.txt\"\nBLOB TO DOCUMENT($path;$dst)\n```\n\n* RTF to HTML\n\n```\nC_OBJECT($options)\n\n  //html meta tags\nOB SET($options;\\\nDOC_TIMEOUT;60;\\\nDOC_AUTHOR;\"__author__\";\\\nDOC_COPYRIGHT;\"__copyright__\";\\\nDOC_COMPANY;\"__company__\";\\\nDOC_MANAGER;\"__manager__\";\\\nDOC_EDITOR;\"__editor__\";\\\nDOC_TITLE;\"__title__\";\\\nDOC_SUBJECT;\"__subject__\";\\\nDOC_CATEGORY;\"__category__\";\\\nDOC_COMMENT;\"__comment__\";\\\nDOC_TEXT_ENCODING_NAME;\"utf-8\"\\\n)\nARRAY TEXT($keywords;0)\nGET TEXT KEYWORDS(\"The quick brown fox jumps over the lazy dog\";$keywords)\nOB SET ARRAY($options;DOC_KEYWORDS;$keywords)\n\n  //background color\nC_OBJECT($color)\nOB SET($color;\"red\";1;\"green\";0;\"blue\";0.5;\"alpha\";1)\nOB SET($options;DOC_BACKGROUND_COLOR;$color)\n\n  //dates\nOB SET($options;DOC_CREATION_TIME;String(Current date;ISO date GMT;Current time))\nOB SET($options;DOC_MODIFICATION_DATE;String(Current date;ISO date;Current time))\n\n  //sizes\n  //C_OBJECT($size)\n  //OB SET($size;\"width\";100;\"height\";100)\n  //OB SET($options;DOC_PAPER_SIZE;$size;DOC_VIEW_SIZE;$size)\n\n  //URL\n  //OB SET($options;DOC_BASE_URL;\"https://developer.apple.com/\")\n\n$path:=Get 4D folder(Current resources folder)+\"sample.rtf\"\nDOCUMENT TO BLOB($path;$src)\n\n$dst:=Convert document ($src;Document format RTF;Document format HTML;$options)\n\n$path:=Get 4D folder(Current resources folder)+\"sample.html\"\nBLOB TO DOCUMENT($path;$dst)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiyako%2F4d-plugin-document-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiyako%2F4d-plugin-document-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiyako%2F4d-plugin-document-converter/lists"}