I contact you because we are facing a bug in our PDFTron WebViewer, related to the displayed color for the specific part of a document I want to annotate.
it looks great (the part which should be white is white, and the part which should be blue is blue, the colors are the same as they are in the original document). PDFTron WebViewer Demo: JavaScript PDF Viewer Demo
even when downloading it from Download feature, colors is correctly maintained :
NOK in our WebViewer UI
However, when I try to show the same document from my WebViewer (v 8.3, so maybe it has been fixed ?), there is a strange color behaviour, The white part is changed into blue, and the small vertical blue line inside the white part becomes grey:
BUT when downloading it, the initial white part stays in what as it should be
FYI, and you can reproduce it if you want to confirm, if I read the document through Acrobat Reader for instance, the correct colors are displayed, so the problem seems to be clearly inside our viewer which “invent” a generated color that should not be.
AND, I tried it through your COLOR SEPARATION demo URL JS CMYK Color Separation Demo | PDFTron WebViewer, and I reproduced exactly the same issue, with the "PANTONE 7709 C which is generated/rendered even above the originally white part which doesn’t appear anymore in this mode
const doc = documentViewer.getDocument();
// enable color separation
doc.enableColorSeparations();
// This callback will be fired once for each color in the document
doc.addEventListener('colorSeparationAdded', (colorData) => {
/*** colorData = { color: [number, number, number, number], // CMYK value of the color enabled: boolean, // is the color enabled or not name: string, // name of the color rgb: [number, number, number] // RGB value of the color } ***/
// To toggle the colors, use the `enableSeparation` API
console.log('colorData: ', colorData);
if (colorData.name === 'PANTONE 7709 C'){
doc.enableSeparation(colorData.name, false); // disable this color
}
// Update the view after you're finished toggling
documentViewer.refreshAll();
documentViewer.updateView();
});
Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
Thanks but I don’t want to make this color disappear. This color is existing in the original image, but is just outside the kind of rectangle with rounded edges (right part), not inside (left part).
If you open the original document with any standard application that allows you to view it, or even the WebViewer
However, as soon as I use your color separation tool:
JS CMYK Color Separation Demo
There is a strange behaviour. I don’t want to just hide the blue, I want to keep the original colors as they are and where they are, and I don’t wank the tool replacing some colors randomly (like putting blue instead of white in our specific case:
I would like to have the same image appearing with the same correct rendering whatever feature I use from the WebViewer.
So, could you please explain me why this Color Separation feature changes some random colors for some illogical reason, and how to solve that issue please?
Thank you for pointing this out,
We’ve added the issue to our backlog to be worked on in the future. We don’t have a timeline for when it will be fixed but if it does get fixed we’ll let you know when it’s available in an experimental build to test out and the estimated official release date. If you have a desired timeline for having this issue fixed please let us know and we’ll do our best to work with you on how this can fit into the release schedule.
Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
Okay, yes please let me know as soon as you have more info: the sooner the better for us since we have customer using and appreciating the feature.
Meanwhile, could you please explain me how do you manage the code to partition the color rendering of each mode in your demos? As long as we don’t specifically run the color separator tool, the rendering is fine. I would like to be able to partition in the same way so that we always have the exact default rendering and not the potentially erroneous “overlay” color separation rendering that can generate errors. Therefore, the color separation rendering will only be activated when the user decides to do so by clicking on a specific button, which by default allows us to ensure that we have the right rendering until the color separation rendering is fixed.
Oddly enough, the color-separation demo is the only demo incorrect displaying the pdf image.
You can find the code for it here:
When the pdf is loaded into the demo, we enable colorSeparations:
const doc = instance.Core.documentViewer.getDocument();
const separations = doc.getColorSeparations();
doc.enableColorSeparations(true); // This part can be used without a parameter
Thank you in advance.
Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.