Home » Community » U++ community news and announcements » Qtf->Pdf simplified 
	
		
		
			| Qtf->Pdf simplified [message #34492] | 
			Fri, 25 November 2011 18:17   | 
		 
		
			
				
				
				  | 
					
						  
						mirek
						 Messages: 14271 Registered: November 2005 
						
					 | 
					Ultimate Member  | 
					 | 
		 
		 
	 | 
 
	
		Recently I had some minor issues with converting Qtf to Pdf in server environment. Surely, it was not that hard, but I guess dircet support is better. So it inspired two new functions: 
 
Array<Drawing> RenderPages(const RichText& txt, Size pagesize = Size(3968, 6074));
String Pdf(const RichText& txt, Size pagesize = Size(3968, 6074), int margin = 200, bool pdfa = false);
  
 
The harder part here is RenderPages, Pdf is then only simply call to PdfDraw package, using RenderPages. 
 
Qtf->Pdf is then just matter of: 
 
#include <RichText/RichText.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
	SaveFile(GetHomeDirFile("test.pdf"), Pdf(ParseQTF("[A9 Hello World!")));
}
 
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: Qtf->Pdf simplified [message #38490 is a reply to message #38485] | 
			Thu, 20 December 2012 11:46    | 
		 
		
			
				
				
				
					
						  
						lectus
						 Messages: 329 Registered: September 2006  Location: Brazil
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		| mirek wrote on Thu, 20 December 2012 02:27 |   Do you have PdfDraw package in the project? 
 
Mirek
  |  
  
 
Yes. 
 
Attached is a package that doesn't work for me. 
 
Windows 7, latest Upp nightly, VC++ 2012 Express 
		
	- 
	
 
	Attachment: test.7z
	 
	(Size: 0.66KB, Downloaded 304 times)
 
 
		
		[Updated on: Thu, 20 December 2012 11:52] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: Qtf->Pdf simplified [message #38499 is a reply to message #38498] | 
			Thu, 20 December 2012 16:54    | 
		 
		
			
				
				
				  | 
					
						  
						mirek
						 Messages: 14271 Registered: November 2005 
						
					 | 
					Ultimate Member  | 
					 | 
		 
		 
	 | 
 
	
		| lectus wrote on Thu, 20 December 2012 09:26 |  
  
BTW... is there any way to import PDF files as QTF?
  |  
  
 
Unfortunately, no, for two reasons: 
 
PDF is basically vector graphics format, while QTF is rich text format - they are not even meant to express the same thing. QTF->PDF is something like typesetting glyphs into graphics. 
 
Means, PDF could only be rendered into something graphical. Painter (and Painting) would be a good target for that, as it matches PDF quite well. Unfortunately, nobody cared to write that code so far, and for a good reason too - PDF is quite complicated. 
 
Note that basically the same thing applies to SVG too, in that case we do yet have QTF->SVG path yet. In fact, we are missing Painter->PDF and Painter->SVG etc... too   It is planned in general roadmap, but too costly to implement (I think about 1 month for Painter->PDF, Painter->SVG, 2 months for SVG->Painter, more for PDF->Painter). 
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 02:18:05 CET 2025 
 Total time taken to generate the page: 0.06037 seconds 
 |