Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » Printing PDF files in UPP
Printing PDF files in UPP [message #18841] Sun, 26 October 2008 10:41 Go to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
First congratulations to all staff involved in UPP development. Ultimate is a very good IDE.

Sorry for that rather silly question but I am new to C++ programming and I did not find how to print PDF files directly from my application source code. I succeeded to save my report (QTF) file as a PDF file but now how to send it to the printer ? Do I have to use an external library as podofo ? I would prefer to use native UPP.

Thanking you in advance
BioBytes
Re: Printing PDF files in UPP [message #18842 is a reply to message #18841] Sun, 26 October 2008 15:53 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 693
Registered: December 2005
Location: Budapest, Hungary
Contributor
You have many options.
But the most elegant way is to use Report class from Report package. You will have "print preview" this way also.

See the Addressbook example as a reference.
Re: Printing PDF files in UPP [message #18843 is a reply to message #18842] Sun, 26 October 2008 22:20 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Thank you for your reply. I just had a look to the addressBook example and I see some way to save and load report files in my application.

I wonder also how to print pdf files avoiding Win API functions as ShellExecute which requires to set absolute path parameter.

Thank you again for your help
Re: Printing PDF files in UPP [message #18844 is a reply to message #18843] Mon, 27 October 2008 12:51 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello BioBytes

About this:
Quote:

I wonder also how to print pdf files avoiding Win API functions as ShellExecute which requires to set absolute path parameter.

it is possible to open or print a .pdf with Acrobat without knowing where the acrobat.exe program is located.

Best regards
Koldo


Best regards
Iñaki
Re: Printing PDF files in UPP [message #18854 is a reply to message #18844] Tue, 28 October 2008 20:32 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Great to learn the possibility for reading and printing a pdf file without knowing where Acrobat is installed but please what is the procedure ?

Thanks in advance for your help
Regards
Biobytes
Re: Printing PDF files in UPP [message #18855 is a reply to message #18841] Tue, 28 October 2008 21:57 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello BioBytes

Here is a sample of Windows code to open "file". If file = "sample.pdf", this will open the file with Acrobat (if it is installed and it is the by default program to open pdf). For Linux there is also a way to do it.

#if defined(PLATFORM_WIN32)
	HINSTANCE ret;
	WString fileName(file);
	ret = ShellExecuteW(NULL, L"open", fileName, NULL, L".", SW_SHOWDEFAULT);
	return (long)ret > 32;
#endif


If this is what you want I have posted some functions in http://www.ultimatepp.org/forum/index.php?t=msg&goto=188 17&#msg_18817.
In 1-2 weeks I will post a version with more functions related with computer and OS issues working in Linux and Windows.

Best regards
Koldo


Best regards
Iñaki
Re: Printing PDF files in UPP [message #18856 is a reply to message #18854] Wed, 29 October 2008 08:04 Go to previous messageGo to next message
chickenk is currently offline  chickenk
Messages: 169
Registered: May 2007
Location: Grenoble, France
Experienced Member
There exists a specific API using DDE on windows to manipulate Acrobat. The executables using this api are called pdfopen, pdfclose and pdfdde. What is cool is that you can open but also select a page or close opened Acrobat file (for example, if you want to modify it, you check if it is opened first and try to close it). I used these executables quite a lot when writing doc with LaTeX and Docbook.

Here is the source code, could be interesting :

http://www.koders.com/c/fidD0692B80DCFBDE2806A4BE8180E89188F 03B09A5.aspx

cheers
Lionel

[Updated on: Wed, 29 October 2008 08:05]

Report message to a moderator

Re: Printing PDF files in UPP [message #18874 is a reply to message #18841] Wed, 29 October 2008 21:34 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Many thanks to all of you for your pertinent advices. I just finished my application and started the testing process on the field. I chose the solution of appealing the shellexecute API as posted by koldo. I will also have a look to the code written by chickenk which is very interesting too but this will require some work from me to understand well the code.

Thank you again for your help
cheers
biobytes
Re: Printing PDF files in UPP [message #18876 is a reply to message #18841] Wed, 29 October 2008 21:51 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello BioBytes

Just to add a little bit, if you use ShellExecuteW with "print" instead of with "open" with Acrobat it will print the file.

Best regards
Koldo


Best regards
Iñaki
Re: Printing PDF files in UPP [message #18879 is a reply to message #18874] Thu, 30 October 2008 07:59 Go to previous message
chickenk is currently offline  chickenk
Messages: 169
Registered: May 2007
Location: Grenoble, France
Experienced Member
just another small note: I did not write this piece of code. Adobe did it. Wink
I simply used the executables produced by it.

good luck,
Lionel
Previous Topic: QTF table and avoiding print of the internal border
Next Topic: Print directly to selected printer
Goto Forum:
  


Current Time: Thu Mar 28 22:38:59 CET 2024

Total time taken to generate the page: 0.01349 seconds