gitbook-convert icon indicating copy to clipboard operation
gitbook-convert copied to clipboard

Missing images and source code

Open ralfw opened this issue 9 years ago • 8 comments

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

ralfw avatar Feb 14 '16 12:02 ralfw

+1

derekhe avatar Feb 16 '16 01:02 derekhe

+1

peggylo avatar Mar 23 '16 04:03 peggylo

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.

salfej avatar Apr 08 '16 20:04 salfej

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

epeterson320 avatar Sep 21 '17 15:09 epeterson320

@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 avatar Sep 21 '17 17:09 salfej

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

salfej avatar Sep 21 '17 17:09 salfej

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)

timdams avatar May 18 '18 05:05 timdams

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

zhusp0 avatar Jan 14 '20 08:01 zhusp0