1. Larry Peters
  2. PowerBuilder
  3. Thursday, 23 April 2020 11:58 AM UTC

Hi all,

It occurs to me that ALL Windows 10 PCs have the "Microsoft Print to PDF" printer and driver installed.

Therefore, if one could nominate the name of the folder/file where the PDF is to be stored this solves all the print to PDF problems. No need for Ghostscript, Amyuni, etc.

Does anyone know how to pass the folder/filename to the driver? Is there an API?

TIA

Larry Peters

 

Accepted Answer
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 23 April 2020 12:36 PM UTC
  2. PowerBuilder
  3. # Permalink

I have no idea if this will work:

dw_1.Object.DataWindow.Print.PrinterName = "Microsoft Print to PDF"
dw_1.Object.DataWindow.Print.FileName = "c:\temp\report.pdf"

dw_1.Print()

 

Comment
  1. ATK Gimmy Susan
  2. Saturday, 16 May 2020 09:57 AM UTC
Hi Roland.

I have tried your suggestion and it seems to work.

A question arises.

- Is it due to other tools that I have installed on my Personal or does it work alone?

Has anyone else tried?



Thanks in advance for the answers.
  1. Helpful
  1. Larry Peters
  2. Tuesday, 26 May 2020 02:26 AM UTC
Hi Roland,

I had given up on this thread and moved on.

I only came across your reply today.

Your solution works very well!

Thank You.

Best Regards

Larry
  1. Helpful
There are no comments made yet.
David Lopez Sanchez Accepted Answer Pending Moderation
  1. Monday, 11 May 2020 09:31 AM UTC
  2. PowerBuilder
  3. # 1

Hello,

You can configure the output port in your printer settings, if you configure a path with a default name .pdf, after you can then rename or copy it where you want from pb.

Select "Microsoft Print to PDF" or the renamed name of your PDF printer, then manage, then printer properties, then select the ports tab and there you can configure it.

Regards

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 23 April 2020 15:32 PM UTC
  2. PowerBuilder
  3. # 2

It appears that there isn't a way to do that using Microsoft Print to PDF.

PB 2017/2019 have NativePDF built in so you can use the SaveAs function.

Comment
There are no comments made yet.
Larry Peters Accepted Answer Pending Moderation
  1. Thursday, 23 April 2020 13:17 PM UTC
  2. PowerBuilder
  3. # 3

Thanks Roland.

I tried this earlier.

dw_1.Object.DataWindow.Print.PrinterName = "Microsoft Print to PDF" returns TRUE

dw_1.Object.DataWindow.Print.FileName = "c:\temp\report.pdf" returns FALSE

dw_1.Print(FALSE, FALSE) nevertheless opens the dialog box requesting the output filename.

 

It seems there is another setting which could be

dw_1.Object.DataWindow.Print.PrintToFile = TRUE

except that Powerbuilder does NOT have a PrintToFile attribute.

Examples I have seen in C#, etc use the FileName & PrintToFile attributes.

How do I achieve this using PB? To print a datawindow?

Best Regards

Larry

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.