[resolved] Problem open PDF File

Highlighted
One Star

[resolved] Problem open PDF File

Hi,
I have install the tFileOutputPDF component from  exchange.talend.com and it work great.
But when I try to open the pdf file at the end of my process, I have an error message like this one:

Starting job LaunchAPP at 10:22 09/09/2015.
[statistics] connecting to socket on port 3711
[statistics] connected
Exception in component tJava_1
java.lang.NullPointerException
at java.io.File.<init>(Unknown Source)
at lar_test.launchapp_0_1.LaunchAPP.tJava_1Process(LaunchAPP.java:1683)
at lar_test.launchapp_0_1.LaunchAPP.tMsgBox_1Process(LaunchAPP.java:1599)
at lar_test.launchapp_0_1.LaunchAPP.tRowGenerator_1Process(LaunchAPP.java:1447)
at lar_test.launchapp_0_1.LaunchAPP.runJobInTOS(LaunchAPP.java:1944)
at lar_test.launchapp_0_1.LaunchAPP.main(LaunchAPP.java:1796)
[statistics] disconnected
Job LaunchAPP ended at 10:22 09/09/2015. [exit code=1]


In the tJava

try {
Desktop.getDesktop().open(new File(((String)globalMap.get("tFileOutputPDF_1_FILE_NAME"))));
} catch (IOException e) {e.printStackTrace();}

advanced settings
import java.awt.Desktop;
import java.io.File;


If I try with just the XLS file it works without problem.

LAR_TEST.zip.zip


Accepted Solutions
Highlighted
One Star

Re: [resolved] Problem open PDF File

Hi,
Thank's I understand now Smiley Wink

I have do this to open the PDf file:

try {
Desktop.getDesktop().open(new File(context.OutputFile));
} catch (IOException e) {e.printStackTrace();}

And for the XLS


try {
Desktop.getDesktop().open(new File(((String)globalMap.get(tFileOutputDelimited_1_FILE_NAME"))));
} catch (IOException e) {e.printStackTrace();}

Idea from : Link

Thank's
Burnside.

View solution in original post


All Replies
Highlighted
Seventeen Stars

Re: [resolved] Problem open PDF File

It looks like the component does not fill the global variable correctly. Check in the source code if this var will be set or not.
To do so, select the  tFileOutputPDF component and switch to the Code tab below the job design.
Highlighted
One Star

Re: [resolved] Problem open PDF File

HI,
I don't understand very well where I must click/Go!
I have click on tFileOutputPDF, Click on Tab Run and on the tab under on the right I have choose : Debug Run.
I join the TalendJob
LaunchAPP.zip


Regards
Burnside.
Moderator

Re: [resolved] Problem open PDF File

Hi Burnside,
Next to the Designer tab there is a Code tab which enables you to visualize the code and highlights the possible language errors.

Best regards
Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
One Star

Re: [resolved] Problem open PDF File

Hi,
Thank's I understand now Smiley Wink

I have do this to open the PDf file:

try {
Desktop.getDesktop().open(new File(context.OutputFile));
} catch (IOException e) {e.printStackTrace();}

And for the XLS


try {
Desktop.getDesktop().open(new File(((String)globalMap.get(tFileOutputDelimited_1_FILE_NAME"))));
} catch (IOException e) {e.printStackTrace();}

Idea from : Link

Thank's
Burnside.

View solution in original post

Highlighted
Moderator

Re: [resolved] Problem open PDF File

Hi Burnside,

Thanks for sharing your solution with us.

Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog