# Convert to and from DocLang Learn how to convert PDF, Word, spreadsheet, presentation, email and other documents to DocLang (DCLG, DCLX), and DocLang documents to PDF, Word, HTML and images with GroupDocs.Conversion for .NET. ## About DocLang DocLang is an XML description of a document made for language models. It records what each element of a document is (a heading, a paragraph, a table, a picture), where it sits on its page and how its pieces connect. Learn more about the format in the [DocLang project](https://github.com/doclang-project/doclang). GroupDocs.Conversion supports two DocLang file types, both as a source and as a target, since version 26.11: | Format | Description | |---|---| | [DCLG](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.filetypes/doclangfiletype/dclg/) | Bare DocLang markup: an XML document whose root is `doclang`. It holds no picture payload. | | [DCLX](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.filetypes/doclangfiletype/dclx/) | A DocLang archive: an Open Packaging Conventions package that holds the DocLang markup, the pictures of the document and, optionally, a picture of every page. | ## Supported DocLang conversions * **To DocLang:** every document that converts to a Word format converts to DCLG and DCLX — PDF, Word-processing, spreadsheet, presentation, email and Outlook, web, eBook, image, CAD, diagram, note, page description language, project management, Publisher, GIS, XML and JSON documents, and the documents inside archives. * **From DocLang:** a DocLang document converts to every format a DOCX document converts to — PDF, Word-processing, web, image, spreadsheet, presentation, eBook, page description language (XPS, PS, PCL) and SVG. DocLang to DocLang is not supported. ## Convert to DocLang Pass [DocLangConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/doclangconvertoptions/) to the `Convert` method. By default the output is a DCLX archive that records where each element is on its page: ```csharp using (Converter converter = new Converter("sample.pdf")) { DocLangConvertOptions options = new DocLangConvertOptions(); converter.Convert("converted.dclx", options); } ``` To get bare markup, set the format to DCLG: ```csharp using (Converter converter = new Converter("sample.docx")) { DocLangConvertOptions options = new DocLangConvertOptions { Format = DocLangFileType.Dclg }; converter.Convert("converted.dclg", options); } ``` ### DocLang convert options | Option | Description | |---|---| | [Format](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/convertoptions-1/format/) | `DocLangFileType.Dclx` (default) or `DocLangFileType.Dclg`. | | [IncludeLocations](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/doclangconvertoptions/includelocations/) | Write where each element is on its page. Default is `true`. | | [IncludePageImages](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/doclangconvertoptions/includepageimages/) | Add a picture of every page to a DCLX archive. Default is `false`. | | [PageNumber](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/doclangconvertoptions/pagenumber/), [PagesCount](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/doclangconvertoptions/pagescount/) | Convert a range of consecutive pages. | | [Pages](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/doclangconvertoptions/pages/) | Convert the listed pages only. | The following example converts the first three pages of a presentation to a DCLX archive with a picture of each page: ```csharp using (Converter converter = new Converter("sample.pptx")) { DocLangConvertOptions options = new DocLangConvertOptions { IncludePageImages = true, PageNumber = 1, PagesCount = 3 }; converter.Convert("converted.dclx", options); } ``` {{< alert style="warning" >}} Bare DocLang markup cannot hold page pictures. Setting `IncludePageImages` to `true` together with `Format = DocLangFileType.Dclg` fails the conversion with `InvalidConvertOptionsException`: "DocLangConvertOptions.IncludePageImages cannot be combined with the dclg format: bare DocLang markup cannot hold page pictures. Use the dclx format for page pictures." {{< /alert >}} ## Convert from DocLang Load a DCLG or DCLX document like any other source and choose the target format: ```csharp using (Converter converter = new Converter("sample.dclx")) { PdfConvertOptions options = new PdfConvertOptions(); converter.Convert("converted.pdf", options); } ``` A DocLang document is read into a Word document first, so the page count that [GetDocumentInfo]({{< ref "conversion/net/developer-guide/basic-usage/get-document-info.md" >}}) reports is the page count of that Word document. To load a stream that has no file name, or to state the format, use [DocLangLoadOptions]({{< ref "conversion/net/developer-guide/advanced-usage/loading/load-options-for-different-document-types/load-doclang-document-with-options.md" >}}). {{< alert style="info" >}} Refer to the [API reference](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/doclangconvertoptions/) for all DocLang convert options. {{< /alert >}}