I installed the PDFCreator package and attempted to run some of the samples. Everything looks good but I am missing the getImage service - however I have a getImageFromURL service.
(1)
Is the getImage supposed to be in this package or is it replaced by the getImageFromURL service?
So, I created my own flow service attempting to use the getImageFromURL but I am getting an error
(2)
My flow service
beginPDF
getImageFromURL
(URL=/soaapps/wM8/IntegrationServer/packages/PDFCreator/pub/logo.gif)
(scalePercent=50)
addDocumentElement
(linking image to element
endPDF
convertToFile
(test.pdf)
(3) The error:
com.wm.app.b2b.server.ServiceException:
java.lang.String cannot be cast to com.nu.eai.pdf.IPdfElement
As for (1)
The samples provided - uses the service getImage - which does not seem to be in the PDFCreator package but it has a getImageFromURL service
So in (2) I’m testing the getImageFromURL using the steps specified.
And (3) shows the error I’m getting…
I’ve looked up all the posts on PDFCreator but none seems to talk about this particular problem - please can someone help.
Also, can PDFCreator be used to generate forms like purchase orders and invoices etc. using tables - the samples that work (with an getImage step) shows the use of different fonts and some auto generated tables etc.
Can someone please share experiences or other tools being used for this kind of stuff…
We are also currently investigating Birt reporting but trying to figure the best solution for our environment - also taking into consideration printing Barcoded forms etc… Can this be done using PDFCreator?
There must be someone out there generating pdf forms and/or reports out of webMethods.
Did anyone successfully implement the PDFCreator - I got the samples working but the getImage service is missing - have a getImageFromURL but getting the error I described in my previous posts…
The getImageFromURL service expects a URL but you are passing in a path to the file. I bet this service is not returning an Image object, instead it is returning either an error message or some other String which you are mapping to the addElementDocument service. We can see this from the above error message that the addElementDocument service is trying to cast a String to a pdfElement.
What is the ouput of the getImageFromURL in the pipeline when you step in while executing?
I suspected that this was so - but input to the getImageFromURL service is “URL” - which is a string and in my case (URL=/soaapps/wM8/IntegrationServer/packages/PDFCreator/pub/logo.gif) and the output is “image” which seems to be object but which actually is a the above URL (string)
The next service is addDocumentElement links pdfDocument to pdfDocument and image to element and this is where is fails with the error
I tried the URL - got the same error - will lookup the doc and let you know…
On another note regarding this PDFCreator -
classes - com.nu.eai.pdf.* - where in IS is this actually installed? - I see the itext-1.2.jar in the PDFCreator/code/jars directory - I am assuming that all pdf classes reside in this jar - am this correct?
Reason for my asking is that I am trying to test this getImageFromURL in designer and on the import com.nu.eai.pdf.* and com.lowagie.text.pdf.* I’m getting “import…cannot be resolved”
Note - when I run the PDFCreator samples that do not have the getImage… service - they work fine.
So I’m still trying to work out -
PDFCreator classes - com.nu.eai.pdf.* - where in IS should this actually be installed to become available for use in designer.
Now that I know that all the classes are in the itext-1.2.jar file - what makes this available in designer for import i.e com.nu.eai.pdf.* and com.lowagie.text.pdf.* in my own java service.
Just some more addition to this note. I was testing the getImageFromURL service and was able to get some understanding for the same. It goes as, the input to the service “imageURL” should have a URL of the image which is something like “http://localhost:5555/WmRoot/images/logo.gif” (.BMP also work). When i use the sample image form the WmRoot package’s …WmRoot/pub/images folder the service is taking the image and embedding in the doucment.
To the same effect i created a folder in the …2314PDFCreator/pub folder called images and to check i used the url in the browser as “http://localhost:5555/2314PDFCreator/images/logo.gif” which shows the image in the browser telling me that the image is accessible. But when i use the same url in the imageURL parameter of the getImageFromURL service i am getting the error “java.lang.String”. The odd thing is that when i place the same image in the WmRoot/pub/images folder the service works like a charm.
Not sure the reason for this behavior, assuming that the service can pick images from the WmRoot package’s pub/images folder only.
The reason for this is the images in the /WmRoot/pub/images folder are not protected by any ACL, they are open to Anonymous access where that is not the case with project packages.
Try copying the .access file from WmRoot/pub/images to /2314PDFCreator/pub/images, reload the package (not working try restart). Now try running the getImageFromURL, it should pickup the image file from your images folder.
Another option is you can also give full path to the file, like so:
file:/C:/xxx/xxx/images/yyy.jpg
Thanks for the information, the solution worked and i just reloaded the package instead of restarting the server.
Do you have any tutorial which can explain me how to use the services available in this package, as i am trying to use the same to generate the PDF’s with some formatting but the alignment etc is going wrong. Eg. I am trying to put a image above the header but that aint working, i might be calling the services in the wrong sequence but need some help in figuring the same out.
Sorry, I don’t know of any tutorials for this, may be somebody else might be able to help you on that. I remember there are only a small set of services available for formatting so I would suggest to experiment with each one and figure the right combination and sequence.
I think you just need to get someone with some java skills on the task. Asking a forum to remotely work out your java issue is pretty big ask.
Jars in a package’s code/jars directory are available to java services in the package (it has its own classloader). You can simply reload the package to get changes in there, no need for server restart…
As for java casting or using an API properly: best off getting a java developer to take a look, they’ll fix it quicksmart.