cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamically embed PDF based on path provided by report data source

RustyCage
Explorer
0 Likes
964

Hello SAP community,

I am using CR 2016 to create a contract and am trying to embed a single paged PDF which changes from contract to contract.  The report’s data source, SQL View in the case, correctly passes the path to the target PDF to the report: F:\Hunting Contracts\HuntMaps\<filename>.pdf

My issue is a very similar issue to this post which seemed to indicate this is functionality should be possible with CR 2016 but the user did not find resolution.

RustyCage_0-1743373851616.png

I have created the OLE Object two ways:

A: 

RustyCage_1-1743373893494.png

as well as

B: 

RustyCage_2-1743373913724.png

In both situations I define the default file which should only load when the dynamic path does not have a PDF to be a “No Map” file: F:\Hunting Contracts\HuntMaps\NoMap.pdf

I set Picture tab to path provided by report’s view:

RustyCage_3-1743373962588.png

When the report is previewed with data the “No Map” PDF is embedded into the report and not the target PDF.  It is at this point that I need the target singled page PDF embedded into the report instead of the default "No Map": 

RustyCage_4-1743373986416.png

I have not defined the Hyperlink tab.  A single click on the embedded "No Map" does nothing.  A double click and I’m either presented with browser to open a PDF which then opens in Adobe Reader (default app for .PDF files) or the default “No map” PDF is opened in external Adobe window; to clarify the target PDF is not used in this scenario

If I defined a hyperlink to the target file a single click on the embedded "No Map" PDF will open the target file in a separate Adobe Reader window.  I mentioned this not because a hyperlink will work, it will not, but to indicated that the target path supplies a valid file.

 

Any help or suggestions are more than appreciated.

Thanks,

Russ

 

 

 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

DonWilliams
Active Contributor
0 Likes

Hi Russ,

That is normal, Crystal Reports will only embed the PDF once and load it on Open. Same with Images.

To get this to work dynamically what you need to do is use a database field with the path the PDF file.

Then place the DB field in it's place.

And hit the F1 key to bring CR's help file and search for this:
To make a static dynamic

Don

RustyCage
Explorer
0 Likes
Thanks Don.
RustyCage
Explorer
0 Likes
Thanks Don, your response is appreciated. I believe that I'm doing what you mentioned, I have a database field with the PDF file path. when I search for "to make a static dynamic" CR provided details on how to setup the picture tab using the Graphic Location Format Editor which I'm already doing as you can see in the screenshots above.
RustyCage
Explorer
0 Likes
Does the URL need to be a
RustyCage
Explorer
0 Likes
Does the URL need to be in a specific format? I'm getting the same results using "F:\Hunting Contracts\HuntMaps\<filename>.pdf" or "\\srv19_rms_dev.cengea.local\C$\Hunting Contracts\HuntMaps\...." Both of these are valid locations
RustyCage
Explorer
0 Likes
What does "load it on Open" mean? I need the target PDF to be loaded when the document is "created" so that it is embedded in the document without the end user needing to interact with the report. My apologies for the tone of single sentence comments, all I'm seeing is an un-expandable single line text box under Don's explanation with a Comment button that gets pressed whenever the Enter key is pressed, mistakenly or not. thx R
DonWilliams
Active Contributor
0 Likes
That is the way Comment works, not sure why SAP did it this way???? Not very good user interface for commenting, you have to enter somethign andf then edit it....
DonWilliams
Active Contributor
0 Likes

What load it on open means is when CR SDK opens a report it loads the image saved int he RPT file and stops processing it... Refreshing will not reload the image or PDF if it's a static object at this point.

By linking the PDF using a database field CR Viewer will load the object on refresh, no matter what it's linked to when originally designed. If it doesn't have access to the DB then the default object is shown, the one when you designed the report.

So to clarify, when you design/create the report and embed the PDF CR converts the PDF into a BMP image file, that is why when you refresh it doesn't reload the file.

By using a formula field with the database field dropped into the formula that points to the OLE Object dynamically when viewing the report CR will query the DB for the location of the PDF file and display the new PDF file. If it's not found or doesn't have access to the folder CR will display the original PDF.

CR uses security on your PC, so make sure the folder where the PDF's are stored has read/write permissions for the App, otherwise the default image is shown.

Hope that clarifies things...