Output to metafile

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

rioka
User
Posts: 4
Joined: Wed May 22, 2013 2:47 pm

Output to metafile

Post by rioka »

Hi

I've downloaded the evaluation version of "Viewer Simple SDK Libary", and developed a simple test application to display PDF files. So far, no problems.
Next step was to print the PDF files; this step raise no problems too.

Finally, I've tried to pass the hdc of an EMF to the PXCV_DrawPage, for we use EMF to display print previews to the user. Here we're facing some strange behavior; that's what I've found, playing with PXV_CommonRenderParameters.Flags (now F) and PXV_CommonRenderParameters.RenderTarget (now T)

- F set to 0 (raster), T set to pxvrm_Viewing:
pages are rendered with a black background; each page is generated as a single image (so generated file is frequenlty huge, even 80MB for a single page);
- F set to pxvrpf_UseVectorRenderer, T set to pxvrm_Printing:
each page contains a long list of graphics win32 API (Polybezier, LineTo, MoveToEx, BeginPath, ...), but no TextOut API, whether I also set pxvrpf_AllFontsAsCuves or not; however, when pxvrpf_AllFontsAsCuves is not set, for some file, text does not appear in the output. Moreover, final text quality is not as good as the previous case.

As a note, I know I can use this library also for print preview, but, at least for now, our print routines include preview via EMF, so we will not probably change this soon.

Anyway, printing to printers works fine, indeed.

All tests are using pxcview.dll v2.5.210.0.

Is there a way I can output a PDF to an EMF and get a nice looking result AND a reasonable file size?

TIA
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3586
Joined: Thu Jul 08, 2004 10:36 pm

Re: Output to metafile

Post by Ivan - Tracker Software »

I would recommend to set Flags to (pxvrpf_UseVectorRenderer | pxvrpf_EmbeddedFontAsCurves) and RenderTarget to pxvrm_Printing.
It would render text with embedded fonts as paths and will use TextOut to show text that don't use embedded fonts.

To archive a good quality I would recommend to create EMF with larger size than your preview is, render it to the temporary bitmap of the same size and then draw this bitmap on your preview window using with scaling.
It is required as GDI does not support anti-aliasing.
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.