This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Sep 3, 2013, 10:09 AM
41 Posts

Page layout convert in pdf

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 9.0
  • Role: Developer
  • Tags: Page Layout convert in pdf
  • Replies: 2

package abc;


import com.lowagie.text.DocumentException;  //get it error in this line
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.xhtmlrenderer.pdf.ITextRenderer; //get it error in this line
public class TestPdf {

 
    public static void main(String[] args) {
        // TODO Auto-generated method stub
         String File_To_Convert = "test.htm";
            //String url = new File(File_To_Convert).toURI().toURL().toString();
            URL testurl=new URL("http://www.ipillion.com/");
            String url=testurl.toString();
            System.out.println(""+url);
            String HTML_TO_PDF = "d:\\ConvertedFile.pdf";
            OutputStream os;       
            try {
                os = new FileOutputStream(HTML_TO_PDF);


            ITextRenderer renderer = new ITextRenderer();  //get it error in this line
            
            renderer.setDocument(url);      
            renderer.layout();

            renderer.createPDF(os);

            os.close();

    }catch(Exception e)
    {
        e.printStackTrace();
    }
    }

}

 

I am using above code generate the xpage page layout as it is in pdf.but i got it a error for above high-lighted lines. Please suggest me how to remove, i am searching in google and forum but there is no result. Please help me...

 

Regards

Ajeet Kumar Gupt

 


 

Sep 3, 2013, 1:39 PM
586 Posts
hmmm

I personally have no idea.  You might want to try StackOverFlow.com.  Just be sure to be detailed with your code and error message.

 

 

Sep 4, 2013, 6:59 PM
14 Posts
Page layout convert in pdf

If you are getting errors on your import lines (the first two you have noted) means your package cannot find the imports. You will need to add them to your class path. That is basic Java, and you will need to understand that to get this to work. You get your third error because it is reliant on on of the imports that is failing.

Also, you are calling a deprecated version of iText (based on the lowagie import), so you will need to use the current one. It is open-source. 

Looking at your code, it does not seem to comply at all with the examples I'm scanning at https://code.google.com/p/flying-saucer/ you will need to review the requirements there to get to what seems to be your end-goal.

Cheers,

Brian


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal