How to convert HTML to PDF

- runs on Linux, 2.4.24 Kernel.
- We would like to be able convert the HTML report into a PDF file.
- Ideally we would like to use open source code for the PDF generation
We would like to be able to include both Text and Bitmaps in the PDF output
Thanks!
Message was edited by:
dragontail77

HTML to PDF with Java, using OpenOffice.org - example here: [http://www.dancrintea.ro/html-to-pdf/|http://www.dancrintea.ro/html-to-pdf/]
You can use OpenOffice.org, running as a server and command it remotely for document convertion.
Besides HTML to PDF, there are also possible other convertions:
doc --> pdf, html, txt, rtf
xls --> pdf, html, csv
ppt --> pdf, swf
Code example:
import officetools.OfficeFile; // this is my tools package
FileInputStream fis = new FileInputStream(new File("c:/test.html"));
FileOutputStream fos = new FileOutputStream(new File("c:/test.pdf"));
// suppose OpenOffice.org runs on localhost, port 8100
OfficeFile f = new OfficeFile(fis,"localhost","8100", true);
f.convert(fos,"pdf");
-----------------------------------------------------------------------------------------------------------------------------------------

Similar Messages

  • How to convert html to pdf using acrobat sdk 8.0?

    hi
    I am a beginner of acrobat sdk .
    I want to know How to use acrobat sdk 8.0 to convert html to pdf?
    herere some questions :
    1:How to support navigation inside PDF file that generated using acrobat sdk 8.0? For example: theres catalog in the top of HTML file, customer hopes can navigate inside the PDF file just like navigating inside the HTML file.
    2:How to support operating some controls in the PDF file that generated using acrobat sdk 8.0? For example: therere some drop down list and text box in HTML file, customer hopes can input text in the text box, click the drop down list to see available options in it just like in HTML file.
    Thanks in advance for any help and suggestion.

    Hello,
    I want a system to re-brand my 37 pages PDF for affiliates.
    I want a php dynamic link in the PDF online in order to personalize automatically the PDF for each affiliate. I need to change 2 links each time. The affiliate ID and the Paypal email (payment button) in page 36.
    Can you help?
    Please let me know
    Thank you
    Alex
    PS My system is online and i can give you the url if it helps.

  • Is anybody programmatically converting HTML to PDF? If so, how?

    Is anybody programmatically converting HTML to PDF? If so, how?
    With InDesign, or something else?
    As long as the application (InDesign or something else) has a command-line interface, i'd like to know about it.
    Am using .NET, but we still want to know what you're doing even if you aren't.
    Source data is HTML pages from random sources, so it's not necessarily XHTML unfortunately, though i could tidy it into a consistent form.

    thanks, but what i'm looking for here is programmatic usage -- that is, scripted or command-line -- not having a human user choosing menu options, etc
    so as to your two suggestions ...
    this would appear to be NOT programmatic ...
    > And Acrobat will install a PDF convert toolbar for Internet Explorer to do this right from the browser.
    and this might or might not be possible to program -- i don't know if people are somehow running Acrobat programmatically, would appreciate further information
    > Acrobat has a Create PDF from Web Page function

  • Convert HTML TO PDF

    Hello Experts,
    I need to convert the document type HTM to PDF then send it thru e-mail as attachment, is there any FM for this?
    I'm looking at this FM CONVERT_ABAPSPOOLJOB_2_PDF, but i think it requires a spool id and the program is required to run in foreground. Any idea?
    Thank you!

    Hi Jerome,
    Click on below two links:
    [How to convert HTML output to pdf output to save the file locally;
    [Convert HTML File to PDF;
    BR
    Dep

  • Problem with converting html to pdf using LiveCycle ES Java API

    I am using this code to convert html to pdf.
    * 1. adobe-generatepdf-client.jar
    * 2. adobe-livecycle-client.jar
    * 3. adobe-usermanager-client.jar
    * 4. adobe-utilities.jar
    * 5. wlclient.jar
    import java.io.File;
    import java.util.Properties;
    import com.adobe.idp.Document;
    import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
    import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;
    import com.adobe.livecycle.generatepdf.client.GeneratePdfServiceClient;
    import com.adobe.livecycle.generatepdf.client.HtmlToPdfResult;
    public class ConvertHTML {
       public static void main(String[] args)
            try{
            //Set connection properties required to invoke LiveCycle ES                             
            Properties connectionProps = new Properties();
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "t3://localhost:7001");
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,Service ClientFactoryProperties.DSC_EJB_PROTOCOL);       
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "WebLogic");
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
            //Create a ServiceClientFactory instance
            ServiceClientFactory factory = ServiceClientFactory.createInstance(connectionProps);
              //Create a GeneratePdfServiceClient object
            GeneratePdfServiceClient pdfGenClient = new GeneratePdfServiceClient(factory);
           //Get an HTML document to convert to a PDF document a
            String inputFileName = "http://www.adobe.com";
            //String inputFileName = "C:\\Documents and Settings\\venkat\\Desktop\\Adobe.htm";
            String securitySettings = "No Security";
            String fileTypeSettings = "Standard";
    System.out.println("one");
            //Convert HTML content to a PDF document
            HtmlToPdfResult result = pdfGenClient.htmlToPDF2(inputFileName, fileTypeSettings, securitySettings, null, null);
    System.out.println("two");         
            //Get the newly created document
            Document createdDocument = result.getCreatedDocument();
            //Save the PDF document as a PDF file
            createdDocument.copyToFile(new File("C:\\test.pdf"));
        catch (Exception e) {
            System.out.println("Error OCCURRED: " + e.getMessage());
            e.printStackTrace();
    I can able to compile this class but while running i am getting error like below.
    Error OCCURRED: Internal error.
    ALC-DSC-000-000: com.adobe.idp.dsc.DSCRuntimeException: Internal error.
            at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.doSend(EjbMessageDispatcher.java
    :160)
            at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispat
    cher.java:57)
            at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:208)
            at com.adobe.livecycle.generatepdf.client.GeneratePdfServiceClient.htmlToPDF2(GeneratePdfSer
    viceClient.java:666)
            at ConvertHTML.main(ConvertHTML.java:84)
    Caused by: java.rmi.RemoteException: Remote EJBObject lookup failed for 'ejb/Invocation'; nested exc
    eption is:
            org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 203  completed: No
            at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initialise(EjbMessageDispatcher.
    java:101)
            at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.doSend(EjbMessageDispatcher.java
    :130)
            ... 4 more
    Caused by: org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 203  completed: No
            at com.sun.corba.se.impl.logging.ORBUtilSystemException.writeErrorSend(Unknown Source)
            at com.sun.corba.se.impl.logging.ORBUtilSystemException.writeErrorSend(Unknown Source)
            at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.writeLock(Unknown Source)
            at com.sun.corba.se.impl.encoding.BufferManagerWriteStream.sendFragment(Unknown Source)
            at com.sun.corba.se.impl.encoding.BufferManagerWriteStream.sendMessage(Unknown Source)
            at com.sun.corba.se.impl.encoding.CDROutputObject.finishSendingMessage(Unknown Source)
            at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.finishSendingRequest(Unknown Sour
    ce)
            at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete1(Unkno
    wn Source)
            at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(Unknow
    n Source)
            at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(Unknown Source)
            at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.is_a(Unknown Source)
            at org.omg.CORBA.portable.ObjectImpl._is_a(Unknown Source)
            at weblogic.corba.j2ee.naming.Utils.narrowContext(Utils.java:126)
            at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContext(InitialContextFact
    oryImpl.java:94)
            at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContext(InitialContextFact
    oryImpl.java:31)
            at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:41)
            at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
            at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
            at javax.naming.InitialContext.init(Unknown Source)
            at javax.naming.InitialContext.<init>(Unknown Source)
            at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initJndiContext(EjbMessageDispat
    cher.java:213)
            at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.getJndiContext(EjbMessageDispatc
    her.java:226)
            at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initialise(EjbMessageDispatcher.
    java:87)
            ... 5 more
    can u plz give me some way to do the convertion.

    Yes Sir.....Thanks for ur suggestion.....
    But i didn't find exact solution..well..yes i found some but not exactly there were not in the way i required...I jus need to convert HTML to PDF using iText API for java.....I already used some classes in that like HTMLParser.....etc..
    So Any thing else...Any one...Sure can help me in this................

  • How to convert html file to master file in sharepoint branding

    How to convert HTML file to master file in SharePoint branding Programmatically

    Hi,
    According to your post, my understanding is that you want to convert HTML file to master file.
    You can use Design Manager to achieve it.
    On STEP 4 Edit Master Pages and clicked on the option at the top to
    Convert an HTML file to a SharePoint master page.
    Once completed, make sure the Status is set to Conversion Successful
    For more information, please refer to:
    SharePoint 2013 – Design Manager – Convert HTML to Master Page
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Trouble in fop(convert html 2 pdf) source.

    to convert html 2 pdf file I found the article from javaworld.
    (http://www.javaworld.com/javaworld/jw-04-2006/jw-0410-html.html)
    unfortunately I can't seem to find the two classes below even though import all fop 0.94 library files.
    are there something I'm missing?
    Thanks.
    import org.apache.fop.apps.Driver;
    import org.apache.fop.tools.DocumentInputSource;

    Much thanks for your timely reply.  The scanner software requires that one must scan to an application.  The configuration has to point to an executable.  In program files I must select an executable,  in this case acrobat.exe.   Have been using this for years and never have seen a problem.  Continues guidance sought.

  • How to convert file to pdf text readable?

    How to convert file to PDF text readable?

    Hey,
    Please let me know what type of file are you trying to convert.
    You might use Adobe PDF Maker or Adobe PDF printer option and export the file to PDF.
    Regards,
    Anubha

  • Acrobat 8 Professional - converting HTML to PDF

    Hi,
    I'm trying to convert a website from HTML to PDF but having problems with the directory structure. I want the new PDF version to have the same directory structure that the old HTML version has. If I can't have that, how can I impose the directory structure I want on the new PDF version ?
    thanks in advance.

    This is a major Pain in the A>>. I work in a virtual office and share a pretty high volume of PDF documents as software requirements, diagrams, etc. I almost never print to actual paper, the PDF driver was my default printer. I would hit Cmd-P, Return, print a file name, Return and presto a PDF. Now I have to mouse around and find the "save to PDF" option from some ridiculous nearly hidden list of options in a drop down button. There's no keystroke or shortcut that I can find that allows me to do this w/out mousing around.
    Sounds like Apple and Adobe ran out of time and the usability got left on the cutting room floor.
    BTW, I'm on Acrobat 8 still, so I don't even have the option to "Print to Adobe PDF" - AND if I print to landscape mode, the view isn't rotated, the document is "sitting on its side" in portrait -- very frustrating...

  • Converting HTML into PDF

    Hello ABAP Experts,
    I have a request to convert a HTML Response (FM: HTTP2_GET) into a PDF Document.
    Has any body an idea how to handle that.
    Thank you very much for you answers.
    Kind regards
    Axel

    The easiest way to convert web pages/sites into PDF is with Acrobat! Important: this is Acrobat (costs a few dollars) and not Acrobat Reader!
    Acrobat has a web capture tool. With the older version I tested there was some minor problems.
    (1) It is not recognized as a browser we support. You will have to knock out the browser checking for this to work. Look at the cl_htmlb_content->runtime_validation. The last case statement. Modify your system to temporarily comment this out. (Do not forget to place it back!).
    (2) The older version I tested with had problems to convert complex pages into PDF. The new rendering we use is to browser specific. Your milage might vary.
    Alternative could be just to "print" the page from the browser into a PDFWriter (kind of printer driver that comes with Acrobat). This actually worked very well.
    Alternative is just to make screenshots into word document and convert this into PDF.
    > Please help me ..
    With this, I think we have now helped you. In return, you can help us with a nice append (or better a small weblog) about the "huge project that was a challange". These war stories shared by the fire side makes for interesting reading, and I am sure other people would also be interested in seeing what you achieved. Looking forward to it.
    ++bcm

  • Automate converting HTML to PDF

    Hi,
    I'm using my iPad to write documents using Byword that I export using HTML (export to PDF doesn't take account of HTML headers and rendering MathJax).
    Lets say that the text file therefore is called MathJax.txt and is in the location such that it's file path is Dropbox/Byword/MathJax.txt
    This HTML file is saved straight onto my Dropbox in the current location. (i.e. Dropbox/Byword/MathJax.html )
    If anyone can help, I'm looking for a way to convert the HTML to PDF with the MathJax rendered, either with cli, applescript or automator - just some way I can activate it with Hazel.
    I've seen wkhtmltopdf which looks like it would do the bit I'm missing, but I'm not very knowledgeable and have no idea how to use it.
    Any advice would be much appreciated!
    Freddie

    There is an app version in Google code…
    https://code.google.com/p/wkhtmltopdf/
    I downloaded it & opened it & it appeared to do nothing! However I also did right click > (or ctrl+click) Show Package contents… and navigated to Contents/MacOS/wkhtmltopdf. That is a compiled binary that will run in Terminal.
    To use the binary drop it into Terminal, and then drop your PDF into there (to enter the path) and then enter a file destination & name (ensuring a space after the PDF path).
    My command looked like…
    /Volumes/wkhtmltopdf/wkhtmltopdf.app/Contents/MacOS/wkhtmltopdf /Users/dru/Desktop/pdfroff\(1\)\ Mac\ OS\ X\ Manual\ Page.html /Users/dru/Desktop/test2.pdf
    The backslashes escape the spaces & other special characters, Terminal will deal with all that if you drag & drop to create the path. The hardest part is setting the destination - it's simplest to use an existing file & delete the end part & add a new name.
    Hit return & you get a PDF, I don't know if this covers MathJax formatting, I have never heard of that sorry.
    One good thing about this is that you can automate it with Automator, Hazel or a shell script etc.
    I expect you'll need further help so ask away.
    Frankly it is a little bit kludgy, you should really download the source & compile it, but that is rather involved.
    There are a few html to PDF apps, but they appear to be $20 up to several hundred & it isn't clear if they can automate the process.
    P.S. I tested this on my 10.6 system that has lots of tools installed, so I may have items that you don't, note any errors & I'll try to help, otherwise wait for a better idea.

  • Converting HTML to PDF substitutes fonts

    Hello!
    On one of our workstations that is running Acrobat 9 Pro, whenever the user converts from an HTML document to a PDF for proofing purposes, we're getting different fonts in the output to than we had in the input. For example, any text in Arial Black in the HTML document is Arial Bold in the resultant PDF. Attached are screenshots of the before and after.
    Before:
    After:
    As these are proofs that the client is supposed to be approving, this needs to be fixed quickly. All other machines in the office can convert these to PDF just fine, so it appears to be only the one machine. I uninstalled and reinstalled the software to no avail.
    Please advise.

    Does the errant machine actually have the Font available.
    Check the list of fonts avaiable in system in the machine acting up.
    Then check in the system  on a machine working.
    If there are differences add the ones missings on the defective machine from the good machine.
    Then try.
    If a font is missing Acrobat will attempt to substitute to nearest similar font it can find.

  • Convert HTML to PDF - API or utility

    Hi community,
    Our product generates HTML reports, after that the users can edit them, and finally they want to send them via e-mail to another party. They want to send PDF document generated from that HTML. So I need to convert the HTML to PDF. Till now we did that with FOP and a xsl file we found(I don't remember where from) and improved a bit. However it becomes hard to maintain.
    Searching around the forum and Google I found out about HTMLDoc, but it is not appropriate because FAQ states that currently it cannot embed other fonts than preset ones, and I need cyrillic font support. I tried several virtual printers that print to PDF file, but I want to escape from the HTML look - like table borders, etc.
    I need a pointer to an appropriate product. Preferrably a pure java library, cross-platform because we will soon migrate from Windows to Linux, with support for external font embedding (like fop and iText). I am not limited to using only opensource and free libraries, it can be a commercial licence one.
    Please share your experience in this area and guide me to a good library
    Thanks for your time
    Mike

    Thanks for that idea ChuckBing. I will download OpenOffice and try this, it sounds good because OpenOffice seems to support both Linux and Windows.
    Unfortunately the adobe online solution turned out not to be applicable for our case since there are customers that don't have access to Internet, besides there was a note on the site that currently only US and Canada are supported(but maybe I read it wrong)??
    Thanks to all - kylias, MOD, DrClap and ChuckBing - for your participation. If OpenOffice does not solve the problem I intend to continue following the FOP path.
    Mike

  • How to convert report to PDF format

    Hi,
    Please let me know the procedure to convert reports into PDF format.
    Thanks in Advance
    Irfan Hussain

    Refer these links
    http://www.sap-img.com/bc037.htm
    http://www.members.tripod.com/abap4/Save_Report_Output_to_a_PDF_File.html
    <b>CONVERT_ABAPSPOOLJOB_2_PDF</b> FM convert abap spool output to PDF

  • Solutions for converting HTML to PDF programatically?

    to start off i should say that i am rather new to programming in java.
    here's what i am attempting to do.
    i need to write a java class that will get an HTML string as input... and needs to spit out a PDF file (or outputstream) as output. i have spent the last week or trying to accomplish this using XSL-FO and the FOP library. this solution does not work too well because XSL-FO and FOP do not handle complex table layouts very well (since they require the number of columns and column widths to be known in advance). it seems that FOP (and XSL-FO) is better suited to handling structured XML input... not something unstructured and complex as HTML.
    are there any other libraries/APIs that are out there that are specifically well suited to HTML -> PDF conversion?
    remember this needs to be done programatically, and will probably be invoked as a webservice.
    thanks,
    vivek

    #1 There are definite copyright issues with your
    software. Before you go live with anything like this,
    make sure you're not gonna get reamed.Ehh? I didn't see anything from the OP's question that implied this. Yes, if he uses it to mine commercial web sites and convert them to PDF's there's a problem, but aside from that, where's the danger?
    #2 The PDF part is the easy part. As the other poster
    said, lowagie iText can do PDF. The rendered HTML is
    a much bigger question. The smaller issue is that web
    pages are defined to fit your browser window, so
    you've got to choose a size. The much tougher problem
    is finding a decent HTML renderer in Java. In truth,
    I don't think there is one; JEditorPane is a piece of
    ****, and opera is really not a lot better. Not at all. The OP specifically mentioned web services, so we don't need to assume that Swing is involved. You can, using a 3rd party library (google for java pdf), have a servlet or jsp render its output as a PDF document.

Maybe you are looking for

  • Timeout for content

    Hello 9iAS with Portal 9.0.2 in Sun Solaris I am working with Oracle Reports Builder and Oracle Portal. I've saved my reports with JSP extension. So, I've made some portlets with these reports into PEOPLE_APP db provider. Now, when I run my pages wit

  • Forgot user password, how to reset mac pro to factory settings

    hi guys, Recently I bought a used mac OS X 10.5, am very new to mac world. i am unable to load any softwares like wireless adapters since I am unable to get the password for the previous user. Also, I would like to reset the computer to factory setti

  • I could not choose help button  to select infopackage in process chain

    while choosing info package and clicking help button, it's telling "No Data Selected". I am using service pack 17.I had searched for a note : 1062704 they are telling to apply sp15.. please help me. regards raja

  • Java connection exception

    I am trying to connect to an external server from a proxy , but I get a java.connection exception : remote host did not respond within the time out period .. how do i solve this issue ? can i explicitly set an increased time out on the connection ?

  • Library/StartupItems folder lost security settings

    After running DiskWarrior I re-started my computer and up jumped a dialog box with a message about the security settings not being set on the Library/StartupItems folder being set. Here is the System Log message: Dec 15 12:17:20 Bubbas-Computer /Syst