Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Are there any way to convert from DOC to JSON? #19

Open
byteshiva opened this issue Oct 4, 2021 · 4 comments
Open

Are there any way to convert from DOC to JSON? #19

byteshiva opened this issue Oct 4, 2021 · 4 comments

Comments

@byteshiva
Copy link

I have some Word DOC files from which I'd like to generate Pdf on the client side. Is it possible to generate the JSON as per the wasm-pdf structure?

@jussiniinikoski
Copy link
Owner

Hi there! Unfortunately wasm-pdf doesn't have that capability. Microsoft has this tool but it's written in Python.

@byteshiva
Copy link
Author

byteshiva commented Oct 5, 2021

Hi there! Unfortunately wasm-pdf doesn't have that capability. Microsoft has this tool but it's written in Python.

Thanks,

I converted a Docx file to JSON using simplify_docx, but it's not conforming to the JSON structure defined in wasm-pdf? Am I missing something here?

The conversion of Docx to JSON using simplify-docx gave the below structure.

Here is a partial JSON structure converted using simplify_docx

{
  "TYPE": "document",
  "VALUE": [
    {
      "TYPE": "body",
      "VALUE": [
        {
          "TYPE": "table",
          "VALUE": [
            {
              "TYPE": "table-row",
              "VALUE": [
                {
                  "TYPE": "table-cell",
                  "VALUE": [
                    {
                      "TYPE": "paragraph",
                      "VALUE": [
                        {
                          "TYPE": "text",
                          "VALUE": "sample text1"
                        }
                      ]
                    }
                  ]
                },
                {
                  "TYPE": "table-cell",
                  "VALUE": [
                    {
                      "TYPE": "paragraph",
                      "VALUE": [
                        {
                          "TYPE": "text",
                          "VALUE": "Mobile:"
                        }
                      ]
                    }
                  ]
                },
                {
                  "TYPE": "table-cell",
                  "VALUE": [
                    {
                      "TYPE": "paragraph",
                      "VALUE": [
                        {
                          "TYPE": "text",
                          "VALUE": " 1111111111"
                        }
                      ]
                    }
                  ]
                }
              ]
            },

@jussiniinikoski
Copy link
Owner

Yes, you'll have to process this JSON data into a format that works with wasm-pdf. This you can do with JavaScript, take a look at the examples.

@byteshiva
Copy link
Author

Yes, you'll have to process this JSON data into a format that works with wasm-pdf. This you can do with JavaScript, take a look at the examples.

Thanks, I'll try converting to format that works that with wasm-pdf.

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

No branches or pull requests

2 participants