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
Display PDF in black and white not colour
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.
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.
- 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
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
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
Re: Display PDF in black and white not colour
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
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
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Display PDF in black and white not colour
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
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
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Display PDF in black and white not colour
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
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
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Display PDF in black and white not colour
Hello Simon,
I'm afraid that's the only way of doing that.
Cheers,
Alex
I'm afraid that's the only way of doing that.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ