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

convert to html #6

Open
DivagoNM opened this issue Jun 19, 2024 · 6 comments
Open

convert to html #6

DivagoNM opened this issue Jun 19, 2024 · 6 comments

Comments

@DivagoNM
Copy link

hi I try convert docx to html,it works great, but the images are stored in the unoserver folfer, how i can return this images?

@socheatsok78
Copy link
Member

By default the request will response the result out put of the file after conversion.

Example:

curl -s -v \
   --request POST \
   --url http://127.0.0.1:2004/request \
   --header 'Content-Type: multipart/form-data' \
   --form "file=@/path/to/your/file.xlsx" \
   --form 'convert-to=pdf' \
   --output 'file.pdf'

@DivagoNM
Copy link
Author

yes, works perfect for me, i have a problem whe convert a doxc to html, i can use inline images, but if i use a standet html output, can donwnload images?

@DivagoNM
Copy link
Author

--form 'convert-to=html:HTML:EmbedImages' \ error 500 ?

@miikatoi
Copy link

Hi @DivagoNM,

Looks like currently unoserver does not support this. According to unoconv/unoserver#110, XHTML filter may handle it, but I couldnt make it work in this API without other errors.

As a temporary workaround I just made additional API container that handles inserting the images into the html before returning the document. You can refer to https://github.com/miikatoi/unoserver-rest-api-wrapper on how to do it.

Hope it solves your problem as well.

@miikatoi
Copy link

Updating my findings here.

XHTML filter works correctly in some cases, but raises an error in others. For example:

  • This fails with unoconvert error: exit status 1 and shows Entity: line 3: parser error : Extra content at the end of the document in logs.
  • This Succesfully converts to HTML and includes the images encoded in base64 strings as expected.

Here is the request I used:

curl -s -v \
   --request POST \
   --url http://127.0.0.1:2004/request \
   --header 'Content-Type: multipart/form-data' \
   --form 'file=@/path/to/your/file' \
   --form 'convert-to=html' \
   --form 'opts[]=--filter=XHTML Writer File' \
   --output 'output.html'

@DivagoNM
Copy link
Author

Thanks!!

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

3 participants