This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Modern JavaScript for the Impatient and have Cay Horstmann on-line!
See this thread for details.
Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Html to PDF in Java

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all...

I have to "convert" an html file to a PFD file.

I have tried a lot of code to obtain this result, but every time I have to convert an img tag (html) to an image (into the pdf document), I have an exception (file name too long).

The img tag looks like this:

<img alt="" src=" data:image/png;base64, aiushdasybasuydboasuybdcoausydbcoasuydbvoauybadvouysdb..............."

with almost 500 charafter the encoding instruction (base64)....

How can I convert this kind of img tag into a valid image into my pdf file?

TY and BR,

Adriano.
 
Adriano Bellavita
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all...

I have found a way...

The char sequence is the base64 encodeing of the image I have to insert into the pdf file.



ENCODED_STRING is the string between img tags... In this way, I can obtain the image...

But I need a set of APIs that can obtain this result, I can't parse html manually...

Any ideas?
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure what it the exact question. Do you only want to parse the input html and retrieve the contents of the image tag?
 
Adriano Bellavita
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to parse an html file to obtain a pdf file.

But I have problems when parsing the img tags like the abovementioned.
 
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic