tyre / gutenex

Native PDF generation for Elixir
MIT License
243 stars 35 forks source link

Error adding images to pdf #17

Open ssmlee04 opened 6 years ago

ssmlee04 commented 6 years ago

When I was trying to create an image on the pdf I get the following error messages:

** (UnicodeConversionError) invalid encoding starting at <<255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...>>
    (elixir) lib/list.ex:839: List.to_string/1
    (elixir) lib/enum.ex:1899: Enum."-join/2-lists^foldl/2-0-"/3
    (elixir) lib/enum.ex:1899: Enum.join/2
    lib/imagineer/image/png/compression/zlib.ex:27: Imagineer.Image.PNG.Compression.Zlib.decompress/1
    lib/imagineer/image/png/compression.ex:14: Imagineer.Image.PNG.Compression.decompress/1
    lib/imagineer/image/png/data_content.ex:12: Imagineer.Image.PNG.DataContent.process/1
    lib/imagineer/image/png/chunk/decoders/end.ex:6: Imagineer.Image.PNG.Chunk.Decoders.End.decode/2
    lib/imagineer/image/png.ex:60: Imagineer.Image.PNG.process/2
    lib/imagineer.ex:27: Imagineer.detect_type_and_process/1
    (gutenex) lib/gutenex/pdf/images.ex:19: Gutenex.PDF.Images.load/1
    (casplog) lib/casplog/helper.ex:39: Casplog.Helper.export_to_pdf/4
    lib/casplog/generator.exs:14: (module)
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6

The sample image I am trying to use is this one:

Wondering what could be the problem? Thanks.

chungwong commented 6 years ago

Your image is with color_type 6, which is not supported. More info at https://github.com/SenecaSystems/gutenex/issues/3