1. Ramón San Félix Ramón
  2. PowerBuilder
  3. Monday, 27 June 2022 11:10 AM UTC

Hello, I would like to know how to use the external functions of the WINSPOOL.drv library
to be able to send a PDF directly to the printer.

I've recently achieved this thanks to a GitHub project called RawPrint, creating a Net Core library to consume in PowerBuilder.


I imagine that this should be able to be implemented directly in PowerBuilder, I don't know if someone from the community could help me.


You may wonder why I want to achieve this, it is because in 64Bit environments the Adobe Acrobat Reader Control does not work to open and print PDF's.

I have replaced with the new WebBrowser control but I have found 2 problems.

The first is that it cannot be printed without opening the dialog box and the second is that there is no event that tells us when the loading of the PDF in the control has finished and in PDFs with many pages we cannot start printing until the pdf is there 100% loaded or a blank page comes out.

Accepted Answer
Ramón San Félix Ramón Accepted Answer Pending Moderation
  1. Sunday, 22 October 2023 07:41 AM UTC
  2. PowerBuilder
  3. # Permalink

I solved this question using a .net library called Rawprint that allows direct sending of files to the printer. I leave a link to my blog in Spanish where I explain how and publish a link to an example project: 

https://rsrsystem.blogspot.com/2022/06/envio-directo-archivos-impresora-de.html

I have also published another example based on this one, which is a window with printing options for PDFs in the new web browser:

https://rsrsystem.blogspot.com/2023/05/imprimir-pdfs-con-el-nuevo-webbrowser.html

 

Comment
  1. Miguel Leeuwe
  2. Tuesday, 24 October 2023 10:26 AM UTC
El primer enlace funciona, pero el segundo no.
  1. Helpful 1
  1. Ramón San Félix Ramón
  2. Tuesday, 24 October 2023 11:23 AM UTC
It is an error when editing the message, if you select the entire link and copy and paste it into the browser it works, but I don't know why only a piece of the text has been taken as a link.



I put the two links again:



https://rsrsystem.blogspot.com/2022/06/envio-directo-archivos-impresora-de.html

https://rsrsystem.blogspot.com/2023/05/imprimir-pdfs-con-el-nuevo-webbrowser.html



I have also published the example on CodeXchange, I suppose it will be available in the next few days, it is under review by Appeon.
  1. Helpful
  1. Ramón San Félix Ramón
  2. Thursday, 26 October 2023 09:10 AM UTC
  1. Helpful
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Thursday, 30 June 2022 08:15 AM UTC
  2. PowerBuilder
  3. # 1

May be this program (pdftoprinter.exe) will be of any use.   Check the following link.

http://www.columbia.edu/~em36/pdftoprinter.html

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Monday, 27 June 2022 13:42 PM UTC
  2. PowerBuilder
  3. # 2

I've published an extensive, four-part tutorial on how to interface PB with Windows API functions:

   https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/302-interfacing-pb-applications-with-the-windows-api-part-1

   https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/303-interfacing-pb-applications-with-the-windows-api-part-2

   https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/304-interfacing-pb-applications-with-the-windows-api-part-3

   https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/305-interfacing-pb-applications-with-the-windows-api-part-4

The tutorial includes a discussion of the differences between 32-bit and 64-bit versions of API functions, with illustrative examples to assist your understanding. The memory layout of members within structures can also differ, and I discuss this as well.

That being said, please be aware there are some facets of the Windows API that do not directly or easily translate to PB. Callback functions (passing the address of a function that Windows can invoke) is one such area. I've not examined the API functions related to printing and spooler functions that Roland provided, so I cannot comment on whether or where you might experience difficulties.

It might be more helpful if you could list the WinAPI functions you are wanting to utilize from PB.

Regards, John

Comment
There are no comments made yet.
Brad Mettee Accepted Answer Pending Moderation
  1. Monday, 27 June 2022 13:40 PM UTC
  2. PowerBuilder
  3. # 3

There's a bit of a problem with this. When you open the printer as a raw device, you're not going to get any printer codes generated in the process. If your printer can take a PDF and internally convert it, you might have a chance.

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Monday, 27 June 2022 13:04 PM UTC
  2. PowerBuilder
  3. # 4
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.