Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
metafile problem |
Post Reply ![]() |
Author | |
RhoTu ![]() Beginner ![]() Joined: 29 Jun 09 Location: Minnesota Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() 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; |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3524 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
RhoTu ![]() Beginner ![]() Joined: 29 Jun 09 Location: Minnesota Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
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?
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3524 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
RhoTu ![]() Beginner ![]() Joined: 29 Jun 09 Location: Minnesota Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3524 |
![]() ![]() ![]() ![]() ![]() |
What i've written: You can't change the font.
Edited by Ingo - 09 Jul 09 at 3:56PM |
|
![]() |
|
RhoTu ![]() Beginner ![]() Joined: 29 Jun 09 Location: Minnesota Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
I haven't changed the font. The original TChart font is Arial. The metafile is Arial. The font when QuickPDF renders is courier.
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3524 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
RhoTu ![]() Beginner ![]() Joined: 29 Jun 09 Location: Minnesota Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
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. |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3524 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
DELBEKE ![]() Debenu Quick PDF Library Expert ![]() ![]() Joined: 31 Oct 05 Location: France Status: Offline Points: 151 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
RhoTu ![]() Beginner ![]() Joined: 29 Jun 09 Location: Minnesota Status: Offline Points: 12 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
Michel_K17 ![]() Newbie ![]() ![]() www.exp-systems.com Joined: 25 Jan 03 Status: Offline Points: 297 |
![]() ![]() ![]() ![]() ![]() |
I looked at your sample code. Nice workaround!
Thank you for the contribution. |
|
Michel
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store