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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Problem with font converting WMF to PDF
  FAQ FAQ  Forum Search   Register Register  Login Login

Problem with font converting WMF to PDF

 Post Reply Post Reply
Author
Message
Rick_Dev View Drop Down
Beginner
Beginner
Avatar

Joined: 25 Jan 12
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rick_Dev Quote  Post ReplyReply Direct Link To This Post Topic: Problem with font converting WMF to PDF
    Posted: 19 Jan 16 at 5:56PM
Hello,

I am trying to convert a WMF file to PDF. I've tried in my own code and now I am trying to get it to work using the demonstration script EMF to PDF.
The report engine in the programming language I use generates a WMF image for each page of a report. I want to be able to convert these images to PDF.
The problem appears related to the fonts used in the WMF file.
In the first example below, the WMF has a background image (the W2 form) and then amounts, names, etc printed in Courier New over the top of the background image.
Converting to PDF works OK, except the Courier New fields don't look correct. They are squished together.
I added this line to the "Convert EMF to PDF" script, but it did not help.
QP.AddTrueTypeFont('Courier New',1);

link to WMF:
https://dl.dropboxusercontent.com/u/13685133/UpperPark/QuickPDFSupport/W2_Page1Font.wmf
Link to generated PDF:
https://dl.dropboxusercontent.com/u/13685133/UpperPark/QuickPDFSupport/W2_Page1Font.pdf

The problem is not just with these background image type reports. Below is more of a "regular" report that also does not convert to PDF well.
https://dl.dropboxusercontent.com/u/13685133/UpperPark/QuickPDFSupport/APAgingActivity.wmf
https://dl.dropboxusercontent.com/u/13685133/UpperPark/QuickPDFSupport/APAgingActivity.pdf

Any pointers or help would be greatly appreciated. This is using Quick PDF 12.11.
(The data in the W2 report is not for a real person. Smile)

Regards,
Rick

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 19 Jan 16 at 7:41PM
Hi Rick,

please read all about AddTrueTypeFont here:
http://www.debenu.com/docs/pdf_library_reference/AddTrueTypeFont.php
After adding the font you have to select it with "SelectFont":
http://www.debenu.com/docs/pdf_library_reference/SelectFont.php

Cheers,
Ingo

Back to Top
Rick_Dev View Drop Down
Beginner
Beginner
Avatar

Joined: 25 Jan 12
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rick_Dev Quote  Post ReplyReply Direct Link To This Post Posted: 19 Jan 16 at 9:33PM
Hi Ingo,

I did not originally use SelectFont because I was not directly writing text strings to the PDF document.
Since the WMF uses the Font I thought it would be a good idea to embed it in the PDF.

Using SelectFont did not make a difference.

Any other ideas?

Thanks,
Rick
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 20 Jan 16 at 7:20PM
Hi Rick,

no... there won't be any ideas.
You've created the pdf with a standard font a bit similar to courier new.
Adding later the correct true type font to the pdf won't make a difference 'cause the font wasn't used.

The next new self created pdf will be better 'cause now you know what to do ;-)

Cheers,
Ingo

Back to Top
Rick_Dev View Drop Down
Beginner
Beginner
Avatar

Joined: 25 Jan 12
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rick_Dev Quote  Post ReplyReply Direct Link To This Post Posted: 21 Jan 16 at 1:50AM
Hi Ingo,

I am confused by your last post. I did not really create the PDF in the sense that I wrote out all of the text values and images, etc.
All I did was add a WMF file to a blank PDF and save it. I used the Convert EMF to PDF example script.
The code I used is included below.

Are you saying there is something else I should be doing to make this work?
How does ImportEMFFromFile deal with Fonts used by the WMF/EMF file?

Thanks,
Rick

// Welcome to Debenu Quick PDF Library Engine
// -------------------------------
// Use 'QP' to access the Debenu Quick PDF Library object
// Use MsgBox(string text) to display a popup dialog
// Use Preview.OpenFromFile(string filename) to load a PDF in the Preview PDF tab
// Use DisplayPDFReader(string filename) to display a PDF in the default PDF reader
// Use GetOutputFolder() to access the default output folder
// Use GetInputFolder() to access the default input folder
// -------------------------------

/* Convert an EMF/WMF image to PDF */

//Add Courier Font
QP.AddStandardFont(0);
QP.AddStandardFont(1);

eFontID = QP.AddTrueTypeFont('Courier New',1);
QP.SelectFont(eFontID);

// Load your image into memory
eImageID = QP.ImportEMFFromFile(GetInputFolder() + "W2_Page1Font.wmf", 1, 0);

// Select the imported image
QP.SelectImage(eImageID);

// Get width, height of the image
lWidth = QP.ImageWidth();
lHeight = QP.ImageHeight();

// Reformat the size of the page in the selected document
QP.SetPageDimensions(lWidth, lHeight);

// Draw the image onto the page using the specified width/height
QP.DrawImage(0, lHeight, lWidth, lHeight); 

// Store the updated PDF where you like
QP.SaveToFile(GetOutputFolder() + "W2_Page1Font.pdf");

// This line will automatically open the saved PDF in Adobe Reader.

// DisplayPDFReader(GetOutputFolder() + "tiger_emf.pdf");

// This display the resulting PDF file in the PDF Preview tab

Preview.OpenFromFile(GetOutputFolder() + "W2_Page1Font.pdf");
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 21 Jan 16 at 7:26AM
Hi Rick,
 
what i wanna tell is only that it's not enough to add a truetype font.
You should select it and use it to see some differences ;-)
 
You should try the search function of the library reference with "ImportEMFFromFile" here.
There you'll find similar community Posts ... perhaps with answers: 
 
 
 
Cheers,
Ingo

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store