Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Requirement: Convert HTML file to pdf in java(In HTML , Image are encoded in base64 format)
Problem statement: I am getting output from another tool in HTML format in which images and data is present but images are in base64 format. I have to convert this HTML file to pdf with including all the data and images in proper manner.
however, i am easily able to convert html page to pdf but the images which are inside in html page (encoded in base64) are not coming in pdf
I have tried all the solution itext, flying saucer etc.. But not able to get result.
sample HTML file:
<!DOCTYPE html>`enter code here`
<html>
<h1> HTML FILE WITH BASE 64 IMAGE</h1>
<body>
<img src="data:image/gif;base64,R0lGODlhDwAPAKECAAAAzMzM/////
wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLlN48CXF8m2iQ3YmmKqVlRtW4ML
wWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw=="
alt="Base64 encoded image" width="150" height="150"/>
</body>
</html>
You should use wkhtmltopdf. It is a command line tool that you can call from your Java application. The most recent builds will allow you to generate PDFs with base64 image formats. I actually just did this today. I believe you may need the x64 version though. Best of luck sir.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I am launching a Word document using VBA in Access which will import content from the form being filled into a template document.
I have tried to use both Documents.Open and Documents.Add, both of which work, but I'm not sure which one I should be using.
(I have previously had some intermittent issues using Documents.Open, but I do wonder if that was to do with some other errors in the code.)
Can anyone advise the best way to action this in VBA?
If your goal is to create new documents from a template (whether a doc, docx, docm, dot, dotx or dotm file), which appears to be the case, then Documents.Add is what you should be using.
Usually in such a scenario the original document (the template) should not be changed - Documents.Add ensures this. Workarounds for using Documents.Open, such as saving under a different file name, are an additional step (inefficient) and can go wrong.
An additional factor, when the template is a true template (dot, dotx, dotm) is that any new document by default retains a link to the template (is "attached" to the template). This means the document can share building blocks, Ribbon UI, keyboard shortcuts and (assumging not docx) macro code stored in the template.
On the other hand, if a new document should contain (inherit) content from the "template" such as macros, Ribbon UI or keyboard shortcuts present in the "template" Documents.Add would need to be used with document (doc, docx, docm) file as template.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have been working on a very simple thing for a while now, everything looks and works just fine when I just view the file locally. I used dreamweaver and dreamweavers preview works just as well in both firefox, IE and chrome.
My home0.png is supposed to change to home1.png when on mouseover and that's happening when viewed locally.
I uploaded all the files to a temporary host, and all is working except for the mouseover function. On mouseover is shows an error image.
I have split the image above in three parts;
The above part is what is doing live, when hosted
The middle parts is what is is supposed to do and what is is doing in DW preview and when viewed locally on my pc.
The third part is the code I used.
Can anyone spot the fault?
If your file structure is something like:
-views
-index.html
-file2.html
....
-IMG
-HOME0.png
-HOME1.png
you must add / to your img path:
/IMG/HOMEx.png
TIP: Set better the name of files and folders to lowercase.
Try to change this part
onmouseover="this.src='IMG/HOME1.PNG'"
to this:
onmouseover="this.src='IMG/HOME1.png'"
Just change .png from uppercase to lowercase
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I followed the guide here and I've done some Googling to no avail. Would someone mind pointing out the embarrassing blunder in my implementation here?
<!doctype html>
<html>
<body>
<img src="bonsai_tree.jpg" alt="tree" width="511" height="482">
</body>
</html>
The image is in the same directory as the html and I've triple-checked the name. I get a broken link image box when I render the page.
Thanks, and if I'm not following the proper question-asking protocol, please let me know! First-timer here...
EDIT: For what it's worth, I'm using a school-provided appliance running Linux. I don't believe this should be a problem, though I suppose I could be wrong.
Ive been there before :-)
Usually the syntax you have is correct is the picture is in the same file, just double check the spelling.
Here's a link to a fully detailed way on how to get a picture showing on your web page :
http://www.w3schools.com/html/html_images.asp
Good luck!
Open up the page, and then View Source on the html in the browser. Find the link to the image and click it- the error that it gives will tell you the problem.
It sounds like it's most likely permissions. Check the file permissions on the image file. It sounds like they're too low for you to view the file in the browser. I believe you need 604 permissions for it to be able to be used.
In a Linux terminal in that folder, run chmod 604 bonsai_tree.jpg to set the permissions correctly.
Bring up the image correctly in another tab in your browser.
Then go to the tab with your HTML, right click on the broken image, select "View Image". Compare the bad URL of this tab with the good URL of the other tab and your problem will be obvious.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Convert PDF to HTML
i have a website template in pdf format ? Is it possible to convert that pdf template into my HTML template?i want to get that pdf design template into an html page/template(i.e containing html tags etc) so that i could modify contents in that template.Please help me.Thank you
You can do the following :
Convert PDF to Word
Open the word file and save as HTML
Edit the HTML tags to get rid of MS tags that are not used in your
page.
or go the hard way and write the HTML page from scratch.
This question already has answers here:
Closed 13 years ago.
Possible Duplicate:
How can I convert HTML to PDF using Perl?
Does anyone know best way to convert HTML to PDF using Perl?
Is there any module available that can be used for this?
My HTML contains few images and charts which should be converted properly to PDF.
"Convert HTML to PDF" presumes there is One Right Way to render HTML. There isn't. You have to consider dozens of variables (CSS vs none, Javascript vs none, width of the "virtual browser", etc).
My company wanted to do that once (in Perl), and it turned out to be painfully difficult (enough so that we stopped bothering). I believe the most realistic proposal was to embed a copy of a web browser somewhere and have it render the HTML and print it to a PDF driver. Of course, we wanted to preserve the formatting pretty exactly.
You might visit this CPAN search for 'html pdf' for some options, though. PDF::FromHTML might suffice for your needs.