cancel
Showing results for 
Search instead for 
Did you mean: 

PDF in HWC

Former Member
0 Kudos

Hi,

I have a hyperlink to a PDF in one of my HTMLviews in my workflow screen. When I touch on this link (in iPad/iPhone), the HWC loads and render the PDF beautifully in its content pane. Now the issue is that I do not have a way to go back to the previous page. There is no back/cancel button. So practically this functionality is useless. Is there any way I could load the PDF in a new window? The target attribute of the A tag or the javascript window.open etc do not work in HWC. And none of the jquery mobile popups that I tried worked(most of the sample available on the Net requires a later version of jquerymobile than the 1.0 used in HWC. Please suggest a solution.

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

Dan_vL
Product and Topic Expert
Product and Topic Expert
0 Kudos

If the pdf file is simply included in the hybrid app package at say html/my.pdf, you could add a button called show_PDF and then in Custom.js add the following code.

customBeforeMenuItemClick {

    if (menuItem === "show_PDF") {

        showLocalAttachment("html/my.pdf");

        return false;

   }

}

If instead the contents of the PDF are coming as part of the workflow message from the SUP server then you could use the attachment viewer control.

Hope that helps,

Dan van Leeuwen

Former Member
0 Kudos

Thank you Dan for the response. I am just wondering if there is any equivalent of showLocalAttachment() which could load a pdf over the network!

midhun_vp
Active Contributor
0 Kudos

You can use this method for that, showAttachmentContents(BINARY, MIMETYPE, FILENAME);

Dan_vL
Product and Topic Expert
Product and Topic Expert
0 Kudos

Have a look at the attachment viewer control in the tool palette.  If you add that control onto your screen and look at its properties, you can specify an object query that will return the binary content that is your PDF.  In addition it requires either the name of the file (including extension) or the mime type so that the attachment viewer know what kind of content it is attempting to display.

You could try taking a look at the section

Using the PhoneGap API to Take a Smaller Picture in PhoneGap and Hybrid Web Container Customization Sample for 2.1 ESD #3  https://cw.sdn.sap.com/cw/docs/DOC-149428

That currently demonstrates how display an image retrieved from the SUP server and how to update that image.  It shows the picture in an image control but you could change it to use the attachment viewer control instead.