Display PDF in black and white not colour

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
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Display PDF in black and white not colour

Post by lidds »

I have a colour PDF and I want to give the user the option to display the PDF within PDF Xchange Editor in black and white. I do not want to change the actual PDF to black and white just show the PDF in black and white within your PDF control, is this possible?

Thanks

Simon
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Display PDF in black and white not colour

Post by Tracker Supp-Stefan »

Hi Simon,

I've checked the SDK help pages - and could find mentions of rendering in the Core API section - but those are all related to the process of creating new PDF files.
Without creating a temp copy of the file that is stripped of colours I can think of e.g. trying to activate the Accessibility mode - which would change the colours as per the settings specified, or changing the "Edit -> Preferences -> Page Display -> Rendering -> Default transparency blending color space:" to Greyscale.

An alternative approach if using the Core API is to use one of the functions DrawToMemory, DrawToDevice or DrawToIXCPage

in case of DrawToMemory, nBufferFormat should be passed as kDrawFormat_Gray;
in case of DrawToDevice you will need to create IPXC_PageRenderParams object, and specify grayscale profile in it.
in case of DrawToIXCPage you have to use the same approach as for DrawToDevice and also, you will have to create IIXC_Page in grayscale format and pass it to the function.

Regards,
Stefan
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Display PDF in black and white not colour

Post by lidds »

Hi Stefan,

The below method gives desired results, however how can I do this via code?

"Edit -> Preferences -> Page Display -> Rendering -> Default transparency blending color space:" to Greyscale

Also, is there an option to use Black and White instead of greyscale?

Thanks in advance

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

Re: Display PDF in black and white not colour

Post by Sasha - Tracker Dev Team »

Hello Simon,

You will have to change this setting PageRendering.BlendingCS to 2. Don't forget to fire the PXV_AppPrefsChange_PageRendering AppPrefsChanged event.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Display PDF in black and white not colour

Post by lidds »

Alex,

Thanks that worked. Just out of interest is there anyway to make this black and white instead of grayscale?

I have come across this code on the forum that does it by changing the colour of each PDF graphic item, however it takes sometime to process.

Thanks

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

Re: Display PDF in black and white not colour

Post by Sasha - Tracker Dev Team »

Hello Simon,

I'm afraid that's the only way of doing that.

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