This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.
Moderators:TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
i am creating a pdf from the enhanced meta files. but after the pdf is created i am loosing the formatting from the emf's. if i have a number that is underline the underline is gone after the pdf created. here is my code and i am hoping someone will help me figure this out. Thanks.
public static string CreatePdfFromIEnhanceMetaFile(List<string> filePath, string outPath)
{
if (filePath == null)
throw new ArgumentNullException();
if (outPath == null)
throw new ArgumentNullException();
try
{
int imagePdfObject;
if (!CreateBlankDocument(out imagePdfObject))
return string.Empty;
//loop thru each individual pages and add them to our pdf blank document
foreach (string filePage in filePath)
{
Metafile metafile = new Metafile(filePage);
// Get the handle of the enhanced metafile.
IntPtr hEmf = metafile.GetHenhmetafile();
try
{
int iPdfImage;
int iPdfPage;
if (IsFailed(PdfXCFunctions.PXC_AddEnhMetafile(imagePdfObject, hEmf, out iPdfImage)))
return string.Empty;
double imageWidth;
double imageHeight;
if (IsFailed(PdfXCFunctions.PXC_GetImageDimension(imagePdfObject, iPdfImage, out imageWidth, out imageHeight)))
return string.Empty;
int updatedHeight;
int updatedWidth;
MakeProportionalSize(imageWidth, imageHeight, out updatedWidth, out updatedHeight);
if (IsFailed(PdfXCFunctions.PXC_AddPage(imagePdfObject, updatedWidth, updatedHeight, out iPdfPage)))
return string.Empty;
if (IsFailed(PdfXCFunctions.PXC_PlaceImage(iPdfPage, iPdfImage, 0, updatedHeight, updatedWidth, updatedHeight)))
return string.Empty;
}
finally
{
//delete the handle
DeleteEnhMetaFile(hEmf); //free handle
}
}
//now write to a document if we fail return empty string
if (!WriteDocumentExA(outPath, imagePdfObject))
return string.Empty;
}
catch (Exception)
{
return string.Empty;
}
return outPath;
}
Welcome to our forums and thanks for the code snippet. Can we also get a sample of an .emf and the resulting PDF please so that I can ask our devs to take a look?
Thanks for the full sample, but as it's a 9 page document with quite some text in it - can you please point us to a particular area of a particular page where the underline has disappeared so that I can pass this to my colleagues in development to take a look?
Thanks for your time and reply. You can look at the emf files FCD8566(2).emf , FCD859B(4).emf, FCD8617(9) and FCD85E2(7).emf. they all have missing underlines.
My colleague has confirmed that the issues with your files are now fixed, and the fix will apply to both the PDF Tools (and SDK), as well as the PDF XChange Editor. It will be available for you to download with the next build.
I don't have any exact date at this moment unfortunately. We will try to make it as soon as possible but there are other things that need to be done before build 313 can be released so it might be a few weeks.
Thanks for the post - I'm afraid that build 313 hasn't been released yet, as we're still working on the Editor SDK Documentation. We're looking at later this month, unless something major stops us.
Cheers,
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com