Wkhtmltopdf Project Issues convert small images to stream object page output

Source: Internet
Author: User
Tags wkhtmltopdf

Project work problems, Linux environment, using wkhtmltopdf to do HTML conversion to PDF download, the page exists picture, the converted PDF generated HTML can be used normally, the picture is normal, directly convert the generated HTML path to PDF image location, Always show blank;

Picture blank question, oneself also looked up a lot of information on the net, and did not get Ruyi result, can only retreat and seek the second oneself to find out;

own use of the solution, convenient for everyone to work with, will generate a static page template in the picture, the manual call method to convert to stream objects; in the page through To do output to get pictures;

/**     * Picture converted to string     * @param imgfile     * @return * *    /public static string Getimagestr (String imgfile) { C5/>inputstream in = null;          byte[] data = null;          try {in              = new FileInputStream (imgfile);              data = new byte[in.available ()];              In.read (data);              In.close ();          } catch (FileNotFoundException e) {              e.printstacktrace ();          } catch (IOException e) {              e.printstacktrace (); c16/>}          Base64encoder encoder = new Base64encoder ();          return Encoder.encode (data);      }

The method entry is the absolute path of the picture;

According to the specific situation of their own project analysis;

Wkhtmltopdf Project Issues convert small images to stream object page output

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.