IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  PDF creation with images

    Posted 04/08/13 04:33 AM

    Hi there,

    I am trying to create a PDF inside webMethods and found the helpful package PDFCreator (and it’s samples).

    I am required to have images inside the PDF document.

    In the PDFCreator sample ‘basicParagraph’ it references a getImage service, however this does not exist in the downloadable PDFCreator package on here (or the old wmusers for that matter).

    Does anybody know where a version of the PDFCreator package is that contains this service?

    The package version I have is 1.0 however the author (David Vilaverde) may not have versioned the package.

    Regards,

    David.


    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General


  • 2.  RE: PDF creation with images

    Posted 02/18/14 01:49 PM

    we want to creation of pdf page by using pub.flow:setRespose in this we give the contentype is applicaiton/pdf then it shows the pdf file.


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General


  • 3.  RE: PDF creation with images

    Posted 02/18/14 01:51 PM

    we want to creation of pdf page by using pub.flow:setRespose in this we give the contentype is applicaiton/pdf then it shows the pdf file.


    #webMethods
    #webMethods-General
    #Integration-Server-and-ESB


  • 4.  RE: PDF creation with images

    Posted 02/18/14 11:40 PM

    @David,

    Please explore Apache PDFBox, which seems to have that functionality.

    Ref: java - Can't add an image to a pdf using PDFBox - Stack Overflow

    HTH.

    Thanks,
    Rankesh


    #webMethods
    #webMethods-General
    #Integration-Server-and-ESB


  • 5.  RE: PDF creation with images

    Posted 03/09/14 11:43 PM

    HI there
    I have ever tried to create the PDF with image source files using this code:
    ///


    /// create PDF Document object from image source
    ///

    ///
    ///
    public PDFDocument CreateImageOnlyPDFDocumentDemo(List images)
    {
    return new PDFDocumentt(images);
    }
    YOu can also have a try.Or just google one of the PDF creater to help you out.


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General


  • 6.  RE: PDF creation with images

    Posted 06/03/14 09:09 AM

    Hi All

    This is the code which I used

    package CodeAnalysis.utils.others;

    import com.wm.data.;
    import com.wm.util.Values;
    import com.wm.app.b2b.server.Service;
    import com.wm.app.b2b.server.ServiceException;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.PageSize;
    import com.itextpdf.text.html.simpleparser.HTMLWorker;
    import com.itextpdf.text.pdf.PdfWriter;
    import com.itextpdf.tool.xml.XMLWorkerHelper;
    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.BufferedInputStream;
    import java.io.DataInputStream;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.FileWriter;
    import java.io.ByteArrayInputStream;
    import java.io.BufferedWriter;
    import java.io.InputStream;
    import java.io.StringBufferInputStream;
    import java.io.OutputStream;
    import java.io.UnsupportedEncodingException;
    import java.util.
    ;
    import java.util.regex.Pattern;
    import java.util.regex.Matcher;
    import java.awt.;
    import javax.swing.JFrame;
    import javax.swing.text.html.StyleSheet;
    import java.io.
    ;
    import java.net.;
    import javax.net.ssl.
    ;

    public final class createitextPdf_SVC

    {

    /** 
    * The primary method for the Java service
    *
    * @param pipeline
    *            The IData pipeline
    * @throws ServiceException
    */
    public static final void createitextPdf(IData pipeline) throws ServiceException {
    
    try {
    
    
    // pipeline
    IDataCursor pipelineCursor = pipeline.getCursor();
    String	Report = IDataUtil.getString( pipelineCursor, "Report" );
    String	AbsoluteFileName = IDataUtil.getString( pipelineCursor, "AbsoluteFileName" );
    pipelineCursor.destroy();
    
    Document document = new Document();
    PdfWriter writer = PdfWriter.getInstance(document,new FileOutputStream(AbsoluteFileName));
    document.open();
    XMLWorkerHelper.getInstance().parseXHtml(writer, document,new StringReader(Report));
    document.close();
    }
    catch (Exception e) {
    System.out.println("**********************Error Occured from here ***************************************************");
    e.printStackTrace();
    System.out.println("**************************************************Error Ends Here **********************************************");
    }
    
    }
    
    // --- <<IS-BEGIN-SHARED-SOURCE-AREA>> ---
    
    
    
    
    // --- <<IS-END-SHARED-SOURCE-AREA>> ---
    

    }

    Give the input Report as html string which contains all your texts and images(images with relative path of the server)
    and AbsoluteFilename as a “location\filename.pdf” in your server .
    Do download itextpdf-5.5.0 and place in <IS\lib\jars>


    #webMethods-General
    #webMethods
    #Integration-Server-and-ESB