LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Print VI as PDF File without Manually Input Path

Hi all,

 

I'm having a trouble with printing Front Panel VI. I can print it but it prompts the User to manually input path to where the PDF File to be saved. I'm using "Print VI Panel and Documentation". I'm not sure if I overlook the path to where I can input programmatically but until today, I cant figure it out.

 

Below I include the VI.

 

Thank you.

- Mafazi

0 Kudos
Message 1 of 12
(381 Views)

Hi.  Your "Screenshot" image is what I normally see when I go to print a VI.  I don't usually print to PDF, but when I do, Microsoft asks me where I want to save (and under what name) the resulting PDF.  In the two decades I've been using LabVIEW, I've always "done it manually", and given the PDF the name I wanted LabVIEW to use for the PDF file.  Did you try putting a name in that space ("My First Printed VI", for example)?  LabVIEW doesn't (to the best of my knowledge) know how to "guess" what you'd like the document to be named ...

 

Bob Schor

0 Kudos
Message 2 of 12
(332 Views)

The printing application (Labview, in this case) has not idea what the printer driver is going to do with the to-be-printed document.

It could also be a fax printer driver which prompts the user for the fax number of the receipient.

 

A long time ago, when the builtin PDF printer driver did not yet exist, there was FreePdfXP, a 3rd party PDF printer driver.

It had lots of options, and if I remember correctly, one could configure an output directory and naming scheme, so the driver automatically saved every print job without prompting for a filename.

 

It seems FreePDF evolved to a PDF editor, but it still includes a PDF printer driver. Maybe it still has this feature. Maybe, there's another printer driver out there.

0 Kudos
Message 3 of 12
(326 Views)

Hi Sebastian,

 

In the VI I shared, I use Quick Print which use my default printer, Microsoft to PDF Printer.

 

Those you mention needs to install other PDF Driver, is that correct? If yes, then it's not applicable to me as my server(IT) doesn't allow any installation other than default one.

 

Regardless, thanks for your input, appreciate it.

 

Thank you.

- Mafazi

0 Kudos
Message 4 of 12
(308 Views)

Hi Bob,

 

I did try what you said but resulting same. I do agree LabVIEW doesn't know what my document would name of, and where to, but I didn't find any input to where I could feed the name and path to.

 

My project is to make a form with digital signature and my idea was, I could do it with designing my VI same as the form and print it into PDF.

 

I do appreciate your input.

 

Thank you.

- Mafazi

0 Kudos
Message 5 of 12
(304 Views)

Hello, Mafazi.

 

     I'm not at all sure I understand what you want to do.  I saw that you mentioned somewhere something about printing a Front Panel (of a VI, I suppose) as a PDF.  I just did that, and am attaching the result.  Here are the steps that I took:

  • Opened LabVIEW, loaded a VI whose Front Panel I wanted to print.
  • With the Front Panel showing, I went to the "File" button and chose "Print".
  • Once there, I pushed "Next", then chose "VI documentation", and "Next".
  • On the Documentation page, I chose "Front Panel".  I then chose "Print".
  • I'm running Windows 10 (still), and have Microsoft Office (though I don't know that this is necessary).   Under the list of Printers, I chose "Microsoft Print to PDF".  I then pressed "Print".
  • This opened "Save Print Output As" (looks like File Explorer).  I found my Desktop, and chose "Test Print Front Panel" (I don't remember if I added ".pdf" or not), and then pressed "Save".
  • LabVIEW printed the Front Panel as a PDF, which I've attached.

Bob Schor

 

0 Kudos
Message 6 of 12
(277 Views)

You can put pdf filename on the clipboard, and then simulate a Ctrl + V.

See attached VI.

 

George Zou
0 Kudos
Message 7 of 12
(266 Views)

There never was an uniform way to do this, since the Windows Print API was never meant to let an application choose a filename to redirect the output too. Consequently LabVIEW has no way to do so even if it wanted to.

In old days you had various PDF print drivers that could be installed, some free, some commercial and some something in between. Most were using some form of Ghostscript as PDF engine but that was legally complicated since Ghostscript was GPL and there were many quite questionable attempts to circumvent the viral character of the GPL when trying to create a commercial PDF print driver.

The free ones usually simply acted as simple print drivers with no extra feature. Some of the non-free ones added additional features that allowed through a side channel to control settings including the filename and location to save into. This side channel could be either registry settings that the controlling application could change or a special DLL API that could be called. Each had it’s own method and creating a universal solution was impossible , since most of those drivers never recovered the cost of creating it, or there were legal problems about the license, and consequently technical and sales support declined and eventually went  away completely, leaving anyone in the rain who had relied on that specific driver. 
It’s not entirely impossible that the standard PDF driver from Microsoft has a similar side channel control but I haven't seen any such documentation, but admittingly haven’t searched thoroughly. Even if there was, my past 30 year experience in this field would make me be very cautious to use this, since such an interface, if not officially documented somewhere, is likely going to change in various ways in the future. Also the current driver may be replaced by Microsoft through a completely new one for a number of reasons, including legal, economic or change of policy. And last but not least, the side channel interface only works reliable if you never have two applications trying to use that same driver at the same time!

 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 8 of 12
(228 Views)

Hi Bob,

 

Yes, I'm aware of this but this is manually. What my intention is to automatically print the front panel with a press of a button by the User so I need to do it programmatically. The problem is I can't direct the path programmatically.

 

Why I would do like this :

1. I want to avoid the User to know the saving path to server. This could lead to file loss or sabotage maybe.

2. To reduce any unnecessary work by just a single button to print with constant setting set by me.

 

If refer to rolfk's comment, there would be nearly impossible(?) to direct the path programmatically. Then I should consider the zou's idea which is to simulate keyboard to CTRL + V to file path prompt by Windows.

 

Regardless, thank you for lending your time for this issue. I really appreciate it.

 

Thank you.

- Mafazi

0 Kudos
Message 9 of 12
(159 Views)

Hi zou,

 

I've considered that too as last resort. Since, I think, there would be no other way to redirect the path programmatically, this would be the best option to go for.

 

Thank you for your input, really appreciate it!

 

Thank you.

- Mafazi

0 Kudos
Message 10 of 12
(157 Views)