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

Write simple String data to epub #4

Open
ap-atul opened this issue Mar 5, 2023 · 5 comments
Open

Write simple String data to epub #4

ap-atul opened this issue Mar 5, 2023 · 5 comments

Comments

@ap-atul
Copy link

ap-atul commented Mar 5, 2023

I am trying to use this lib in Android app. I have bunch of api calls which returns String data. I want to write the response to EPUB file with resource being the new String and save it.

Can you give an example for above?

@jiakuan
Copy link
Contributor

jiakuan commented Mar 6, 2023

The README has an example about how to create a EPUB:
https://github.com/documentnode/epub4j#creating-an-epub-programmatically

An EPUB file is really just a zip file that compresses the HTML, CSS, and other content files into one package. So, you will need to follow the structure and create the EPUB from your response data (the content).

@ap-atul
Copy link
Author

ap-atul commented Mar 6, 2023

I have seen that example, but want to write string instead of HTML file

@jiakuan
Copy link
Contributor

jiakuan commented Mar 7, 2023

The resource can be built from a file, or data (convert your string to byte[]) directly:
https://github.com/documentnode/epub4j/blob/main/epub4j-core/src/main/java/io/documentnode/epub4j/domain/Resource.java

@Jan-Rekers
Copy link

In the README.md it states that you have to add these lines to build.gradle:

dependencies {
  implementation('io.documentnode.epub4j:epub4j-core:4.2') {
    exclude group: 'xmlpull'
  }
}

However, it should be:

    implementation('io.documentnode:epub4j-core:4.2.1') {
        exclude group: 'xmlpull'
    }

This took me some time to figure out.

Thanks for sharing your library, Jan Rekers

@jiakuan
Copy link
Contributor

jiakuan commented Feb 8, 2024

In the README.md it states that you have to add these lines to build.gradle:

dependencies {
  implementation('io.documentnode.epub4j:epub4j-core:4.2') {
    exclude group: 'xmlpull'
  }
}

However, it should be:

    implementation('io.documentnode:epub4j-core:4.2.1') {
        exclude group: 'xmlpull'
    }

This took me some time to figure out.

Thanks for sharing your library, Jan Rekers

Thanks for reporting the error, I've updated the README.md

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