exportToImages ignores DPI setting

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
Jannis
User
Posts: 2
Joined: Fri Dec 08, 2017 1:41 pm

exportToImages ignores DPI setting

Post by Jannis »

Hi everybody,

i have a problem when i try to convert PDF to image. I use the op.document.exportToImages function with the C# sample code from https://sdkhelp.pdf-xchange.com/vi ... rtToImages.

I´ve changed the sample code to use BMP as Output-Format and want to use a higher DPI than the default of 150:

Code: Select all

//pdfEditControl is AxPXV_Control
var doc = pdfEditControl.Doc;
var inst = pdfEditControl.Inst;
var nID = inst.Str2ID("op.document.exportToImages", false);
var op = inst.CreateOp(nID);
ICabNode input = op.Params.Root["Input"];
input.Add().v = doc;
ICabNode options = op.Params.Root["Options"];
options["PagesRange.Type"].v = "Exact";
options["PagesRange.Text"].v = "1";
options["DestFolder"].v = @"C:\temp";
options["ExportMode"].v = "AllToMutliPage";
options["Zoom"].v = 100.0;
options["ShowResultFolder"].v = false;
options["FileName"].v = "t.bmp";

ICabNode fmtParams = options["FormatParams"];
fmtParams["FMT"].v = 1112363040; //Image Format BMP
fmtParams["DPIX"].v = 300;
fmtParams["DPIY"].v = 300;
fmtParams["ITYP"].v = 21; //Truecolor 32

op.Do();
The code works but seems to ignore the DPI-setting. When i open the exported BMP in IfranView it shows a DPI of 150. There is no change in filesize between a exported BMP with 150 or 300 DPI.
I also tried a DPI of 96 DPI but neither IrfanView nor filesize changed. DPI is still 150
Acoording to the ImageTestTool from https://www.pdf-xchange.com/forum3 ... 66&t=25943 BMP should support DPI-Setting.

Whats wrong?

Windows 10 with PDFXEditCore.x64.dll Version 6.0.322.7

Regards
Jannis
Jannis
User
Posts: 2
Joined: Fri Dec 08, 2017 1:41 pm

Re: exportToImages ignores DPI setting

Post by Jannis »

I figured out myself. DPIX and DPIY are parameter of the options-Object and not of the fmtParams.

So use

Code: Select all

 options["DpiX"].v = 300;
 options["DpiY"].v = 300;
instead of

Code: Select all

fmtParams["DPIX"].v = 300;
fmtParams["DPIY"].v = 300;
But your example code on https://sdkhelp.pdf-xchange.com/vi ... rtToImages seems to be wrong. There is the same mistake.
Maybe you can fix this :)

Regrads
Jannis
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: exportToImages ignores DPI setting

Post by Sasha - Tracker Dev Team »

Hello Jannis,

The DpiX and DpiY values from the operation's options are used for real image DPI.
The DPIX and DPIY are used purely for image info data (if you right click on the image and see it's properties).
We synchronize them in the Export to Images dialog, and basically you will have to do the same for correct results.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply