This is about integrating external jar files in obpm. The exp file could be found in Avio-OBPM Training\Java Integration\
The jar and all its dependencies should be added. “PdfGenerator.class” is in pdf-generator.jar, but because it depends on itext-2.0.1.jar, the itext jar file should also be added.
Create a new module with name “IntegrationComponents”
Here is the code to use the java integrated.
SEP as String = Java.File.separator
imageDir as String = Fuego.Server.homeDir + SEP + "config" + SEP + "images" + SEP
logoURL as Java.Net.URL = URL(arg1 : "file:///" + imageDir + "logo.gif")
signatureURL as Java.Net.URL = URL(arg1 : "file:///" + imageDir + "approval-small.gif")
outputFilename as String = pdfDocumentPreferences.outputDirectory + "test-" + id.number + ".pdf"
sampleContent as String[] = ["This is", "some test", "document contents"]
generate(PdfGenerator, outputFilename : outputFilename, contents : sampleContent, logoImageUrl : logoURL, signatureImageURL : signatureURL)
binaryFile as Binary = BinaryFile.readToBinaryFrom(name : outputFilename)
Attachment.create(contents : binaryFile, contentType : "application/pdf", name : "test-" + id.number + ".pdf",
description : "PDF File Description", remarks : "PDF File Remarks")
description = "PDF Generated: " + format('now', mask : "h:m:s a")
Note: "generate(PdfGenerator, p1, p2, p3, p4)", the first parameter is “PefGenerator” which is actually the object which contains the method “generate”, so the Class PdfGenerator should have a “generate” method with 4 parameters.
No comments:
Post a Comment