DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How can reports be outputted as a .pdf?

I have DIAdem 9.0 and would like to generate .pdf documents from my reports. I have tried to write to Acrobat's pdf print driver but it prompts for the file name. That is not good for our target environment. Does anyone know how to create .pfd's and specify the file name via script w/o user intervention?. Thanks
0 Kudos
Message 1 of 6
(5,011 Views)
Hello DIAdemon,

I have used a freeware program PDFCreator 0.8 (http://sourceforge.net/projects/pdfcreator) in conjunction with DIAdem 9.0 which will has a great feature called "Auto Save". If you set PDFCreator as your system default printer and turn on the "Auto Save" feature, it will automatically print your report to a PDF file.

A problem with all Windows applications is that you're unable to set very detailed printer properties from the application itself - so you're not able to programmatically set the filename. Check out the PDFCreator documentation for information about their auto-generated filenames.

David Mc.
NI Applications Engineering
0 Kudos
Message 2 of 6
(5,011 Views)
Hi DIAdemon,

First of all, cute name. Very cute. Secondly, it is possible to specify the details of your print job with the "PrintName" variable.

here's an example script

'Choose PDF printer
PrintName = "winspool,DIAdem PDF Export,LPT1:"
'any other installed PDF printer driver would be ok
'like: PrintName = "winspool,CutePDF Printer,File"

'Prints pages 2 to 4
PrintRangeType = "PageEnums"
PrintFromPage = 2
PrintToPage = 4
Call PicPrint("WinPrint")

'Prints page 17
PrintRangeType = "PageEnums"
PrintFromPage = 17
PrintToPage = 17
Call PicPrint("WinPrint")


If instead you wish to print page 17, which contains a table with multiple "pages" in it, the script would need to be:

PrintRangeType = "PageEnums"
PrintFromPage = 17

PrinttoPage = 17
Call PicMaxPageCalc
For i=1 to MaxYPage 'Printing all pages of the table
CurrYPage=i
PicPrint("WinPrint")
Next


Regards,
Brad Turpin
DIAdem ProductSupport Engineer
National Instruments
0 Kudos
Message 3 of 6
(5,011 Views)
Does PDFCreator allow you to specify the path?

DIAdemon's question is a HUGE issue for us also. It is especially acute with Acrobat 6.0 Pro which I can not figure out how to make the file being created default to the current working directory. Version 5 would ask you to name the file but would default to saving it into the directory that your DIAdem dataset was opened from. Although it would be nice to programmatically specify the file name and automatically save it, this was workable. But Version 6.0 wants to always save it on the users desktop so the user has to browse to the directory they want to save it in. Can PDFCreator solve this by letting you specify the path? If specifying the filename is not possible I think I can rename the file inside our
autosequence using VBS. So my big question is can I programmatically make the file save where I want it to save using PDFcreator?
0 Kudos
Message 4 of 6
(5,011 Views)
Hmmm,

Wait, actually the above code only works with DIAdem 9.1, which is Beta now. If you would like to try this code with the 9.1 Beta, please go to www.ni.com/beta, select the DIAdem beta site, and fill out a beta profile document. If you can't access the DIAdem Beta within a few days, email me directly to remind me to look in the database and activate your Beta request (brad.turpin@ni.com).

Brad Turpin
DIAdem Product Support Engineer
National Instruments
0 Kudos
Message 5 of 6
(5,011 Views)
Hello Sarm,

Here's how I've used PDFCreator v0.8.0:

1) Install PDFCreator, then configure the auto-save feature: start up the PDFCreator print monitor, then click Printer >> Options. In the "Auto-save" section, configure the directory and hard-code a "known" filename (you'll use this in DIAdem-SCRIPT).

2) In DIAdem-SCRIPT, you can programmatically select which printer you want to print to, then instruct the report to print, then using the "known" filename rename the file to be whatever you want:

' the "known" PDF document filename configured in PDFCreator's options.
known_filename = "D:\david.pdf"

' Select the PDFCreator printer for DIAdem to print to,
' even if it's not the system default printer.
PrintName = "winspool,PDFCreat
or"

' Print all sheets in my report to the "known" PDF document (all sheets are saved in the same PDF file).
PrintRangeType = "AllPages"
Call PicPrint

' Loop until PDFCreator is done creating the "known" PDF document.
Do
fh = TextFileOpen(known_filename, TfExclusive)
Loop while fh = 0
tmpval = TextFileClose(fh)

' the new filename - we'll keep it in the same directory and name it after this channel group and append the date/time.
new_filename = Replace(known_filename, "david.pdf", GroupName(GroupDefaultGet) + Str(Now, "#yyyymmddhhnnss") + ".pdf")

' Rename the "known" PDF document using the new name.
FileRename known_filename, new_filename


I see below that Brad Turpin mentioned some information about the DIAdem beta release, this will be a great new feature!

David Mc.
NI Application Engineer
0 Kudos
Message 6 of 6
(5,011 Views)