GitbookIO / gitbook-convert

CLI to convert an existing document to a GitBook.
102 stars 19 forks source link

Missing images and source code #10

Open ralfw opened 8 years ago

ralfw commented 8 years ago

Just tried to import a word document containing images and source code listings and text boxes. They were all missing. Bummer :-(

derekhe commented 8 years ago

+1

peggylo commented 8 years ago

+1

salfej commented 8 years ago

I'm importing to gitbook 2.6.7 from a docx document. Several images were not imported, but a few of them were.

Images that were imported Any image with Layout options set to "In Line with Text", with paragraph breaks before and after it on the same page. Any image with Layout Options set to "Tight" Text Wrapping.

Images that were not imported Any image that was anchored into place. Any image that partially satisfied the first import criteria but miss one or more marks (e.g. The image is surrounded by paragraph breaks, but one paragraph break is on the previous page, and the image is the start of a new page. Or, image was surrounded by paragraph breaks on the same page, but Layout Options were set to "Square / Top and Bottom" Text wrapping.)

Try these settings in Word and see if that helps.

epeterson320 commented 7 years ago

Has anyone found a fix for this? I've tried @salfej's suggestions but I can't seem to get any images to convert.

salfej commented 7 years ago

@epeterson320 , I also recall there being an issue with picture name size. If the name isn't less than 35 characters, you run the risk of creating images with duplicate names that will overwrite each other in succession during import. Try to give each image name an ID at the front like 001, 002, etc.

salfej commented 7 years ago

@epeterson320 that's actually the image description that messed that part of the import up. https://github.com/GitbookIO/gitbook-convert/issues/13

timdams commented 6 years ago

In my case, they were converted but the markdown url format was wrong. So I had to do a replace-all to fix it. All the uri's had two mistakes: a) a full path to the images (e.g. c:\book\assets\image1.png) instead of (assets\image1.png) b) wrong dashes. By changing them to forward dashes it worked: assets/image1.png)

zhusp0 commented 4 years ago

Modify source code: gitbook convert/lib/converters/docx.js Delete "imgfilename = normal.filename (imgfilename);" of docx.js