pdf2htmlEX icon indicating copy to clipboard operation
pdf2htmlEX copied to clipboard

Need PDF to HTML with all images

Open cisaman opened this issue 8 years ago • 2 comments

Hi Team

Your package is awesome. I need some help in that. I have converted PDF to HTML from your package. But it will not return all images that we have in PDF separately, I want to know How can I have all images.

For e.g., I have a PDF with 3 images and I need html should have 3 images in that separately, so that I can reuse or replace those images in HTMl and later on I m converting that HTML to Image.

Please help.

Thank you in advance.

cisaman avatar Dec 08 '17 08:12 cisaman

`` #if 1 if(maskColors) return;

const char * filename = str_fmt("%s/f%llx%s", param.dest_dir.c_str(), image_count++, ".jpg");
FILE * f = fopen(filename, "wb");
if(!f)
    throw string("Cannot open file for background image " ) + filename;

std::unique_ptr<ImgWriter> writer;
writer = std::unique_ptr<ImgWriter>(new JpegWriter);
if(!writer->init(f, width, height, param.h_dpi, param.v_dpi))
    throw "Cannot initialize image writer";

ImageStream * img_stream = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits());
img_stream->reset();
for(int i = 0; i < height; ++i)
{
    auto p = img_stream->getLine();
    writer->writeRow(&p);
}

if(!writer->close())
{
    throw "Cannot finish background image";
}

fclose(f);

#endif

hkajcy avatar Jan 19 '18 07:01 hkajcy

put this in image.cc

hkajcy avatar Jan 19 '18 07:01 hkajcy