Print Page | Close Window

metafile problem

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1135
Printed Date: 03 Jul 25 at 3:30PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: metafile problem
Posted By: RhoTu
Subject: metafile problem
Date Posted: 08 Jul 09 at 9:19PM
I have a report that has a TChart that I save as a enhanced windowMetafile.  When I load it into the QuickPDF document the font (Arial) does not remain as saved.  I have the emf files showing that the saving component (TChart) saves it correctly.  When read back into quickPDF it is not Arial (courier instead) and some of the axis titles should be vertical but instead are horizontal.  Am I doing something wrong or is this a limitation of QuickPDFs metafile conversion?
 
    rcfTchart: begin
                 s:=getTempFile('.emf');
                 rcChart.SaveToMetafileEnh(s);
                 if not FileExists(s)then
                   showMessage('failed file create');
                 imgId:=doc.AddImageFromFile(s,0);
                 if imgID=0 then
                   showMessage('failed load');
                 if doc.SelectImage(imgID)=0 then
                   showMessage('failed Select Image');
                 doc.DrawImage(left,top,width,height);
                 used:=used+height;
               end;



Replies:
Posted By: Ingo
Date Posted: 08 Jul 09 at 10:18PM
Hi Rho!

That's not a metafile-problem ... It's a QuickPDF-problem ;-)
QuickPDF can't recognize / work with the included wmf-font.
What you can do is:
You can look into the wmf very easy with any text-editor. You can see the inserted fontnames.
So as a workaround: Read the wmf first. Check the fonts. Create a new pdf. add the fonts as truetype. Then render the wmf to the new pdf. Then do the save. This works.
What you can't do this way is working with different fonts in one wmf.

Cheers, Ingo
 


Posted By: RhoTu
Date Posted: 08 Jul 09 at 10:44PM
I saved the metafile, then
 
  ArialFont:=addTrueTypeFont('Arial',1);
  doc.SelectFont(ArialFont);
  showMessage(doc.fontName);  // displays 'Arial'
  imgId:=doc.AddImageFromFile(s,0);
None of the fonts are changed.
Did I understand you correctly?


 


Posted By: Ingo
Date Posted: 09 Jul 09 at 6:50AM
Hi!

You can't change the font in the metafile!
You can look in the metafile to check the font ...
and you can use the same or a similar font with addtruetypefont to render the metafile-content onto a new pdf-document.
You can use a completely different font to render the metafile-content with another font onto the pdf.

Cheers, Ingo



Posted By: RhoTu
Date Posted: 09 Jul 09 at 1:36PM
Thanks Ingo but I did not change the font in the metafile, I added the 'Arial' font to the pdf.  As you can see from the code I tried what was suggested and it does not work.


Posted By: Ingo
Date Posted: 09 Jul 09 at 3:56PM
What i've written: You can't change the font.


Posted By: RhoTu
Date Posted: 09 Jul 09 at 4:03PM
I haven't changed the font.  The original TChart font is Arial.  The metafile is Arial.  The font when QuickPDF renders is courier.
 
 


Posted By: Ingo
Date Posted: 09 Jul 09 at 4:29PM
Hi Rho!

You can add some truetype fonts...
Additonally you have to select the font you want to use. Please keep in mind that you can add many fonts ... the one you have selected will be used for your next code parts. Please read the online documentation at www.quickpdf.org.

Cheers, Ingo


Posted By: RhoTu
Date Posted: 09 Jul 09 at 5:23PM
Ingo,  did you take time to read the code I posted? 
 
I did add the font to the pdf:
  ArialFont:=doc.addTrueTypeFont('Arial',1);
 
I did select the font:
  doc.SelectFont(ArialFont);
 
I tested to make sure the font was selected before adding the metafile to the document:
  showMessage(doc.fontName);  // displays 'Arial'
  imgId:=doc.AddImageFromFile(s,0);
I have read the documentation.
 
I know you are trying to help but it seems you don't actually read the posts.


Posted By: Ingo
Date Posted: 09 Jul 09 at 7:22PM
Hi Rho!

I don't have anything from my help.
BTW: I'm doing this in my freetime.
Perhaps i've overseen something in your code but this don't give you the right to ... ;-)

If there's no help for you here (from users) you should go there:
http://www.quickpdflibrary.com/support/support-query.php

Cheers, Ingo



Posted By: DELBEKE
Date Posted: 10 Jul 09 at 6:25AM
Hello
The last release of QuickPdf library has 2 new functions that can do the trick
GetCanvasDC and LoadFromCanvasDC
first use GetCanvasDC to obtain a handle
then use PlayEnhMetatafile (GDI function) with this handle
finaly use LoadFromCanvasDC
At this momment , you have a handle on a loaded image you can draw anywhere in the pdf
read the last documentation for the parmeters.


Posted By: RhoTu
Date Posted: 10 Jul 09 at 3:50PM
Thanks for all the help.  I have posted a code snippet of a different approach that accomplishes what I was seeking in the code examples section.
 
RT


Posted By: Michel_K17
Date Posted: 11 Jul 09 at 1:51PM
I looked at your sample code. Nice workaround!

Thank you for the contribution.



-------------
Michel



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk