Skip to Content
author's profile photo Former Member
Former Member

Image in PDF using xsl-fo

Hello everyone,

I am trying to create a PDF file using PDF renderer action block with help of xsl fo.

I am facing problem in inserting an image in PDF. I tried using xsl-fo external graphics bolck and passing its src dynamically from assignment block. But I am not getting image in PDF created. Please help me with the same.

I tried -

<fo:external-graphic src="" />

in my fo:flow

and then dynamically pass value to src.

Pls help.

Thanks,

Minakshi Soni.

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Posted on Nov 27, 2013 at 11:43 AM

    Hi Minakshi,

    I think you can try with Image loader action.

    Thanks,

    Padma

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 28, 2013 at 12:48 PM

    In the back of my memory I thought I remembered there was a way to encode images directly into the document. A quick google returns quite a few examples. Give it a shot.

    http://www.google.com/#q=xsl+fo++encoded+image

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 28, 2013 at 07:38 PM

    Thats an example that I got few years ago from Sam.

    Try this for Bitmap inside MII Webfolder:


    <fo:external-graphic src='url("/XMII/CM/Folder/Bitmap.jpg")'
    content-width="40mm" content-height="scale-to-fit" />

    Try this for Bitmap on the filessystem:

    <fo:external-graphic src='url("file:/c:/Temp/Bitmap.jpg")'

    content-width="40mm" content-height="scale-to-fit" />

    BR

    Pedro

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 23, 2013 at 07:35 AM

    Hello,

    Is anyone still active on this post? I need urgent help on this. It would really be very helpful if someone can help on this issue.

    Regards,

    Minakshi

    Add a comment
    10|10000 characters needed characters exceeded

    • Are you sure that the custom action code is not swalowing the exception and hiding the error from you? If you have an uncaught exception when the action finishes this will also appear in the Execution Logger Trace window when the transaction finishes.

      If you use System.out.println("") it will always write the string value to the NetWeaver Java logs and if you use this code it will appear in the Execution Logger Trace too:

      // This annotation tells the engine that this is an action available to execute.

      @Action(name = "ExecuteACommand", icon = "/com/sap/mii/custom/actions/filerunner/icons/scroll_run.png")

      // This annotation tells the engine that an XML output called 'Output' is going to be returned.

      // The possible ExitValue codes are: 0 for async/successful, -1 for failed, and anything else is tied to the runtime thread exit code

      @Outputs(names = { Output, OutputErr, ExitValue}, types = { VariantDataTypes.STRING, VariantDataTypes.STRING, VariantDataTypes.INTEGER })

      // This annotation tells the engine that this is the Java Swing class that defines the design time action configuration dialog

      @ConfigurationDialog(dialogClass = FileRunnerDialog.class, localizationType = ConfigurationDialogLabelLocalizationType.BUILT_IN)

      public static void executeACommand(

      // Besides the basic types, the IActionInstance interface is the only other type allowed to be

      // defined in parameter list of a custom action.

      IActionInstance inst,

      // @Input annotations are used to indicate the user modifiable inputs to this action.

      @Input(name = Command, defaultValue = "") String command,

      @Input(name = InputArgs, defaultValue = "") String args,

      @Input(name = AsyncProc, defaultValue = "true") boolean procAsync,

      @Input(name = Trace, defaultValue = "false") boolean trace)

      // Exceptions can be thrown directly from the actions without causing critical execution failures.

      // These exceptions will be caught and logged by the engine and will cause the Success flag to be set to false.

      throws InvalidVariableException {

      Process p = null;

      BufferedReader bri = null;

      BufferedReader bre = null;

      String outputText = ""; String errorText = "";

      try {

      // Verify that there is a command to run

      if(command != "") {

      if(trace) {

      inst.log( LogLevel.INFO, "Command is: "+command+" "+args); }

      ......

      Where using the instance of the action, hooks back to the runtime engine, you can generate execution trace messages that print out various informaitonal, warning, error, or fatal level messages. The LogLevel class specifies the severity and you can see the enitre action code in the above snippet in this document here:

      File Runner Custom Action

      Hope this helps,

      Sam

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.