LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert jpg file in pdf

Solved!
Go to solution

Hi everyone.

I would like to convert a jpg file to pdf format.

The use of Ghostscript is preferable.

 

Tips?

0 Kudos
Message 1 of 11
(4,372 Views)

Hi wall,

 

The use of Ghostscript is preferable.Tips?

Use GhostScript!

 

Is this question LabVIEW related? Or do you just want to read the GhostScript manual?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(4,365 Views)

So everything you'll do with GS from the command line, you can do in LabVIEW with System Exec.vi... That is a missing peace that you won't find in the GS manual.

0 Kudos
Message 3 of 11
(4,349 Views)

Thanks for the reply.

The idea is just to call GS using precisely System Exec.vi but I can not make it work properly.

In input I have the path where the jpg file is saved, the name with which I want to rename the pdf and the path where to save the pdf.

Any example ?

 

Best regards

0 Kudos
Message 4 of 11
(4,336 Views)

Hi wall,

 

have you tried the same in a standard Windows command shell?

Does it work here?

Which command do you use?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 11
(4,331 Views)

@thewall1990 wrote:

 

Any example ?


Unlikely.

 

Does it work from the command line? That should be the first step.

 

If it does, then you only need to get the string passed to the System Exec.vi to match this string. I'd skip calling the System Exec.vi and use an indicator or popup to get it working. If that seems to be the problem, post what you have.

 

 

0 Kudos
Message 6 of 11
(4,329 Views)
Solution
Accepted by thewall1990

for the most simplest implementation is used jpeg2pdf.exe

Its a 43 kb executable.

 

Call is from cmd exec: cmd /c jpeg2pdf.exe "%s" -o "%s"

Where the first %s indicates the filename of the .jpg

2nd %s is the target path of the PDF

 

Location of .exe http://sourceforge.net/projects/jpeg2pdf/

Upside : no installation of other software required

Downside , the source .jpg file has to be in the same folder as the .exe to work.

Floris Reinders
Senior Project Engineer / CLA
0 Kudos
Message 7 of 11
(4,320 Views)

Thanks for the reply, I have adopted the solution proposed by mr but I still have problems.

From Windows command shell it works correctly (as you can see in the picture "cattura1" attached) but when I go to implement it on LabVIEW, it gives me the error that I reported in the picture "cattura2".

What am I doing wrong?

 

Thanks for your help

Download All
0 Kudos
Message 8 of 11
(4,288 Views)

Hi wall,

 

set the working directory with SysExec…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(4,282 Views)

Thanks for the help.

I solved the problem.

 

Very kind.

Wall

0 Kudos
Message 10 of 11
(4,277 Views)